Configuring Static Routes – Complete Cisco IOS Guide
1. What Is Static Routing?
Static routing is the manual configuration of routes in a router’s routing table. Instead of learning paths automatically through a dynamic protocol like OSPF or EIGRP, the administrator explicitly tells the router: “to reach network X, send traffic to next-hop Y via interface Z.”
Static routes have an Administrative Distance of 1 by default — the lowest of any routing source except directly connected interfaces (AD 0). This means a static route will always override a dynamic protocol’s route to the same destination unless the static route’s AD is manually raised (floating static).
When to use static routing:
- Stub networks — a branch with only one exit point; no need for a routing protocol
- Default gateway to the Internet — one static default route (
0.0.0.0/0) handles all Internet-bound traffic - Point-to-point links — serial or leased-line links where only one path exists
- Backup paths — floating static routes sit dormant while the primary dynamic route is active
- Security-sensitive environments — no routing protocol traffic means less exposure
- Small networks — fewer than 5–10 routers where dynamic protocol overhead is not justified
Related pages: show ip protocols | Administrative Distance | Default Routes | OSPF Overview | show ip route | show ip interface brief | show running-config | Wildcard Masks | Static Routing Configuration Lab
2. ip route Command Syntax
ip route <destination-network> <subnet-mask> {<next-hop-IP> | <exit-interface> | <exit-interface next-hop-IP>} [AD]
| Parameter | Required? | Description | Example |
|---|---|---|---|
| destination-network | Yes | The network address you want to reach | 192.168.2.0 |
| subnet-mask | Yes | The subnet mask for the destination network (dotted-decimal, not prefix notation) | 255.255.255.0 |
| next-hop-IP | One of these three | IP address of the next router to forward traffic to; used on multi-access (Ethernet) networks | 192.168.1.2 |
| exit-interface | One of these three | The local outgoing interface; simplest for point-to-point links | GigabitEthernet0/0 |
| exit-interface + next-hop | One of these three | Both together — fully specified; eliminates recursive lookup (recommended) | GigabitEthernet0/0 192.168.1.2 |
| AD (optional) | No | Administrative Distance; default = 1; raise above primary route AD for floating static | 150 |
3. Three Configuration Methods – Compared
Method A – Next-Hop IP Only (Multi-Access Networks)
ip route 192.168.2.0 255.255.255.0 192.168.1.2
The router knows the destination is reached via IP 192.168.1.2, but it must perform a recursive lookup to find which local interface leads to that next-hop. Best for Ethernet (multi-access) networks where the next-hop IP is on a directly connected subnet.
Method B – Exit Interface Only (Point-to-Point Links)
ip route 192.168.2.0 255.255.255.0 GigabitEthernet0/0
The router forwards out Gi0/0 and treats the entire exit
interface as directly connected. Fine on serial (HDLC/PPP) point-to-point
links, but avoid on Ethernet — on a broadcast network this
causes the router to ARP for every destination IP individually, flooding
the ARP cache.
Method C – Fully Specified: Interface + Next-Hop (Recommended)
ip route 192.168.2.0 255.255.255.0 GigabitEthernet0/0 192.168.1.2
The most explicit and performant option. The router knows both the exit interface and the next-hop, so no recursive lookup is needed and ARP flooding is avoided. Use this on all Ethernet links.
| Method | Best Link Type | Recursive Lookup? | ARP Impact on Ethernet | Recommended? |
|---|---|---|---|---|
| Next-hop IP only | Ethernet (multi-access) | Yes — one extra lookup | Normal (ARPs for next-hop only) | Acceptable |
| Exit interface only | Serial / point-to-point | No | Problematic — ARPs for every destination IP | Ethernet: No; P2P: Yes |
| Interface + next-hop (fully specified) | Any | No | Normal | Yes — preferred on all Ethernet links |
4. Recursive vs. Directly Connected Static Routes
| Type | How It Works | Example | When to Use |
|---|---|---|---|
| Recursive | Specifies only a next-hop IP; the router performs a second lookup in the routing table to find which interface reaches that next-hop | ip route 10.0.0.0 255.255.255.0 192.168.1.2 |
Multi-access networks; when the next-hop IP is known but the interface may change |
| Directly Connected (Interface-based) | Specifies only an exit interface; router treats route as directly attached and ARPs for every destination | ip route 10.0.0.0 255.255.255.0 GigabitEthernet0/0 |
Point-to-point serial links only; avoid on Ethernet |
| Fully Specified | Specifies both exit interface and next-hop IP; no recursive lookup; most efficient | ip route 10.0.0.0 255.255.255.0 GigabitEthernet0/0 192.168.1.2 |
Best practice for all Ethernet and mixed-link environments |
5. Default Static Route (Gateway of Last Resort)
A default route matches any destination that has no more specific entry in the routing table. It acts as the “gateway of last resort” — typically pointing toward an ISP or upstream router for all Internet-bound traffic.
! Default static route (IPv4) — matches any destination not in the routing table
ip route 0.0.0.0 0.0.0.0 203.0.113.1
! Verify it is installed as gateway of last resort
Router# show ip route
! Gateway of last resort is 203.0.113.1 to network 0.0.0.0
! S* 0.0.0.0/0 [1/0] via 203.0.113.1 ← S* = static default route
The 0.0.0.0 0.0.0.0 mask matches every possible destination
address — it is the widest possible prefix. The router uses the
longest prefix match rule, so a more specific route always wins over the
default.
6. Host Route (/32)
A host route uses a /32 mask (255.255.255.255) to
point to a single specific IP address rather than a network. Common uses
include routing to a loopback interface, directing traffic to a specific
server, or creating precise firewall bypass rules.
! Route to a specific host (single IP address)
ip route 192.168.2.10 255.255.255.255 192.168.1.2
! Verify — appears in routing table as /32
Router# show ip route 192.168.2.10
! S 192.168.2.10/32 [1/0] via 192.168.1.2
7. Floating Static Route (Backup Path)
A floating static route is a static route with an AD set higher than the primary dynamic routing protocol. While the primary route is active (lower AD wins), the floating static is hidden from the routing table. If the primary route disappears (e.g., OSPF neighbour fails), the floating static automatically “floats” into the table as the backup.
! Primary route learned via OSPF (AD 110) — active in routing table
! Floating static backup (AD 150 > OSPF’s 110) — dormant while OSPF is active
ip route 192.168.2.0 255.255.255.0 192.168.3.1 150
! If OSPF goes down, routing table shows:
! S 192.168.2.0/24 [150/0] via 192.168.3.1 ← floating static activates
Normal operation:
Routing table: O 192.168.2.0/24 [110/2] via 192.168.1.2 (OSPF wins; AD 110 < 150)
Floating static: hidden (AD 150)
OSPF neighbour fails:
Routing table: S 192.168.2.0/24 [150/0] via 192.168.3.1 (backup activates)
Set the floating static AD just above the primary protocol’s AD: for OSPF (110) use 120; for EIGRP (90) use 100. Never use AD 255 — that makes the route permanently unusable.
8. Two-Router Static Route Example
LAN A: 192.168.1.0/24 Link: 10.0.12.0/30 LAN B: 192.168.2.0/24
[R1] Gi0/1: 192.168.1.1 —— Gi0/0: 10.0.12.1 ———— Gi0/0: 10.0.12.2 Gi0/1: 192.168.2.1 [R2]
! ===== R1 =====
! R1 needs a route to reach LAN B (192.168.2.0/24) — next hop is R2’s Gi0/0 IP
ip route 192.168.2.0 255.255.255.0 GigabitEthernet0/0 10.0.12.2
! Default route toward Internet (if R1 is the edge router)
ip route 0.0.0.0 0.0.0.0 203.0.113.1
! ===== R2 =====
! R2 needs a route back to LAN A (192.168.1.0/24)
ip route 192.168.1.0 255.255.255.0 GigabitEthernet0/0 10.0.12.1
! OR — R2 can use a default route pointing back to R1 for all non-local traffic
ip route 0.0.0.0 0.0.0.0 10.0.12.1
! ===== Verification on R1 =====
R1# show ip route
! Gateway of last resort is 203.0.113.1 to network 0.0.0.0
!
! S* 0.0.0.0/0 [1/0] via 203.0.113.1
! C 10.0.12.0/30 is directly connected, GigabitEthernet0/0
! C 192.168.1.0/24 is directly connected, GigabitEthernet0/1
! S 192.168.2.0/24 [1/0] via 10.0.12.2, GigabitEthernet0/0
9. IPv6 Static Routes
IPv6 static routes follow the same principles as IPv4 but use the
ipv6 route command and IPv6 prefix notation:
! Syntax:
ipv6 route <destination-prefix/length> {<next-hop-IPv6> | <exit-interface> | <exit-interface next-hop-IPv6>} [AD]
! Route to a specific IPv6 network
ipv6 route 2001:db8:2::/64 2001:db8:1::2
! IPv6 default route (matches all IPv6 destinations)
ipv6 route ::/0 2001:db8:1::1
! Fully specified IPv6 static route (recommended on Ethernet)
ipv6 route 2001:db8:2::/64 GigabitEthernet0/0 2001:db8:1::2
! Verify IPv6 routing table
Router# show ipv6 route
Important: IPv6 unicast routing is disabled by default on Cisco IOS. Enable it first:
Router(config)# ipv6 unicast-routing
10. Redistributing Static Routes into Dynamic Protocols
In mixed environments where some routers use static routes and others use dynamic routing protocols, you can redistribute static routes into the dynamic protocol so other routers learn them automatically.
! Redistribute static routes into OSPF (includes the subnets keyword to carry prefix info)
router ospf 1
redistribute static subnets
! Redistribute static routes into EIGRP
router eigrp 100
redistribute static metric 10000 100 255 1 1500
! Redistribute static routes into RIP
router rip
redistribute static
Caution: Redistributing a default static route into OSPF
requires the default-information originate command, not
redistribute static.
11. Verification Commands
! View all routes; static routes are marked S (or S* for default)
Router# show ip route
! View only static routes
Router# show ip route static
! Check if a specific route exists
Router# show ip route 192.168.2.0
! Verify the interface used to reach the next-hop is up
Router# show ip interface brief
! Check the full static route commands in the running config
Router# show running-config | include ip route
! Test reachability through the static route
Router# ping 192.168.2.1
! Trace the path to confirm correct forwarding
Router# traceroute 192.168.2.1
12. Troubleshooting Static Route Issues
| Symptom | Probable Cause | Diagnostic Command | Resolution |
|---|---|---|---|
Route not in show ip route |
Exit interface is down; route was not saved; syntax error in command | show ip interface brief; show run | include ip route |
Bring interface up (no shutdown); re-enter the ip route command correctly |
Route shows as S but ping fails |
Wrong next-hop IP; route exists in one direction only (missing return route); ACL blocking traffic | ping <next-hop>; show ip route on remote router; show run | include access |
Correct next-hop; add return static route on far end; remove or adjust ACL |
| Route shows but traffic takes wrong path | Another more specific route is matching first (longest prefix match); static is overriding intended dynamic route | show ip route <destination>; traceroute <destination> |
Remove conflicting static route; adjust AD; verify prefix length is correct |
| ARP flooding on Ethernet link | Static route configured with exit interface only (not next-hop) on a broadcast segment | show ip arp; check show run | include ip route |
Change to fully specified (interface + next-hop) or next-hop-only route |
| Floating static does not activate on failure | Floating static AD is lower than or equal to the primary protocol; exit interface for floating static is down | show ip route after primary fails; check AD values |
Set floating static AD higher than primary protocol; ensure its exit interface is up |
| Static route disappears after reboot | Configuration was not saved to NVRAM | show startup-config | include ip route |
Run copy running-config startup-config after every change |
13. Best Practices
- Use fully specified routes (interface + next-hop) on Ethernet links to avoid recursive lookups and ARP flooding
- Always configure return routes — static routing requires both directions to be in place; a route to the destination without a return route creates a black hole
- Use floating static routes as backup for dynamic routing (set AD just above the primary protocol’s AD)
- Prefer a single default route (
0.0.0.0/0) over many individual static routes when connecting to the Internet from an edge router - Enable
ipv6 unicast-routingbefore configuring any IPv6 static routes - Document all static routes — include destination, purpose, date added, and who added them; static routes are invisible to dynamic protocols and can be forgotten
- Audit regularly — static routes do not self-remove when topology changes; orphaned routes can cause routing loops or black holes
- Always
copy running-config startup-configafter adding static routes so they survive a reboot
14. Summary Reference Table
| Feature | Detail |
|---|---|
| Default AD | 1 — second most trusted source after connected (AD 0) |
| Routing table code | S (static); S* (static default route) |
| Command syntax | ip route <network> <mask> {next-hop | interface | both} [AD] |
| Default route | ip route 0.0.0.0 0.0.0.0 <next-hop> |
| Host route | ip route <IP> 255.255.255.255 <next-hop> |
| Floating static (backup) | ip route <network> <mask> <backup-next-hop> <higher-AD> |
| IPv6 static route | ipv6 route <prefix/length> <next-hop-IPv6> (requires ipv6 unicast-routing) |
| Auto failover? | No (standard); Yes (floating static when primary route disappears) |
| Scalable? | No — each route must be manually maintained; not suitable for large networks |
| Redistribution | redistribute static subnets under router ospf; use default-information originate for default routes |
| Best used for | Default gateway, stub networks, backup paths, point-to-point links, security-strict environments |
15. Key Points & CCNA Exam Tips
- Static routes are manually configured with
ip route <network> <mask> {next-hop | interface | both} [AD] - Default AD = 1; lower than any dynamic protocol; a static route always beats OSPF (110) or RIP (120) for the same prefix unless AD is raised
- Three configuration methods: next-hop IP only (recursive, Ethernet), exit interface only (directly connected, serial P2P), fully specified (both — recommended on Ethernet)
- Using exit interface only on Ethernet causes ARP flooding — always use next-hop or fully specified on broadcast links
- Default route:
ip route 0.0.0.0 0.0.0.0 <gateway>— appears asS*in routing table; matched as gateway of last resort - Host route uses
255.255.255.255(/32) mask — matches exactly one IP address - Floating static: set AD above the primary protocol (e.g., AD 120 when OSPF = 110); route is invisible while primary is active, appears when primary fails
- A static route is removed from the routing table if its exit interface goes down (interface-based) but stays in the table if only the next-hop becomes unreachable (next-hop-only) — causing a black hole
- IPv6 static:
ipv6 route ::/0 <next-hop>for default; must enableipv6 unicast-routingfirst - Redistribute into OSPF:
redistribute static subnets; for the default route usedefault-information originateinstead - Static routes do not save automatically — always run
copy running-config startup-configafter adding them