Static Route Configuration

Every router forwards packets based on its routing table — a list of known networks and the next-hop or exit interface used to reach each one. Routes can be learned dynamically through routing protocols like OSPF, or entered manually by an administrator. A static route is a manually configured route that tells the router exactly where to send traffic destined for a specific network. It never changes unless an administrator modifies it.

Static routes are ideal for small networks, stub networks with only one exit point, and for providing backup paths when dynamic routing is the primary method. They are predictable, lightweight (no routing protocol overhead), and easy to verify. This lab covers standard static routes, the default route (gateway of last resort), and floating static routes for backup path scenarios.

Before starting, review Inter-VLAN Routing — Router-on-a-Stick and Inter-VLAN Routing — Layer 3 Switch for context on how routers handle directly connected networks.

1. Routing Table Fundamentals

Before configuring static routes, it helps to understand the three types of routes that can appear in a router's routing table and how the router chooses between them:

Route Type Code How It Gets There Default AD
Connected C Automatically added when an interface with an IP is up/up 0
Local L The router's own interface IP address (/32 host route) — added with connected 0
Static S Manually configured with ip route 1
OSPF O Learned via OSPF routing protocol 110
RIP R Learned via RIP routing protocol 120
EIGRP D Learned via EIGRP routing protocol 90

Administrative Distance (AD)

When a router has multiple routes to the same destination from different sources, it uses Administrative Distance to select the most trustworthy one. Lower AD wins. A static route (AD 1) is always preferred over an OSPF route (AD 110) to the same destination. A connected route (AD 0) beats everything.

Static Route Command Syntax

ip route [destination-network] [subnet-mask] [next-hop-IP | exit-interface] [AD]
  
Parameter Description Example
destination-network The remote network to reach 192.168.20.0
subnet-mask The subnet mask for the destination 255.255.255.0
next-hop-IP The IP address of the next router in the path 10.0.0.2
exit-interface The local interface to send packets out (alternative to next-hop) GigabitEthernet0/1
AD (optional) Administrative Distance — used to create floating static routes 210
Next-hop IP vs exit interface: Using a next-hop IP address is recommended for point-to-point and Ethernet links. Using an exit interface alone works on serial point-to-point links but can cause issues on Ethernet — the router must ARP for every destination, generating unnecessary traffic. Best practice is to specify both: ip route 192.168.20.0 255.255.255.0 GigabitEthernet0/1 10.0.0.2.

2. Lab Topology & IP Addressing

Three routers connected in a line — a classic topology for practicing static routing. NetsTuts_R1 connects a LAN on the left, NetsTuts_R3 connects a LAN on the right, and NetsTuts_R2 sits in the middle connecting them. There is also a secondary path (R1 → R3 direct) for the floating static route demonstration.

  192.168.10.0/24          10.0.12.0/30        10.0.23.0/30       192.168.30.0/24
  (LAN-R1)                 (R1 ↔ R2)           (R2 ↔ R3)          (LAN-R3)

  [PC1]──────[R1]─────────────────────[R2]─────────────────────[R3]──────[PC3]
  .10    Gi0/0  Gi0/1            Gi0/0    Gi0/1             Gi0/0  Gi0/0  .10
             192.168.10.1    10.0.12.1  10.0.12.2   10.0.23.1  10.0.23.2  192.168.30.1

              Gi0/2 ─────────────────────────────────────── Gi0/1
           10.0.13.1                                    10.0.13.2
              (R1 ↔ R3 backup link — for floating static route demo)
  
Device Interface IP Address Connected To
NetsTuts_R1 Gi0/0 192.168.10.1 /24 LAN — PC1 (192.168.10.10)
NetsTuts_R1 Gi0/1 10.0.12.1 /30 NetsTuts_R2 Gi0/0
NetsTuts_R1 Gi0/2 10.0.13.1 /30 NetsTuts_R3 Gi0/1 (backup)
NetsTuts_R2 Gi0/0 10.0.12.2 /30 NetsTuts_R1 Gi0/1
NetsTuts_R2 Gi0/1 10.0.23.1 /30 NetsTuts_R3 Gi0/0
NetsTuts_R3 Gi0/0 10.0.23.2 /30 NetsTuts_R2 Gi0/1
NetsTuts_R3 Gi0/0 192.168.30.1 /24 LAN — PC3 (192.168.30.10)
NetsTuts_R3 Gi0/1 10.0.13.2 /30 NetsTuts_R1 Gi0/2 (backup)

3. Step 1 — Configure Standard Static Routes

For PC1 (192.168.10.0/24) to reach PC3 (192.168.30.0/24), every router in the path needs a route in both directions. Traffic flows R1 → R2 → R3 for the forward path, and R3 → R2 → R1 for the return path. Missing a route in either direction breaks connectivity.

NetsTuts_R1 — Static Routes

NetsTuts_R1>en
NetsTuts_R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.

! ── Route to R3's LAN via R2 ──────────────────────────────
NetsTuts_R1(config)#ip route 192.168.30.0 255.255.255.0 10.0.12.2
! ── Route to R2-R3 link (needed for full reachability) ───
NetsTuts_R1(config)#ip route 10.0.23.0 255.255.255.252 10.0.12.2
NetsTuts_R1(config)#end
NetsTuts_R1#wr
Building configuration...
[OK]
NetsTuts_R1#
  
R1 now knows: "To reach 192.168.30.0/24, send packets to 10.0.12.2 (R2's interface)." R2 receives them and continues forwarding toward R3.

NetsTuts_R2 — Static Routes (Both Directions)

NetsTuts_R2>en
NetsTuts_R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.

! ── Route to R1's LAN (return path) ──────────────────────
NetsTuts_R2(config)#ip route 192.168.10.0 255.255.255.0 10.0.12.1
! ── Route to R3's LAN (forward path) ─────────────────────
NetsTuts_R2(config)#ip route 192.168.30.0 255.255.255.0 10.0.23.2
NetsTuts_R2(config)#end
NetsTuts_R2#wr
Building configuration...
[OK]
NetsTuts_R2#
  
R2 is the transit router — it needs routes in both directions to pass traffic between R1's LAN and R3's LAN.

NetsTuts_R3 — Static Routes

NetsTuts_R3>en
NetsTuts_R3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.

! ── Route to R1's LAN via R2 (return path) ───────────────
NetsTuts_R3(config)#ip route 192.168.10.0 255.255.255.0 10.0.23.1
! ── Route to R1-R2 link ───────────────────────────────────
NetsTuts_R3(config)#ip route 10.0.12.0 255.255.255.252 10.0.23.1
NetsTuts_R3(config)#end
NetsTuts_R3#wr
Building configuration...
[OK]
NetsTuts_R3#
  

4. Step 2 — Default Route (Gateway of Last Resort)

A default route matches any destination that does not have a more specific entry in the routing table. It is the "send everything else here" instruction — commonly used to point branch routers toward an ISP or a central hub router. The destination is 0.0.0.0 0.0.0.0, which matches all possible IP addresses with zero specificity.

In this topology, R1 could use a default route instead of specific static routes, since all traffic leaving the LAN exits through R2 in a single direction:

! ── Replace specific routes with a default route on R1 ───
NetsTuts_R1(config)#no ip route 192.168.30.0 255.255.255.0 10.0.12.2
NetsTuts_R1(config)#no ip route 10.0.23.0 255.255.255.252 10.0.12.2

NetsTuts_R1(config)#ip route 0.0.0.0 0.0.0.0 10.0.12.2
NetsTuts_R1(config)#end
NetsTuts_R1#wr
Building configuration...
[OK]
NetsTuts_R1#
  
One command replaces all specific routes. R1 will now forward any packet whose destination is not a directly connected network to R2 (10.0.12.2). This is the typical configuration for a stub router or branch office.

Confirming the Gateway of Last Resort

NetsTuts_R1#show ip route
Codes: C - connected, S - static, L - local

Gateway of last resort is 10.0.12.2 to network 0.0.0.0

S*    0.0.0.0/0 [1/0] via 10.0.12.2

      10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C        10.0.12.0/30 is directly connected, GigabitEthernet0/1
L        10.0.12.1/32 is directly connected, GigabitEthernet0/1
C        10.0.13.0/30 is directly connected, GigabitEthernet0/2
L        10.0.13.1/32 is directly connected, GigabitEthernet0/2

      192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.10.0/24 is directly connected, GigabitEthernet0/0
L        192.168.10.1/32 is directly connected, GigabitEthernet0/0
  
"Gateway of last resort is 10.0.12.2 to network 0.0.0.0" confirms the default route is active. The S* code means static route that is the candidate default — the asterisk (*) marks it as the gateway of last resort.

Propagating the Default Route

When using a routing protocol like OSPF, the default route can be shared with other routers using:

NetsTuts_R1(config-router)#default-information originate
  
This tells OSPF to advertise the default route to all neighbors — so every router in the OSPF domain automatically learns R1 as the gateway of last resort. Covered in detail in OSPF Single-Area Configuration.

5. Step 3 — Floating Static Route (Backup Path)

A floating static route is a backup static route with a higher Administrative Distance than the primary route. Under normal conditions, the primary route (lower AD) is installed in the routing table and the floating static route is hidden. If the primary route disappears (the link goes down or the routing protocol loses the route), the floating static route automatically appears and takes over — without any administrator intervention.

Scenario: Primary via R2, Backup via Direct R1–R3 Link

! ── On R1: Primary route via R2 (AD 1 — default) ─────────
NetsTuts_R1(config)#ip route 192.168.30.0 255.255.255.0 10.0.12.2

! ── On R1: Floating static via direct R3 link (AD 5) ─────
NetsTuts_R1(config)#ip route 192.168.30.0 255.255.255.0 10.0.13.2 5

NetsTuts_R1(config)#end
NetsTuts_R1#wr
Building configuration...
[OK]
NetsTuts_R1#
  
Two routes to 192.168.30.0/24 — primary via 10.0.12.2 (R2) at AD 1, backup via 10.0.13.2 (direct to R3) at AD 5. Only the primary is installed in the routing table while both interfaces are up.

Routing Table with Both Links Up — Only Primary Installed

NetsTuts_R1#show ip route
...
S     192.168.30.0/24 [1/0] via 10.0.12.2
...
  
Only the primary route (AD 1 via R2) appears. The floating static route (AD 5) is not installed — it is held in reserve.

Routing Table After Primary Link Fails

! ── Simulating R1's Gi0/1 going down ─────────────────────
NetsTuts_R1(config)#interface GigabitEthernet0/1
NetsTuts_R1(config-if)#shutdown
  
NetsTuts_R1#show ip route
...
S     192.168.30.0/24 [5/0] via 10.0.13.2
...
  
With Gi0/1 down, the primary route via 10.0.12.2 disappears. The floating static route (AD 5) is now the only route to 192.168.30.0/24 and is automatically installed. Traffic continues via the direct R1–R3 link.

Floating Static Route AD Selection

Scenario Primary Route AD Floating Static AD Rule
Backup for a static route 1 (default static) 2–254 Floating AD must be higher than primary AD
Backup for OSPF 110 (OSPF default) 111–254 Must be higher than 110 to stay hidden when OSPF route exists
Backup for EIGRP 90 (EIGRP default) 91–254 Must be higher than 90

6. Verification

show ip route — Full Routing Table (R2)

NetsTuts_R2#show ip route
Codes: C - connected, S - static, L - local

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C        10.0.12.0/30 is directly connected, GigabitEthernet0/0
L        10.0.12.1/32 is directly connected, GigabitEthernet0/0
C        10.0.23.0/30 is directly connected, GigabitEthernet0/1
L        10.0.23.1/32 is directly connected, GigabitEthernet0/1

S     192.168.10.0/24 [1/0] via 10.0.12.1
S     192.168.30.0/24 [1/0] via 10.0.23.2
  
R2's routing table shows two connected networks (C) and two static routes (S). The notation [1/0] means AD=1, metric=0 — standard for static routes.

Reading a Routing Table Entry

Field Example Meaning
Route code S Static route — manually configured
Destination 192.168.30.0/24 The network this route reaches
AD / Metric [1/0] Administrative Distance 1, Metric 0
Next hop via 10.0.23.2 Send packets to this IP address (R3's interface)

ping — Basic Connectivity Test

NetsTuts_R1#ping 192.168.30.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.30.10, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/3 ms
NetsTuts_R1#
  

traceroute — Verify the Exact Path

NetsTuts_R1#traceroute 192.168.30.10
Type escape sequence to abort.
Tracing the route to 192.168.30.10

  1 10.0.12.2 1 msec 1 msec 1 msec
  2 10.0.23.2 2 msec 1 msec 2 msec
  3 192.168.30.10 2 msec 2 msec 3 msec
NetsTuts_R1#
  
Three hops confirmed: R1 → R2 (10.0.12.2) → R3 (10.0.23.2) → PC3. traceroute is essential for verifying the actual traffic path and identifying exactly where packets stop when there is a problem.

show ip route static — Static Routes Only

NetsTuts_R2#show ip route static
Codes: S - static

S     192.168.10.0/24 [1/0] via 10.0.12.1
S     192.168.30.0/24 [1/0] via 10.0.23.2
  

show running-config | include ip route

NetsTuts_R1#show running-config | include ip route
ip route 0.0.0.0 0.0.0.0 10.0.12.2
ip route 192.168.30.0 255.255.255.0 10.0.12.2
ip route 192.168.30.0 255.255.255.0 10.0.13.2 5
  
Quick view of all static routes in the configuration — useful for auditing. The floating static route (AD 5) is visible here even though it is not currently installed in the routing table.

Verification Command Summary

Command What It Shows
show ip route Full routing table — all connected, static, and dynamic routes with AD/metric
show ip route static Only static routes — useful on routers with many dynamic routes
show ip route [network] Detailed route entry for a specific network — shows next hop, age, metric
show running-config | include ip route All configured static routes including floating routes not in the table
ping [IP] Basic end-to-end reachability test
traceroute [IP] Hop-by-hop path verification — identifies exactly which router a packet reaches

7. Troubleshooting Static Routes

Problem Symptom Cause Fix
Route not in routing table Static route configured but missing from show ip route The next-hop IP is unreachable — the interface toward the next hop is down, or the next-hop IP itself is wrong Verify the next-hop IP is reachable with ping [next-hop]. Check interface status with show ip interface brief
One-way connectivity Ping from R1 to PC3 works but reverse fails Return path is missing — R3 has no route back to R1's LAN. Routing must be configured in both directions. Add the missing return route on R3: ip route 192.168.10.0 255.255.255.0 [next-hop]
Floating static not activating Primary link down but backup route does not appear The floating static AD is lower than or equal to the primary AD — it is actually installed as the active route, not a backup Ensure floating static AD is strictly higher than the primary. Check with show running-config | include ip route
Wrong path taken traceroute shows unexpected hops A more specific route or lower-AD route is overriding the intended path Use show ip route [destination] to see exactly which route is being used and why. Check for conflicting routes.
Default route not propagating Other routers have no gateway of last resort despite default route on R1 Default route is static — routing protocols do not automatically redistribute it unless configured Add default-information originate under the OSPF process to advertise the default route to neighbors
Recursive routing issue Static route installed but traffic is dropped or loops Next-hop IP is reachable via a route that itself requires the same next hop — creating a routing loop Verify the next-hop IP is on a directly connected subnet. Avoid using next hops that require recursive lookups through other static routes

Key Points & Exam Tips

  • Static routes are manually configured with ip route [network] [mask] [next-hop | interface]. They never change unless an administrator modifies them.
  • The default static route — ip route 0.0.0.0 0.0.0.0 [next-hop] — matches any destination not in the routing table. It appears as S* and sets the Gateway of Last Resort.
  • Administrative Distance (AD) determines which source is trusted when multiple routes to the same destination exist. Lower AD wins: Connected=0, Static=1, OSPF=110, RIP=120.
  • A floating static route is a backup route with a manually set AD higher than the primary route. It stays hidden until the primary route disappears.
  • Always configure routes in both directions — a route from R1 to R3's network without a return route on R3 causes one-way connectivity (pings fail because replies are dropped).
  • Use a next-hop IP address rather than an exit interface alone on Ethernet links — using only an interface makes the route a proxy ARP candidate and can cause unexpected behavior.
  • In show ip route, the code S* marks the default static route (gateway of last resort). [1/0] means AD=1 and metric=0.
  • A static route only appears in the routing table if the next-hop IP is reachable — if the next-hop becomes unreachable (link down), the static route is removed from the table.
  • traceroute is the most powerful verification tool for static routing — it shows the exact path packet by packet, identifying the precise hop where packets stop.
  • Static routes are best for stub networks (one path only), small networks, and backup paths. For larger networks with multiple paths, use a dynamic protocol like OSPF.
Next Steps: Static routes work well for simple, predictable topologies. For networks that need to adapt automatically to link failures and topology changes, continue to OSPF Single-Area Configuration. For a deeper look at backup path design, see Floating Static Routes. For connecting branch sites to a central router, see DHCP Server Configuration to ensure routed subnets receive dynamic IP addressing.

TEST WHAT YOU LEARNED

1. R1 has a static route to 192.168.30.0/24 via 10.0.12.2. PC1 can ping R3's interface but PC3 cannot ping back to PC1. What is the most likely cause?

Correct answer is D. The fact that PC1 can reach R3's interface means the forward path (R1 → R2 → R3) is working correctly. One-way connectivity — where forward works but reverse fails — is the classic symptom of a missing return route. R3 receives the ping from PC1 but has no route back to 192.168.10.0/24, so the reply is dropped. Add ip route 192.168.10.0 255.255.255.0 10.0.23.1 on R3.

2. A static route is configured correctly on R1 but does not appear in show ip route. What is the most likely cause?

Correct answer is B. IOS only installs a static route into the routing table if the next-hop IP address is reachable — meaning there is already a connected or learned route to that next hop. If the interface connecting R1 to the next-hop router is down, or the next-hop IP is misconfigured, the static route sits in the configuration but does not appear in the routing table. Verify with ping [next-hop] and show ip interface brief.

3. What does the S* code mean in show ip route, and what is the significance of the asterisk?

Correct answer is A. In the routing table, S identifies a static route. The asterisk (*) specifically marks the route as the candidate default — the Gateway of Last Resort. This only appears on the default route (0.0.0.0/0). The line "Gateway of last resort is [IP] to network 0.0.0.0" that appears at the top of show ip route output confirms this route is active as the fallback for all unmatched destinations.

4. R1 has a static route to 192.168.30.0/24 via R2 with default AD 1, and a floating static to the same destination via a direct link with AD 5. Both links are currently up. Which route appears in the routing table and why?

Correct answer is C. Administrative Distance is a tie-breaker used when multiple sources advertise a route to the same destination. The lower the AD, the more trusted the source. With AD 1 (static) vs AD 5 (floating static), IOS installs only the AD 1 route. The floating static is held in reserve — it only enters the routing table when the AD 1 route disappears, such as when the primary interface goes down.

5. An engineer configures a floating static route as a backup for an OSPF-learned route. The OSPF route has AD 110. What AD value must the floating static route use to remain hidden while OSPF is active?

Correct answer is D. For a floating static to act as a backup, its AD must be strictly greater than the AD of the route it backs up. OSPF's default AD is 110. An AD of 111 or higher ensures the static route is only used when the OSPF route disappears. If the floating static AD is set to 110 or lower, it would compete with or override the OSPF route — defeating the purpose. Common choices are 120, 200, or 210 for OSPF backups.

6. Why is it recommended to specify both an exit interface AND a next-hop IP when configuring a static route on an Ethernet link?

Correct answer is B. When a static route specifies only an exit interface (no next-hop IP), IOS treats the destination as directly connected to that interface. For every packet, the router ARP requests the actual destination IP on that segment — which works on point-to-point serial links (one neighbor) but is problematic on Ethernet where many hosts share the segment. This generates unnecessary ARP traffic and can lead to ARP table bloat. Specifying a next-hop IP tells the router to ARP for just the next hop, not each individual destination.

7. traceroute 192.168.30.10 from R1 shows the first hop as 10.0.13.2 instead of the expected 10.0.12.2. What does this indicate?

Correct answer is C. Traceroute shows the actual path packets take through the network — it does not probe alternatives. If the first hop is 10.0.13.2 (the direct R1–R3 link) rather than 10.0.12.2 (via R2), it means R1's routing table currently has a route via 10.0.13.2 installed as the active path. This could mean the primary Gi0/1 link is down (triggering the floating static), or the floating static has a lower AD than intended and is overriding the primary route.

8. What is the notation [1/0] in a routing table entry like S 192.168.30.0/24 [1/0] via 10.0.23.2?

Correct answer is A. In Cisco routing table output, the format is always [Administrative Distance / Metric]. For static routes: AD is always 1 (the default for static routes unless manually changed) and metric is always 0 (static routes do not use a metric — they are trusted unconditionally at face value). For comparison, an OSPF route would show [110/cost] where cost reflects the link bandwidth.

9. R1 has both a specific static route to 192.168.30.0/24 and a default route (0.0.0.0/0). A packet arrives destined for 192.168.30.50. Which route does R1 use and why?

Correct answer is D. Routers use the longest prefix match rule — the most specific route (largest subnet mask) always wins over a less specific one, regardless of AD or order of configuration. 192.168.30.0/24 (/24 = 24 matching bits) is more specific than 0.0.0.0/0 (/0 = 0 matching bits). The default route only matches destinations that have no other entry in the routing table.

10. Which command shows all configured static routes including floating static routes that are not currently installed in the routing table?

Correct answer is B. show ip route static only shows routes that are currently installed in the routing table. A floating static route that is suppressed because a better route exists will not appear there. show running-config | include ip route shows all ip route commands in the configuration — including floating static routes with high AD values that are not currently active. This is the only command that reveals the full picture of all configured routes.