Static vs Dynamic Routing: How Routers Choose Paths

CCNA 9 min readPublished 22 September 2026

Quick answer

Learn how static and dynamic routing work, when to use each method, and how Cisco routers select the best path. Includes IOS commands, lab examples and troubleshooting.

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-address

For example:

R1(config)# ip route 192.168.20.0 255.255.255.0 10.0.12.2

This 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/1

On 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.2

Common 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.1

The equivalent IPv6 command is:

R1(config)# ipv6 route ::/0 2001:db8:10::1

Default 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 0

The 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.

FeatureStatic routingDynamic routing
Route creationManually configuredLearned through a routing protocol
Topology changesUsually requires manual actionCan calculate another available path
Configuration at scaleDifficult to maintainBetter suited to many routers and networks
Protocol trafficNo routing updatesSends protocol messages or updates
Path controlDirect and predictableControlled through metrics, policies and protocol settings
Default administrative distance1 on Cisco IOSDepends on the protocol
Best useSmall, stable or stub networksRedundant and changing networks
Troubleshooting focusNext hop, interface and route syntaxNeighbours, 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.3

For 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 sourceDefault Cisco administrative distance
Connected0
Static1
eBGP20
Internal EIGRP90
OSPF110
RIP120
External EIGRP170
iBGP200

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/2

Both 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-B

The addressing plan is:

Device interfaceAddressPurpose
R1 G0/0192.168.10.1/24LAN A gateway
R1 G0/110.0.12.1/30Link to R2
R2 G0/110.0.12.2/30Link to R1
R2 G0/0192.168.20.1/24LAN 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.2

Configure R2:

R2(config)# ip route 192.168.10.0 255.255.255.0 10.0.12.1

Verify R1:

R1# show ip route static
S    192.168.20.0/24 [1/0] via 10.0.12.2

The 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.1

Configure 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/0

Configure 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/0

The 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/1

FULL 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 200

The 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.25

This 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 connected

An 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.1

A 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 route

Check 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 database

If 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.

Frequently asked questions

What is the main difference between static and dynamic routing?

Static routes are entered manually by an administrator. Dynamic routes are learned through routing protocols and can change when the network topology changes.

How does a router select the best route?

A router first uses the longest prefix match for the packet's destination. For routes to the same prefix, it considers administrative distance and then the routing protocol's metric.

Does a static route always take priority over OSPF?

A standard static route has a lower default administrative distance than OSPF, so it is normally preferred for the same prefix. However, a more specific OSPF route can still win through longest prefix matching, and a static route can be configured with a higher administrative distance.

What is a floating static route?

A floating static route is a backup route with an administrative distance higher than the primary route. It can enter the routing table when the preferred dynamic or static route is removed.

Which dynamic routing protocol should CCNA students learn?

OSPF is the main interior gateway protocol covered for practical route learning and path selection in CCNA studies. Students should understand neighbour formation, cost, route-table entries and basic single-area configuration.

Why is a route visible in OSPF but missing from the routing table?

Another route source may offer the same prefix with a lower administrative distance, or the router may already have a more specific route. Route filtering, invalid next-hop information or protocol configuration can also prevent installation.

Related articles

Train with Network Rhinos

Hands-on CCNA, CCNP, AWS, Azure, DevOps and cybersecurity training in Chennai & Bangalore, with placement support. Talk to our team or attend a free demo class.