Linux – Multiple network cards, controlling where the traffic goes

linuxnetworkingnicroutingUbuntu

This is an Ubuntu 12.04 server install. I have multiple network cards, eth0 and eth1 lets call them. eth0 is connected to the internet, and all of my traffic goes through it, until eth1 gets plugged in. Then the machine tries to send everything through eth1, which for various and sundry reasons does not go out to the Interent. The only traffic it doesn't send through eth1 is traffic on eth0's subnet. It also will not accept inbound connections on eth0 from outside of eth0's subnet. I'd like all outbound traffic to go out eth0, but I'd like incoming connections from to either card from any subnet to work.

Best Answer

The traffic will go according to the routing table.

If you don't want Internet bound traffic egressing a particular interface then you need to ensure there is no default route that uses that interface.

If both are valid paths but one is preferred then change the preference of one of them higher or lower.

What are you using to configure your network?

Related Topic