Routing Multiple Nic's within the same subnet

You may find that when working with multiple Ethernet cards within the same subnet that outgoing traffic may default to only one Nic. This is due to the routing table that Linux uses by default and while this works in most cases, you may want to customize your routing to ensure that traffic is routed through a specific card.


Fiber Card : ens8f0

Non Fiber Card : enp1s0f0

Default Route output:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default UG 0 0 0 ens8f0 * U 0 0 0 ens8f0 * U 0 0 0 enp1s0f0

To ensure that you control how the traffic is routed via the hardware then you will need to remove the default routes and add them explicitly for each card.

route delete default gw <IP><NIC>

route add -net <IP> netmask <IP> gw <NIC>

route delete default gw ens8f0

route delete default gw enp1s0f0

route add -net netmask gw ens8f0

route add -net netmask gw ens8f0


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Powered by Zendesk