Lesson Overview and Learning Objectives

Static routing is the manual installation of routes in a router routing table. It is predictable, simple, and extremely important for small networks, default routes, backup paths, and special routing requirements. This lesson uses the same logic for both IPv4 and IPv6 so students can see exactly what is common and what changes between the protocols.

By the end of this lesson, you should be able to:

  • Explain how a router uses longest-prefix match, administrative distance, and metric when choosing routes.
  • Configure and verify IPv4 and IPv6 default static routes.
  • Configure and verify IPv4 and IPv6 network static routes.
  • Configure and verify IPv4 /32 and IPv6 /128 host routes.
  • Build floating static routes that operate as backup routes using a higher administrative distance.
  • Distinguish recursive, directly attached, and fully specified static routes.
  • Use Cisco IOS/IOS XE verification and troubleshooting commands to isolate static-routing failures.

CCNA focus - Do not memorize only the syntax. Be able to read a routing table and determine why a particular static route is installed, ignored, preferred, or used as a backup.

 

1. Static Routing Fundamentals

1.1 What is a Static Route?

A static route is a route that an administrator manually configures. Unlike a dynamic routing protocol, the router does not learn the destination from OSPF, EIGRP, RIP, or BGP. The route remains configured until it is removed, changed, or becomes unusable because its next hop cannot be resolved.

A static route tells the router three basic things:

Which destination prefix should match the packet.

Where the packet should be sent next - a next-hop address, an exit interface, or both.

Optionally, what administrative distance should be associated with the route.


1.2 Why Use Static Routing?

A static route is a route that is manually configured by a network administrator rather than learned automatically through a dynamic routing protocol such as OSPF, EIGRP, or BGP.

Static routing gives the administrator direct control over the path used to reach a destination network.

Use case

Why static routing fits

Small/stub networks

Few destinations and little topology change.

Default route

Send all unknown destinations toward an ISP or upstream router.

Backup path

Floating static route can take over if a preferred route disappears.

Management / host route

Force a very specific destination to use a controlled path.

Lab / troubleshooting

Predictable behavior makes path analysis easier.


1.3 Static Route Advantages and Limitations

Advantages

Limitations

Simple and deterministic

Does not automatically discover topology changes.

No routing-protocol CPU/bandwidth overhead

Configuration effort grows with network size.

Easy to control exact path

Human error can create black holes or loops.

Useful for backup routes

Return routes must also be considered.


2. How a Router Chooses a Route

2.1 Longest Prefix Match Comes First

When more than one routing-table entry matches a destination, the router chooses the route with the longest matching prefix. A /32 host route is more specific than a /24 network route, and a /24 network route is more specific than a /0 default route.

Candidate route

Specificity

Example result

0.0.0.0/0

Least specific

Used only when no more-specific IPv4 route matches.

192.168.30.0/24

Network route

Preferred for all addresses in 192.168.30.0/24 over the default.

192.168.30.50/32

Host route

Preferred only for 192.168.30.50.


2.2 Administrative Distance

Administrative distance (AD) ranks different sources of routing information for the same destination prefix. Lower is preferred. A normal Cisco static route has a default AD of 1. A floating static route deliberately uses a larger AD so another route is preferred while it exists.

Route source

Typical Cisco AD

Meaning

Connected

0

Directly attached network.

Static

1

Normal static route.

OSPF

110

Dynamic OSPF route.

Floating static

Configured value such as 200

Backup route; only preferred after lower-AD route disappears.

 

Important - Administrative distance is compared for routes to the same prefix. Longest-prefix match is the forwarding decision when matching prefixes have different lengths.


2.3 Metric

Dynamic routing protocols use metrics to choose between routes learned by the same routing protocol. Traditional static routes do not calculate a dynamic metric; the administrator specifies the path. For floating static design, the key value is usually administrative distance.


3. Dual-Stack Lab Addressing Plan

