Routing Preferences


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:

  1. 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.
  2. 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).
  3. 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 via
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 via dev eth0  src

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         UG        0 0          0 eth0        *        U         0 0          0 eth0
cumulus@switch:mgmt:~:$ sudo default-ns-set
cumulus@switch:default:~:$ netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

default         UG        0 0          0 swp1         *        U         0 0          0 swp1
cumulus@switch:default:~:$ ip route show
default via dev swp1  proto zebra  metric 20 dev swp1  proto kernel  scope link  src

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 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.

See Also

Have more questions? Submit a request


Powered by Zendesk