Route selection on Cumulus Linux is the same or similar as many other network OS vendors and distributions of linux.
In case of overlapping or equal cost routes, the three following rules are followed within Cumulus Linux to decide which route gets installed:
- Prefix-Length: The longest prefix match is always the most preferred regardless of what routing protocol it is learned from. This is also referred to as the most specific route or route specificity.
- Metric: The lower metric or cost is preferred within only the same routing protocol. That is, even if a route in OSPF with a better metric appears eBGP will always beat it unless OSPF gets a more specific route (see rule 1).
- Administrative distance: Where a lower distance is preferred (only valid between different routing protocols).
See Wikipedia for more information.
|Routing Protocol||Administrative Distance|
|Directly Attached Network||0|
Frequently Asked Questions
What if I try to add two kernel routes with the same prefix-length?
It won't let it be added and gives back the following error:
[email protected]:~# ip route add 0.0.0.0/0 via 22.214.171.124
RTNETLINK answers: File exists
What admin distance is DHCP given?
A DHCP on Cumulus Linux is considered a kernel route and installed with an admin distance of 0.
How do I see where a route will go? (i.e. show ip route on Cumulus Linux)
Run the Linux command
ip route get x.x.x.x to figure out where a route will go based on your route table.
[email protected]:~$ ip route get 126.96.36.199 188.8.131.52 via 192.168.100.1 dev eth0 src 192.168.100.14 cache [email protected]:~$
What if I want to utilize a DHCP default route for management and a default route with BGP or my IGP?
Utilize namespaces by following this KB article.
[email protected]:mgmt:~:$ netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface default 10.0.1.1 0.0.0.0 UG 0 0 0 eth0 10.0.1.0 * 255.255.255.0 U 0 0 0 eth0 [email protected]:mgmt:~:$ sudo default-ns-set [email protected]:default:~:$ [email protected]:default:~:$ netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface default 184.108.40.206 0.0.0.0 UG 0 0 0 swp1 220.127.116.11 * 255.255.255.0 U 0 0 0 swp1 [email protected]:default:~:$ [email protected]:default:~:$ ip route show default via 18.104.22.168 dev swp1 proto zebra metric 20 22.214.171.124/24 dev swp1 proto kernel scope link src 126.96.36.199 [email protected]:default:~:$
As you can see above the management namespace (eth0) is getting a default via DHCP and the default namespace (front panel ports) is getting a default of 188.8.131.52 which is via BGP in this particular case.
I don't want my static route to have an admin distance of 0, its messing the configuration desired.
Utilize a floating static route in Quagga by following this KB article.