A dual-stack network runs IPv4 and IPv6 simultaneously on the same router interfaces. Each Layer 3 interface receives both an IPv4 address and an IPv6 global unicast address, allowing the same topology to route traffic for both protocol families independently.
Pasted content image

Figure 3 - Primary path R1-R2-R3 and direct R1-R3 backup path.


Device / link

IPv4

IPv6

R1 LAN-A

192.168.10.1/24

2001:db8:10::1/64

R1-R2 - R1

10.0.12.1/30

2001:db8:12::1/64

R1-R2 - R2

10.0.12.2/30

2001:db8:12::2/64

R2-R3 - R2

10.0.23.1/30

2001:db8:23::1/64

R2-R3 - R3

10.0.23.2/30

2001:db8:23::2/64

R1-R3 backup - R1

10.0.13.1/30

2001:db8:13::1/64

R1-R3 backup - R3

10.0.13.2/30

2001:db8:13::2/64

R3 LAN-C

192.168.30.1/24

2001:db8:30::1/64

R3 host/loopback

203.0.113.100/32

2001:db8:300::100/128

IPv6 prerequisite - On Cisco routers, enable IPv6 packet forwarding with the global command: ipv6 unicast-routing.

 

4. Static Route Syntax and Route Types

4.1 IPv4 Syntax

ip route <destination-network> <subnet-mask> <next-hop | exit-interface> [administrative-distance]


4.2 IPv6 Syntax

ipv6 route <ipv6-prefix/prefix-length> <next-hop | exit-interface> [administrative-distance]

IPv6 routes that use a link-local next-hop address normally require the outgoing interface as well because the same link-local address can exist on multiple interfaces.

ipv6 route 2001:db8:30::/64 GigabitEthernet0/0 fe80::3


4.3 Recursive Static Route

A recursive static route specifies only the next-hop IP address. The router performs another routing-table lookup to determine how to reach that next hop.

ip route 192.168.30.0 255.255.255.0 10.0.12.2


4.4 Directly Attached Static Route

A directly attached static route specifies the exit interface. It is most straightforward on point-to-point links.

ip route 192.168.30.0 255.255.255.0 GigabitEthernet0/0


4.5 Fully Specified Static Route

A fully specified static route includes both the exit interface and the next-hop address. This can make the intended neighbor unambiguous on multiaccess networks.

ip route 192.168.30.0 255.255.255.0 GigabitEthernet0/0 10.0.12.2

 

5. IPv4 Static Routing - Full Working Process

Assume PC-A on 192.168.10.0/24 sends a packet to 192.168.30.50. R1 must decide how to reach the remote LAN behind R3.

  • PC-A compares the destination with its local /24 and recognizes that 192.168.30.50 is remote.
  • PC-A sends the Ethernet frame to its default gateway, R1 at 192.168.10.1.
  • R1 removes the Layer 2 header and performs a routing-table lookup for 192.168.30.50.
  • R1 finds the static route for 192.168.30.0/24 pointing to next hop 10.0.12.2.
  • R1 resolves the next hop through its connected 10.0.12.0/30 network and forwards the packet to R2.
  • R2 uses its own route toward R3. R3 finally forwards the packet onto connected LAN-C.
  • The return direction requires valid routes back to 192.168.10.0/24; static routing is not automatically bidirectional.

R1(config)# ip route 192.168.30.0 255.255.255.0 10.0.12.2

R2(config)# ip route 192.168.30.0 255.255.255.0 10.0.23.2

R2(config)# ip route 192.168.10.0 255.255.255.0 10.0.12.1

R3(config)# ip route 192.168.10.0 255.255.255.0 10.0.23.1

 

6. IPv6 Static Routing - Full Working Process

IPv6 static routing follows the same high-level routing logic as IPv4: longest-prefix match, next-hop resolution, and forwarding. The syntax uses IPv6 prefixes and addresses rather than dotted-decimal masks.

  • Enable IPv6 routing globally with ipv6 unicast-routing.
  • Configure IPv6 addresses on all routed interfaces.
  • Create an IPv6 route to the destination prefix.
  • The router performs longest-prefix match against the IPv6 destination.
  • If the next hop is a global unicast address, the router resolves that next hop through a connected prefix.
  • If the next hop is link-local, include the exit interface so the router knows which local link to use.
  • Verify both forward and return routes with show ipv6 route and end-to-end ping.

