Routers need routes before they can forward packets between different IP networks. Those routes can be entered manually by an administrator, learned through a routing protocol, or created automatically for directly connected networks.
Understanding static vs dynamic routing is important for CCNA students because it connects routing-table concepts with practical configuration and troubleshooting. It also explains why a router may select one route while ignoring another.
What Is Static Routing?
Static routing means an administrator manually configures the destination network and the path used to reach it. The router does not exchange that route with neighbouring routers unless redistribution is configured separately.
A basic IPv4 static route on Cisco IOS uses this syntax:
Router(config)# ip route destination-network subnet-mask next-hop-addressFor example:
R1(config)# ip route 192.168.20.0 255.255.255.0 10.0.12.2This command tells R1 that packets for 192.168.20.0/24 should be sent to the next-hop router at 10.0.12.2.
A static route can also reference an exit interface:
R1(config)# ip route 192.168.20.0 255.255.255.0 GigabitEthernet0/1On Ethernet networks, a next-hop address or a fully specified route is usually clearer and can avoid unnecessary Address Resolution Protocol behaviour. A fully specified route includes both values:
R1(config)# ip route 192.168.20.0 255.255.255.0 GigabitEthernet0/1 10.0.12.2Common static route types include:
- Standard static routes to specific networks
- Default routes for unknown destinations
- Host routes to one IP address
- Summary routes covering several smaller networks
- Floating static routes used as backups
Configuring a default static route
A default route matches a packet when the routing table has no more specific entry. In IPv4, the default prefix is 0.0.0.0/0.
R1(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1The equivalent IPv6 command is:
R1(config)# ipv6 route ::/0 2001:db8:10::1Default static routes are often used on branch or edge routers that have one main path towards an upstream network.
What Is Dynamic Routing?
Dynamic routing uses routing protocols such as OSPF, EIGRP, RIP or BGP to exchange network reachability information. Routers process these updates, calculate preferred paths and install eligible routes in the routing table.
Dynamic routing does not mean that every packet triggers a route calculation. The protocol builds and maintains routing information, while the router forwards packets using routes already installed in its routing table and forwarding table.
For example, the following configuration enables single-area OSPF on two R1 interfaces:
R1(config)# router ospf 10
R1(config-router)# router-id 1.1.1.1
R1(config-router)# network 192.168.10.0 0.0.0.255 area 0
R1(config-router)# network 10.0.12.0 0.0.0.3 area 0The process ID 10 has local significance. It does not need to match the OSPF process ID on another router. However, connected interfaces must have compatible OSPF parameters, including the area, timers, authentication settings and subnet information, before they can form a neighbour relationship.
For a deeper study of OSPF operation, see OSPF areas, LSAs and neighbour states.
Static vs Dynamic Routing: What Is the Difference?
Static routing provides direct administrative control and has minimal protocol overhead, but it does not automatically learn a new path after a topology change. Dynamic routing requires protocol configuration and router resources, but it can adapt when links, neighbours or advertised networks change.
| Feature | Static routing | Dynamic routing |
|---|---|---|
| Route creation | Manually configured | Learned through a routing protocol |
| Topology changes | Usually requires manual action | Can calculate another available path |
| Configuration at scale | Difficult to maintain | Better suited to many routers and networks |
| Protocol traffic | No routing updates | Sends protocol messages or updates |
| Path control | Direct and predictable | Controlled through metrics, policies and protocol settings |
| Default administrative distance | 1 on Cisco IOS | Depends on the protocol |
| Best use | Small, stable or stub networks | Redundant and changing networks |
| Troubleshooting focus | Next hop, interface and route syntax | Neighbours, advertisements, metrics and protocol state |
Static routing is not automatically better because its default administrative distance is lower. A router first checks prefix length, then uses administrative distance and protocol-specific metrics where applicable.
Students can practise both approaches in the CCNA course, including route configuration, verification and failure testing on Cisco IOS labs.
How Does a Router Choose the Best Path?
A router primarily uses the longest prefix match when forwarding a packet. When multiple routing sources offer the same destination prefix, Cisco IOS considers administrative distance and then the routing protocol's metric to decide which route enters the routing table.
The selection process can be understood in four stages.
1. Match the most specific destination prefix
Consider these routes:
0.0.0.0/0 via 203.0.113.1
10.0.0.0/8 via 192.0.2.1
10.10.0.0/16 via 192.0.2.2
10.10.20.0/24 via 192.0.2.3For a packet addressed to 10.10.20.25, all four prefixes match. The router selects 10.10.20.0/24 because 24 matching network bits make it the most specific route.
This decision is made before comparing administrative distance. A /24 route with a higher administrative distance can still be used instead of a /16 route because they represent different prefix lengths.
2. Compare administrative distance for the same prefix
Administrative distance, or AD, expresses how trustworthy one route source is relative to another on the local router. A lower value is preferred when the sources advertise the same prefix and prefix length.
| Route source | Default Cisco administrative distance |
|---|---|
| Connected | 0 |
| Static | 1 |
| eBGP | 20 |
| Internal EIGRP | 90 |
| OSPF | 110 |
| RIP | 120 |
| External EIGRP | 170 |
| iBGP | 200 |
Suppose R1 has these candidates for 192.168.20.0/24:
- Static route with AD 1
- OSPF route with AD 110
The static route normally enters the routing table. The OSPF route remains known to the OSPF process but is not installed as the preferred route while the valid static route exists.
3. Compare the protocol metric
If the same routing protocol provides multiple paths to the same prefix, its metric determines the preferred path. Metrics are protocol-specific and should not normally be compared directly between different protocols.
Examples include:
- OSPF uses cost, which is based on interface bandwidth by default.
- EIGRP uses a composite metric based primarily on bandwidth and delay under default settings.
- RIP uses hop count.
- BGP uses a path-selection process involving multiple attributes.
If OSPF learns one path with cost 20 and another with cost 30, it prefers the path with cost 20.
4. Install equal-cost paths when supported
If a protocol finds multiple valid paths with the same metric, the router may install multiple next hops. This is called equal-cost multipath, or ECMP.
The routing table could show two OSPF next hops:
O 192.168.30.0/24 [110/20] via 10.0.12.2, 00:02:14, GigabitEthernet0/1
[110/20] via 10.0.13.2, 00:02:14, GigabitEthernet0/2Both routes have OSPF administrative distance 110 and cost 20. Cisco Express Forwarding can distribute traffic across the available next hops.
Practical Lab: Configure Static and OSPF Routes
This small lab demonstrates how the same two LANs can be connected with either static or dynamic routing.
Topology described in words
Imagine two routers connected by a point-to-point Ethernet link:
PC-A --- R1 --- R2 --- PC-BThe addressing plan is:
| Device interface | Address | Purpose |
|---|---|---|
| R1 G0/0 | 192.168.10.1/24 | LAN A gateway |
| R1 G0/1 | 10.0.12.1/30 | Link to R2 |
| R2 G0/1 | 10.0.12.2/30 | Link to R1 |
| R2 G0/0 | 192.168.20.1/24 | LAN B gateway |
PC-A uses 192.168.10.1 as its default gateway. PC-B uses 192.168.20.1.
Method 1: Static routes
Configure R1:
R1(config)# ip route 192.168.20.0 255.255.255.0 10.0.12.2Configure R2:
R2(config)# ip route 192.168.10.0 255.255.255.0 10.0.12.1Verify R1:
R1# show ip route static
S 192.168.20.0/24 [1/0] via 10.0.12.2The letter S identifies a static route. In [1/0], 1 is the administrative distance and 0 is the static route metric shown by IOS.
Method 2: OSPF routes
Remove the static routes first:
R1(config)# no ip route 192.168.20.0 255.255.255.0 10.0.12.2
R2(config)# no ip route 192.168.10.0 255.255.255.0 10.0.12.1Configure OSPF on R1:
R1(config)# router ospf 10
R1(config-router)# router-id 1.1.1.1
R1(config-router)# network 192.168.10.0 0.0.0.255 area 0
R1(config-router)# network 10.0.12.0 0.0.0.3 area 0
R1(config-router)# passive-interface GigabitEthernet0/0Configure OSPF on R2:
R2(config)# router ospf 10
R2(config-router)# router-id 2.2.2.2
R2(config-router)# network 192.168.20.0 0.0.0.255 area 0
R2(config-router)# network 10.0.12.0 0.0.0.3 area 0
R2(config-router)# passive-interface GigabitEthernet0/0The LAN interfaces remain advertised, but passive-interface prevents OSPF neighbour messages from being sent towards end devices.
Verify the neighbour and route:
R1# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/DR 00:00:34 10.0.12.2 GigabitEthernet0/1
R1# show ip route ospf
O 192.168.20.0/24 [110/2] via 10.0.12.2, 00:00:18, GigabitEthernet0/1FULL confirms that the routers formed an OSPF adjacency. The route code O means OSPF, while [110/2] shows administrative distance 110 and OSPF cost 2.
What Is a Floating Static Route?
A floating static route is a backup static route configured with an administrative distance higher than the primary dynamic route. It stays out of the routing table while the preferred route is available and can be installed if that route disappears.
If OSPF is the primary source with AD 110, configure a backup static route with AD 200:
R1(config)# ip route 192.168.20.0 255.255.255.0 10.0.13.2 200The final number is the configured administrative distance. This backup works only if the router can detect that the primary route is no longer valid and the static next hop remains reachable through the intended backup path.
Static routes do not test end-to-end application reachability by themselves. More advanced designs can use IP SLA and object tracking to remove a route when a monitored destination becomes unreachable.
When Should You Use Static or Dynamic Routing?
Use static routing when the topology is small, stable and has a clear forwarding path. Use dynamic routing when routers have redundant links, several destination networks or topology changes that should be handled automatically.
Static routes are practical for:
- A stub branch with one upstream router
- A default route towards an internet or WAN edge
- A controlled route to a management network
- Backup paths using floating static routes
- Small labs where manual path selection is the learning objective
Dynamic routing is practical for:
- Enterprise networks with several routers
- Networks with redundant WAN or campus links
- Environments where prefixes change regularly
- Designs that need automatic convergence after failures
- Networks where manual route maintenance would create operational risk
Many production networks use both. For example, internal routers may run OSPF while an edge router uses a static default route towards a service provider. Engineers moving into larger routing and policy topics can continue with a CCNP Enterprise course.
How Do You Troubleshoot Route Selection?
Start by confirming the destination prefix, the selected route and its next hop. Then check interface state, next-hop reachability, administrative distance, protocol neighbours and whether the destination network is actually being advertised.
Step 1: Inspect the exact destination lookup
R1# show ip route 192.168.20.25This is more useful than scanning the entire table because it shows the route IOS would use for that destination. Confirm the prefix length, next hop and exit interface.
Step 2: Check interfaces and connected networks
R1# show ip interface brief
R1# show ip route connectedAn interface should normally be up/up. If it is administratively down, enter interface configuration mode and use no shutdown. If the physical state or line protocol is down, investigate cabling, the remote interface, encapsulation or Layer 2 settings.
Step 3: Test the next hop and source address
R1# ping 10.0.12.2
R1# ping 192.168.20.1 source 192.168.10.1
R1# traceroute 192.168.20.1A successful next-hop ping confirms only local link reachability. A sourced ping tests whether the remote network has a return route to the selected source address.
Step 4: Verify static route syntax
R1# show running-config | include ^ip routeCheck for an incorrect mask, next-hop address or administrative distance. A route to 192.168.20.0/25 will not cover addresses in the upper half of a /24 subnet.
Step 5: Verify the dynamic routing protocol
For OSPF, useful commands include:
R1# show ip ospf neighbor
R1# show ip ospf interface brief
R1# show ip protocols
R1# show ip ospf databaseIf no neighbour appears, compare area IDs, subnet masks, timers, authentication and passive-interface settings. If the neighbour is full but the route is missing, confirm that the remote LAN is included in OSPF and that no filtering or more preferred route is affecting installation.
For a broader diagnostic workflow, use this layer-by-layer network troubleshooting method.
Common Routing Mistakes
Several routing problems come from configuration details rather than the routing method itself:
- Configuring only a forward route and forgetting the return route
- Using the wrong subnet mask in a static route
- Assuming a default route overrides a more specific route
- Comparing metrics from unrelated routing protocols
- Setting a floating static route with an AD lower than the primary route
- Advertising the transit link but not the destination LAN
- Making the OSPF transit interface passive
- Testing from a router without selecting a meaningful source address
- Forgetting that access control lists or firewalls can block traffic even when routing is correct
Summary
Static routes are manually controlled and work well in stable, simple topologies. Dynamic routing protocols exchange reachability information and can adapt to network changes, making them more suitable for redundant or larger designs.
Routers forward packets using the longest prefix match. For competing routes to the same prefix, they consider administrative distance, protocol metrics and equal-cost paths. Verification should always include the routing table, next-hop reachability, return path and relevant protocol state.
*Reviewed by Network Rhinos networking trainers.*
To practise static routes, default routes, OSPF and route-selection troubleshooting in guided labs, enquire about CCNA course batch details.
