Sub topic 13
Choosing static, dynamic or a combination
This chapter assumes you know IPv4 addressing and CIDR prefixes, the difference between a router, a switch and a host, and basic command-line use on a router or Linux host. It also assumes you have read the earlier chapters on static routes, dynamic protocols, convergence and administrative distance.
The decision in one sentence
Static routing is the better fit when a network is small and rarely changes. Dynamic routing is the better fit when a network is large, changes often, or must recover from failures without a person stepping in. Most real networks use both.
Criteria that decide it
| Criterion | Favors static | Favors dynamic |
|---|---|---|
| Network size | A few routers or one remote site | Many routers and many prefixes |
| Rate of change | Links and prefixes stay the same for months | Sites, links or subnets change often |
| Failure handling | A person can fix an outage in time | The network must reroute by itself |
| Router load | Small devices with little CPU or memory | Devices that can run a protocol |
| Control and predictability | You want a fixed, known path | You accept the protocol's path choice |
| Security exposure | No protocol messages to attack or misconfigure | Neighbors must be authenticated |
Static routes cost no bandwidth and no CPU for route exchange. Their cost is human effort: every change must be made by hand on every affected router, and a typo or an outdated entry can black-hole traffic. A static route also does not notice that its next hop has died, unless you tie it to a tracking feature.
Dynamic routing reverses this. Adding a prefix often means advertising it once. Routers detect failures and converge on a new path. The costs are protocol traffic, CPU and memory use, more to configure securely, and the risk that a bad advertisement spreads quickly.
Common patterns
- Stub site with a default route. A branch office has one uplink. A single static default route (
0.0.0.0/0) is enough. A protocol would add nothing, because there is only one way out. - Dynamic core, static edges. Routers inside a campus or data center run OSPF. The edge toward the internet uses a static default route, which the border router can then advertise into OSPF.
- Dynamic primary with a static backup. The main path is learned by a protocol. A floating static route with a higher administrative distance takes over only when the learned route disappears.
- Static routes for special cases. A route to a specific management network or a null route to discard unwanted traffic is often easier to state by hand.
Worked example
A company has a head office and a branch. The head office runs OSPF with two WAN links to the branch. The branch has one LAN, 10.2.0.0/16.
- At the branch, a static default route points to the head office. One path out means no protocol is needed there.
- At the head office, OSPF carries the route to
10.2.0.0/16over the primary link, with administrative distance 110. - A backup static route uses the second link and administrative distance 200:
! Cisco IOS: backup used only if the OSPF route disappears
ip route 10.2.0.0 255.255.0.0 192.168.2.2 200Under normal conditions, the routing table holds the OSPF route. If that route is lost, the static route enters the table. Confirm which route is installed with show ip route 10.2.5.7.
Common mistakes
- Using static routes on a network that keeps growing. The number of entries grows with the square of the sites in a full mesh, and mistakes become likely.
- Forgetting a return route. Traffic arrives, but replies have no path back.
- Setting a floating route's distance at or below the primary's. It then replaces or competes with the primary route.
- Leaving a static route in place after the next hop is gone, which silently drops traffic.
Exercise
A branch office has one router with a single uplink to the head office. It also needs the head office to be reachable for all internet-bound traffic. Which routing approach fits, and why?
Show answer
A single static default route (0.0.0.0/0) toward the head office router. With only one path out, a dynamic protocol cannot choose between alternatives, so it would only add CPU load, protocol traffic and configuration.
Exercise
You run OSPF between two sites and want a second link to carry traffic only if the OSPF route to 10.2.0.0/16 is lost. What do you configure, and which value matters most?
Show answer
Configure a floating static route for 10.2.0.0/16 via the second link. Give it an administrative distance higher than OSPF's 110, such as 200, so it stays out of the routing table until the OSPF route disappears.