Portal Home > Knowledgebase > Articles Database > Dual NICs + Dual Default Gateways on Ubuntu vs CentOS


Dual NICs + Dual Default Gateways on Ubuntu vs CentOS




Posted by John[H4Y], 11-04-2010, 09:25 PM
Ok, so I've got dual NICs on a machine and have each plugged into a seperate uplink. Each uplink has a subnet of public IPs to choose from. In CentOS, it works great to have TWO public IPs (one for eth0 and one for eth1) and TWO default gateways. If I access the eth0 IP, traffic goes through eth0. If I access the eth1 IP, traffic routes through eth1. In Ubuntu, when I add the default gateway for the 2nd NIC (eth1), eth0 and its binded IP become inaccessible from the internet. Let's assume eth0 is 1.1.1.4 with gateway 1.1.1.1 and eth1 is 2.2.2.4 with gateway 2.2.2.1: CentOS: /sbin/ifconfig eth0 inet 1.1.1.4 netmask 255.255.255.0 up route add default gw 1.1.1.1 eth0 #eth0 now becomes active and I can ping 1.1.1.4 /sbin/ifconfig eth0 inet 2.2.2.4 netmask 255.255.255.0 up route add default gw 2.2.2.2 eth1 That's it - I can access 1.1.1.4 and 2.2.2.4 through the two seperate uplinks. Ubuntu: sudo /sbin/ifconfig eth0 inet 1.1.1.4 netmask 255.255.255.0 up sudo route add default gw 1.1.1.1 eth0 #eth0 now becomes active and I can ping 1.1.1.4 sudo /sbin/ifconfig eth0 inet 2.2.2.4 netmask 255.255.255.0 up sudo route add default gw 2.2.2.2 eth1 #eth1 now becomes active and I can ping 2.2.2.4 but eth0 goes down and is inaccessible. 1.1.1.4 stops pinging. What is the difference and how can I fix this?

Posted by eth00, 11-05-2010, 09:13 AM
Does ifconfig still show eth0 or is it completely down? What does "route -n" look like? That would be the easiest way to see what it is doing and what it does not like, assuming its not just that the interface itself went offline.

Posted by John[H4Y], 11-05-2010, 10:51 AM
Hoping to find someone with specific experience to this. I am fully capable of diagnosing it and route -n and eth0 show completely normally. The eth0 route just stops working when the eth1 route is added. If I remove the eth1 route: route del 2.2.2.1 then eth0 begins responding again with no problems..

Posted by krizag, 11-06-2010, 05:46 PM
this seems to be an issue with the setup in route. wats the output of route -n and can you ping the other eth2 internally using ping -I eth2

Posted by John[H4Y], 11-07-2010, 02:36 PM
Pinging everything internally was fine. route -n showed exactly the same as it did in CentOS, but it simply doesn't work the same in Ubuntu. We tried on multiple machines even. Eventually, we had to change the whole network topology to get it to work with Ubuntu. Not a horrible result though since we were able to keep the client online throughout.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Nameserver (Views: 699)

Language: