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 |
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#
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#
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#
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
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
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#
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 ...
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 ...
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
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#
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
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.
tracerouteis 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.