Static Routing
Manually define routes to remote networks - the router won’t learn them automatically.
Why Use Static Routing?
Section titled “Why Use Static Routing?”You need static routes when:
- You have a small network (2-5 routers) where manual configuration is manageable
- You want full control over routing paths (no automatic route selection)
- You’re connecting to a stub network (network with only one way in/out)
- You’re creating a default route to the internet
- You need a backup route in case dynamic routing fails
When NOT to use: Large networks with many routers - use dynamic routing (OSPF, EIGRP) instead.
Basic Static Route
Section titled “Basic Static Route”Router(config)# ip route 192.168.20.0 255.255.255.0 10.1.1.2Parameters:
- 192.168.20.0 255.255.255.0 - Destination network and mask. Replace with the network you want to reach.
- 10.1.1.2 - Next-hop IP address. Replace with the IP of the router that knows how to reach the destination.
Format: ip route [destination network] [subnet mask] [next-hop IP or exit interface]
Static Route via Exit Interface
Section titled “Static Route via Exit Interface”Instead of specifying next-hop IP, use the exit interface.
Router(config)# ip route 192.168.20.0 255.255.255.0 GigabitEthernet0/0/1Default Route (Gateway of Last Resort)
Section titled “Default Route (Gateway of Last Resort)”Sends all unknown traffic to a specific next-hop - commonly used for internet access.
Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1Or via exit interface:
Router(config)# ip route 0.0.0.0 0.0.0.0 Serial0/0/0Administrative Distance
Section titled “Administrative Distance”Change the priority of a route (lower = more preferred). Default for static routes is 1.
Floating static route (backup route):
Router(config)# ip route 192.168.20.0 255.255.255.0 10.1.1.2Router(config)# ip route 192.168.20.0 255.255.255.0 10.1.1.3 5The second route has AD of 5, so it’s used as a backup if the first route fails.
Summary Route
Section titled “Summary Route”Advertise multiple networks with one route entry.
Example: Instead of:
- 192.168.16.0/24
- 192.168.17.0/24
- 192.168.18.0/24
- 192.168.19.0/24
Use one summary route:
Router(config)# ip route 192.168.16.0 255.255.252.0 10.1.1.2This covers 192.168.16.0 through 192.168.19.0 (/22 = 255.255.252.0).
Host Route
Section titled “Host Route”Route to a single IP address (/32 mask).
Router(config)# ip route 192.168.10.100 255.255.255.255 10.1.1.5Useful for directing traffic to a specific server.
Delete Static Route
Section titled “Delete Static Route”Router(config)# no ip route 192.168.20.0 255.255.255.0 10.1.1.2Verify Configuration
Section titled “Verify Configuration”Router# show ip routeRouter# show ip route staticRouter# show ip route 192.168.20.0Router# show running-config | include ip routeTypical output:
Router# show ip route staticS 192.168.20.0/24 [1/0] via 10.1.1.2S* 0.0.0.0/0 [1/0] via 203.0.113.1Legend:
S= Static routeS*= Default static route[1/0]= [Administrative Distance / Metric]