Floating Static Routes

Follow

Issue

A floating static route is a route with a higher administrative distance than the current route in a routing table.

Creating a static route in /etc/network/interfaces overwrites the same dynamically learned route from Quagga.

Environment

  • Cumulus Linux, all versions

Cause

Routes installed directly into the kernel, through ip route or persistently via  /etc/network/interfaces, have the lowest administrative distance. Below is table of administrative distances on Cumulus Linux:

Administrative Distances

Kernel (iproute2) 0
BGP 20
OSPF 110

Example: A route 10.3.3.3/32 learned via BGP is not installed. Instead, the kernel installed the route using /etc/network/interfaces, and ifup overrides the learned BGP route.

quagga# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, A - Babel,
       > - selected route, * - FIB route

K>* 0.0.0.0/0 via 10.0.1.2, eth0
C>* 10.0.1.0/24 is directly connected, eth0
C>* 10.1.1.0/24 is directly connected, swp3
K>* 10.3.3.3/32 via 10.1.1.2, swp3
B   10.3.3.3/32 [20/1] via 10.1.1.2, swp3, 00:06:00

$ sudo ip route show

default via 10.0.1.2 dev eth0 
10.0.1.0/24 dev eth0  proto kernel  scope link  src 10.0.1.208 
10.1.1.0/24 dev swp3  proto kernel  scope link  src 10.1.1.1 
10.2.2.0/24 dev swp4  proto kernel  scope link  src 10.2.2.2 
10.3.3.3 via 10.1.1.2 dev swp3  

etc/network/interfaces
----------------------

auto swp3
iface swp3 inet static
  address 10.1.1.1/24
  post-up ip route add 10.3.3.3/32 via 10.1.1.2

Resolution

Configure the floating static route through Quagga instead of through the ip route  command. The higher administrative distance set on the static route will be respected.

quagga#show run
...

ip route 10.3.3.3/32 10.1.1.5 200

...

quagga# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, A - Babel,
       > - selected route, * - FIB route

K>* 0.0.0.0/0 via 10.0.1.2, eth0
C>* 10.0.1.0/24 is directly connected, eth0
C>* 10.1.1.0/24 is directly connected, swp3
S   10.3.3.3/32 [200/0] via 10.1.1.5, swp3
B>* 10.3.3.3/32 [20/1] via 10.1.1.2, swp3, 00:00:51
Have more questions? Submit a request

Comments

Powered by Zendesk