2 Static and Default Routing
Learn how static and default routes direct packet forwarding, how to configure them on Cisco IOS, and how to verify and troubleshoot connectivity.
How routers select routes
A router forwards packets using its . Each entry identifies a destination network and how to reach it, usually through a next-hop router or an exit interface. If multiple entries match a destination, the router uses : the most specific matching route wins.
Configure static routes
A is entered manually and remains in the configuration until it is changed or removed. Static routes are useful in small or stable networks, for specific paths, or as backup routes, but they do not automatically adapt to topology changes.
Configure a
On Cisco IOS, the general command specifies the destination network, subnet mask, and next-hop address:
For example, R1 and R2 are connected over 10.0.12.0/30. R1 uses 10.0.12.1 on the link and connects to LAN 192.168.1.0/24; R2 uses 10.0.12.2 and connects to LAN 192.168.2.0/24. Each router needs a route to the LAN behind the other router:
The must be reachable through an active interface. A route on only one router is not enough for two-way communication; the destination network also needs a .
To remove a , negate the command by adding no:
Configure a
A is used when no more-specific route matches the destination. It is also called the . On Cisco IOS, the IPv4 is written as 0.0.0.0/0:
For example, an edge router can send otherwise-unmatched traffic to its upstream router:
A does not replace routes needed to reach internal networks. Configure it only where forwarding unknown destinations to that is appropriate, and ensure the can return traffic.
Verify routes and connectivity
Check interface status and addresses, inspect the , and test the path with commands such as:
In the , C identifies a connected route and S identifies a . A static may appear as S*; the asterisk marks it as a candidate default. Confirm that the expected route is present and points to the intended . A successful ping to the next-hop address is a useful first test, but it does not by itself prove that the final destination or its is working.
Troubleshoot unreachable destinations
When a destination is unreachable, check the route hop by hop:
Check interface state and addressing. The outgoing interface should be up, and the link and LAN addresses and masks should be correct.
Check the route’s destination and mask. A mistyped network or subnet mask can send traffic toward the wrong route or prevent the route from matching.
Check next-hop reachability. The router must have a working path to the configured . If the cannot be resolved, the may not be installed in the active .
Check the . The far-end router needs a route back to the source network; otherwise, replies cannot return.
Check which route matches. A more-specific route takes precedence over a , even if the is configured correctly.
Test in stages. Ping the local gateway, then the , then the remote router interface, and finally a host. Use
tracerouteto identify where forwarding stops.
Static routes manually specify paths to destination networks. A forwards traffic when no more-specific route matches. For end-to-end connectivity, verify the , interfaces, next-hop reachability, and the route back to the source.