No history yet

Advanced Routing Design

Optimizing OSPF at Scale

In large networks, a standard OSPF configuration can lead to instability. Routers with limited CPU and memory may struggle with frequent Shortest Path First (SPF) calculations, causing slow convergence and network flaps. To build a resilient and fast-reacting network, we need to fine-tune OSPF's behavior.

Two key mechanisms for this are LSA throttling and SPF tuning. These timers control how often Link State Advertisements (LSAs) are generated and how frequently the SPF algorithm runs. By adjusting them, we can dampen the effect of an unstable link, preventing it from overwhelming every router in an area.

router ospf 1
 timers throttle lsa 5000 10000 15000
 timers throttle spf 5000 10000 15000

The command timers throttle spf sets three values: start, hold, and max-wait.

  • start: The initial delay in milliseconds before running an SPF calculation after a topology change. This gives the router a moment to see if more changes are coming.
  • hold: The minimum time to wait between two consecutive SPF calculations.
  • max-wait: The maximum time to wait between two SPF calculations.

The LSA throttling timers work similarly, controlling the rate of LSA generation. These adjustments ensure the network doesn't overreact to minor, transient issues, leading to a much more stable routing domain.

Tuning OSPF timers is a balancing act. Aggressive timers can provide sub-second convergence but risk CPU exhaustion during major network events. Conservative timers ensure stability but may slow down legitimate failover.

Another powerful tool for optimization is prefix suppression. In hub-and-spoke topologies, advertising every single transit link's prefix into the OSPF domain is often unnecessary. Suppressing these prefixes reduces the size of the Link State Database (LSDB) and simplifies the routing table.

By configuring ip ospf prefix-suppression on an interface, you prevent OSPF from advertising the IP prefix for that interface while still allowing the interface to participate in OSPF for neighbor discovery.

Scaling BGP Intelligently

While OSPF handles routing within an Autonomous System (AS), BGP manages routing between them. As an AS grows, the requirement for every internal BGP (iBGP) speaker to peer with every other iBGP speaker creates a full mesh of connections. This quickly becomes unmanageable.

The number of required sessions follows the formula n(n1)/2n(n-1)/2, where nn is the number of routers. An AS with 10 routers needs 45 iBGP sessions. An AS with 100 routers needs 4,950. This is where Route Reflectors and Confederations come in.

Route Reflector

noun

A BGP router that can reflect iBGP-learned routes to other iBGP peers. This eliminates the need for a full mesh of iBGP sessions within an Autonomous System.

A Route Reflector (RR) acts as a focal point. Routers within a cluster peer with the RR, which then reflects routes to them. This drastically reduces the configuration overhead. A client router only needs one peering session with its RR instead of with every other client.

Confederations are another solution. A confederation divides a large AS into smaller, private sub-ASes. Within each sub-AS, a full iBGP mesh or route reflectors can be used. eBGP is run between the sub-ASes. To the outside world, the entire collection of sub-ASes appears as a single, large AS. This approach provides better scalability and policy containment but adds complexity.

Advanced Route Manipulation

Beyond scalability, expert-level network design requires precise control over traffic paths. BGP's path selection algorithm is deterministic, but we can influence its decisions by manipulating attributes like Local Preference, AS-Path, and Multi-Exit Discriminator (MED).

Route maps are the primary tool for this. They function like conditional statements, allowing you to match routes using prefix lists or ACLs and then modify their attributes.

BGP allows network administrators to define and enforce routing policies based on various attributes, such as AS path, origin, and community tags.

For example, to ensure outbound traffic to a specific partner network always uses a primary link, you can create a route map that sets a higher Local Preference for routes learned from that link. Since Local Preference is the first attribute checked after Weight, it's a powerful way to influence outbound path selection within your AS.

! Define a prefix-list to match the partner network
ip prefix-list PARTNER_NET seq 5 permit 198.51.100.0/24

! Create a route-map to set local preference
route-map PREFER_PRIMARY permit 10
 match ip address prefix-list PARTNER_NET
 set local-preference 200
!
route-map PREFER_PRIMARY permit 20
 ! An empty permit statement matches everything else

! Apply the route-map to the BGP neighbor on the primary link
router bgp 65000
 neighbor 203.0.113.1 route-map PREFER_PRIMARY in

This configuration tells the router to set a Local Preference of 200 on routes matching the PARTNER_NET prefix list when they are received from neighbor 203.0.113.1. All other BGP routers in the AS will honor this higher preference (default is 100) and choose this path.

Conditional advertisement takes this a step further. Using advertise-map and non-exist-map, you can advertise certain prefixes to a neighbor only if another prefix exists (or doesn't exist) in the BGP table. This is critical for building resilient multi-homed networks where backup paths should only be advertised if the primary path is down.

Ready to test your knowledge of these advanced routing concepts?

Quiz Questions 1/6

What is the primary goal of implementing OSPF LSA throttling and SPF tuning in a large network?

Quiz Questions 2/6

When configuring OSPF SPF throttling with the timers throttle spf start hold max-wait command, what does the hold value define?

By mastering these techniques, you can design and manage large-scale networks that are not only functional but also stable, resilient, and highly optimized for performance.