Route selection on Cumulus Linux is the same or similar as many other network OS vendors and distributions of linux.
Route Selection
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 |
Kernel Route | 0 |
Directly Attached Network | 0 |
Static Route | 1 |
External BGP | 20 |
OSPF | 110 |
Internal BGP | 200 |
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 20.13.1.3
RTNETLINK answers: File exists
root@sw:~#
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 3.3.3.3 3.3.3.3 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 5.5.5.6 0.0.0.0 UG 0 0 0 swp1 5.5.5.0 * 255.255.255.0 U 0 0 0 swp1 cumulus@switch:default:~:$ cumulus@switch:default:~:$ ip route show default via 5.5.5.6 dev swp1 proto zebra metric 20 5.5.5.0/24 dev swp1 proto kernel scope link src 5.5.5.5 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 5.5.5.6 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.
Comments