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:
root@sw:~# ip route add 0.0.0.0/0 via 220.127.116.11
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.
cumulus@switch:~$ ip route get 18.104.22.168 22.214.171.124 via 192.168.100.1 dev eth0 src 192.168.100.14 cache cumulus@switch:~$
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.
cumulus@switch: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 cumulus@switch:mgmt:~:$ sudo default-ns-set cumulus@switch:default:~:$ cumulus@switch:default:~:$ netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface default 126.96.36.199 0.0.0.0 UG 0 0 0 swp1 188.8.131.52 * 255.255.255.0 U 0 0 0 swp1 cumulus@switch:default:~:$ cumulus@switch:default:~:$ ip route show default via 184.108.40.206 dev swp1 proto zebra metric 20 220.127.116.11/24 dev swp1 proto kernel scope link src 18.104.22.168 cumulus@switch: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 22.214.171.124 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.