R1(config)# ipv6 unicast-routing

R1(config)# ipv6 route 2001:db8:30::/64 2001:db8:12::2

 

R2(config)# ipv6 route 2001:db8:30::/64 2001:db8:23::2

R2(config)# ipv6 route 2001:db8:10::/64 2001:db8:12::1

 

R3(config)# ipv6 route 2001:db8:10::/64 2001:db8:23::1


7. Default Route

A default route is a catch-all route used when the routing table does not contain a more specific route for the destination IP address.
Pasted content image

Figure 7 - IPv4 and IPv6 default route toward an ISP.


7.1 IPv4 Default Route

The IPv4 default route is 0.0.0.0/0. Because it has a prefix length of zero, it matches every IPv4 destination, but any more-specific route wins by longest-prefix match.

R1(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.2

In the routing table, Cisco commonly marks the candidate default route with an asterisk and identifies the gateway of last resort.

R1# show ip route

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


7.2 IPv6 Default Route

An IPv6 default route is a catch-all route used when the router does not have a more-specific IPv6 route for the destination address.

R1(config)# ipv6 route ::/0 2001:db8:100::2

R1# show ipv6 route static

S ::/0 [1/0]

 via 2001:DB8:100::2


7.3 Typical Use Cases

Enterprise edge router pointing toward an ISP.

Stub branch pointing toward headquarters.

Small lab where one upstream router represents all external destinations.


8. Network Route

Pasted content image

Figure 8 - Static route toward an entire IPv4/IPv6 network.


A network static route represents a subnet or IPv6 prefix containing multiple possible hosts. The mask or prefix length is part of the route, so it directly affects longest-prefix match.

R1(config)# ip route 192.168.30.0 255.255.255.0 10.0.12.2

R1(config)# ipv6 route 2001:db8:30::/64 2001:db8:12::2

Both commands say the same thing conceptually: traffic for the specified remote network should be sent to R2 as the next hop.


8.1 Verification

R1# show ip route 192.168.30.0

Routing entry for 192.168.30.0/24

 Known via "static", distance 1

 * 10.0.12.2

 

R1# show ipv6 route 2001:db8:30::/64

 

9. Host Route

A host route is a route that identifies one specific IP address rather than an entire subnet. It is the most specific route that can appear in an IPv4 or IPv6 routing table.

Pasted content image

Figure 9 - /32 IPv4 and /128 IPv6 host routes.


A host route matches exactly one destination. IPv4 uses /32 (255.255.255.255); IPv6 uses /128. Host routes are commonly used for loopbacks, management addresses, monitoring targets, or policy-driven destinations.

R1(config)# ip route 203.0.113.100 255.255.255.255 10.0.12.2

R1(config)# ipv6 route 2001:db8:300::100/128 2001:db8:12::2


9.1 Why Host Routes Win

Suppose R1 also has a default route and a broader 203.0.113.0/24 route. A packet to 203.0.113.100 matches all three entries, but the /32 host route is the longest match and is therefore selected.

Matching route

Prefix length

Preference for 203.0.113.100

0.0.0.0/0

/0

Lowest specificity

203.0.113.0/24

/24

More specific

203.0.113.100/32

/32

Selected - longest match


10. Floating Static Route

Pasted content image

Figure 10 - Primary static path and higher-AD floating backup route.


A floating static route is a backup static route configured with an administrative distance higher than the preferred route. It "floats" outside the active routing table while a better route exists, then becomes active when the preferred route disappears.

! IPv4 primary and backup on R1

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 200

 

! IPv6 primary and backup on R1

ipv6 route 2001:db8:30::/64 2001:db8:12::2

ipv6 route 2001:db8:30::/64 2001:db8:13::2 200


10.1 Normal Operation

The AD 1 route through R2 is installed. The AD 200 route remains configured but is not selected because both routes describe the same prefix and the lower AD is preferred.


10.2 Failure Operation

If the primary route becomes unavailable because the next hop can no longer be resolved or a tracked path is removed, the AD 200 route can be installed and traffic uses the backup path. When the primary route returns, the lower-AD route becomes preferred again.

Design warning - A static route that points to a next hop can sometimes remain installed if the local next-hop resolution still exists even though a more distant failure has occurred. In production, IP SLA/object tracking or a dynamic routing protocol may be used when end-to-end failure detection is required.

13. Verification Commands and How to Read Them

Command

Purpose

show ip route

View complete IPv4 routing table.

show ip route static

Show IPv4 routes learned through static configuration.

show ip route <network>

Inspect route selection for a destination prefix.

show ipv6 route

View complete IPv6 routing table.

show ipv6 route static

Show IPv6 static routes.

show running-config | include ^ip route

Review configured IPv4 static-route commands.

show running-config | include ^ipv6 route

Review configured IPv6 static-route commands.

show ip interface brief

Check IPv4 interface state/addressing.

show ipv6 interface brief

Check IPv6 interfaces.

ping / ping ipv6

Test reachability.

traceroute / traceroute ipv6

Observe Layer 3 path.

R1# show ip route static

S 192.168.30.0/24 [1/0] via 10.0.12.2

S 203.0.113.100/32 [1/0] via 10.0.12.2

 

R1# show ipv6 route static

S 2001:DB8:30::/64 [1/0]

 via 2001:DB8:12::2

S 2001:DB8:300::100/128 [1/0]

 via 2001:DB8:12::2


13.1 Meaning of [1/0]

In typical Cisco route output, the first number is administrative distance and the second is metric. A normal static route commonly appears as [1/0].


14. Static Routing Troubleshooting Workflow

  • Check interface state firstnd show ipv6 interface brief. A route cannot work through a physically or logically down path.
  • Confirm directly connected networks exist in the routing table.
  • Check the exact static-route syntax and destination prefix/mask.
  • Confirm the next-hop address is correct and reachable through a connected or recursive route.
  • For IPv6 link-local next hops, verify that the outgoing interface is specified.
  • Check whether a more-specific route is sending the packet somewhere unexpected.
  • Check whether a lower-AD route is suppressing the floating static route.
  • Verify the reverse path. Successful forwarding requires a usable return route unless the test is intentionally one-way.
  • Use ping hop by hop, then traceroute to find where forwarding stops.
  • Check ACLs, firewalls, NAT, and endpoint default gateways after the routing table itself is confirmed.


14.1 Common Faults

Symptom

Likely cause

Action

Static route is configured but not in table

Next hop cannot be resolved or interface is down

Check connected route and interface state.

IPv4 works only one direction

Missing return route

Configure reverse static route.

IPv6 next-hop route fails

Link-local next hop lacks exit interface

Configure interface + link-local address.

Floating route never appears

Primary lower-AD route still active

Remove/fail primary route and verify AD.

Traffic takes wrong path

More-specific route exists

Use show route for exact destination and compare prefix lengths.


Key point: a floating static route does not automatically detect whether an entire remote path is healthy. It becomes active when the preferred route is no longer installed. For more advanced designs, route tracking/IP SLA can be used to tie static-route availability to actual reachability.

Quick knowledge check

1. What makes a static route "floating"?

Answer: It is configured with an AD higher than the preferred competing route, so it acts as a backup.

2. Which wins for destination 192.168.30.50: 0.0.0.0/0 or 192.168.30.0/24?

Answer: 192.168.30.0/24 because it is the longer prefix match.

3. A primary route has AD 1 and backup has AD 200. Which is installed normally?

Answer: The AD 1 route.

4. Why is a return route important?

Answer: The remote device/router must know how to send the reply back to the source network.