Skip to content

Static Routing

Manually define routes to remote networks - the router won’t learn them automatically.

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.

Router(config)# ip route 192.168.20.0 255.255.255.0 10.1.1.2

Parameters:

  • 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]

Instead of specifying next-hop IP, use the exit interface.

Router(config)# ip route 192.168.20.0 255.255.255.0 GigabitEthernet0/0/1

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.1

Or via exit interface:

Router(config)# ip route 0.0.0.0 0.0.0.0 Serial0/0/0

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.2
Router(config)# ip route 192.168.20.0 255.255.255.0 10.1.1.3 5

The second route has AD of 5, so it’s used as a backup if the first route fails.

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.2

This covers 192.168.16.0 through 192.168.19.0 (/22 = 255.255.252.0).

Route to a single IP address (/32 mask).

Router(config)# ip route 192.168.10.100 255.255.255.255 10.1.1.5

Useful for directing traffic to a specific server.

Router(config)# no ip route 192.168.20.0 255.255.255.0 10.1.1.2
Router# show ip route
Router# show ip route static
Router# show ip route 192.168.20.0
Router# show running-config | include ip route

Typical output:

Router# show ip route static
S 192.168.20.0/24 [1/0] via 10.1.1.2
S* 0.0.0.0/0 [1/0] via 203.0.113.1

Legend:

  • S = Static route
  • S* = Default static route
  • [1/0] = [Administrative Distance / Metric]