In this lesson, you will learn how to leverage multiple Forwarding Information Bases (FIBs) to perform seamless, zero-downtime updates to your Linux routing tables.
The Problem with Atomic Routing Updates
In a high-availability production environment, updating a routing table often involves running ip route change or ip route replace. These commands are rarely instantaneous; they can introduce micro-interruptions or race conditions where packets are dropped while the kernel kernel re-calculates the FIB. When managing complex paths—like those we discussed in Managing Path Failover—you need a way to stage an entire new network topology before cutting over to it.
The Multi-FIB Approach
Linux supports up to 255 distinct routing tables (managed in /etc/iproute2/rt_tables). Instead of modifying your "live" table (usually main), you can treat routing tables as versioned snapshots.
By creating a secondary table, you can build your new routing configuration in the background without affecting active traffic. Once the configuration is verified, you shift the lookup priority using a policy rule.
Practical Implementation
To update your routing table version, follow this pattern:
-
Populate the new table:
# Create a new version (e.g., table 101) ip route add 192.168.1.0/24 via 10.0.0.1 table 101 -
Stage and Verify: Add all necessary routes to
table 101. Because it is independent, yourmaintable continues to handle production traffic perfectly. -
Atomic Switchover: Use the
ip rulecommand to point the traffic to the new table. Becauseip ruleoperates at the policy level, updating the lookup priority is near-instantaneous for the kernel.# Insert the new table into the policy lookup chain ip rule add priority 100 table 101 # Remove the old rule once traffic is confirmed ip rule del priority 200
By treating routing tables as immutable versions, you eliminate the risk of partial updates. If the new topology fails, you can simply remove the ip rule to instantly revert to your previous state.
Key Takeaway: By using distinct FIBs and updating the kernel’s lookup policy rather than individual routes, you can stage complex network changes and execute atomic, zero-downtime routing updates.