Static routing & default gateways
Static routing is the simplest possible way to teach a router which way to send packets for a given destination network. This lesson covers connected, static, and default routes, longest-prefix match, and the gotchas that catch every student the first time.
Open this labWhat a routing table actually contains
A routing table is a list of (destination network, next hop, outgoing interface) tuples. When a packet arrives, the router looks up the destination IP, finds the most specific matching route, and forwards the packet out the listed interface toward the listed next hop.
Routes come from three sources in NetForge-AI: connected (learned automatically when you assign an IP to an interface), static (manually configured with ip route), and default (a 0.0.0.0/0 catch-all set with ip default-gateway or ip route 0.0.0.0 0.0.0.0).
Longest-prefix match
When two routes both match a destination, the router uses the one with the longer prefix. A /24 beats a /16. A /32 host route beats everything except an identical /32. This rule is why you can have a default route to the Internet and more-specific internal routes simultaneously, with internal traffic always preferring the specific match.
Configuring a static route
Static routes are written as: ip route <network> <mask> <next-hop>. For a router that wants to reach 10.0.2.0/24 via 10.0.99.2:
R1> enable
R1# configure terminal
R1(config)# ip route 10.0.2.0 255.255.255.0 10.0.99.2
R1(config)# end
R1# show ip route
S 10.0.2.0/24 via 10.0.99.2, Se0/0/0Default gateway: the most common mistake
Endpoints (PCs, servers) don't run a routing protocol — they just have one default gateway. If a PC's destination IP is in its own subnet, it ARPs the destination directly. Otherwise, it sends the frame to the gateway's MAC and lets the router worry about it.
A misconfigured default gateway is the #1 reason 'my network is down' tickets are created. If the PC's gateway is wrong, even pings to other subnets fail with no useful error.
Practice this in the lab
Reading helps. Wiring it up yourself and breaking it makes it stick.
Open the lab