Linux – Failed to bring up eth1 in a dual ips solution in ubuntu

ethernetinterfacelinuxnetworkingUbuntu

I'm using ubuntu 12.04.

I tried to assign two ips to two ethernet cards in my server.

The content of /etc/network/interfaces is like this:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 114.80.156.a
netmask 255.255.255.224
gateway 114.80.156.b

auto eth1
iface eth1 inet static
address 114.80.156.c
netmask 255.255.255.240
gateway 114.80.156.d

a b c d have different values, which means the two ips are in different vlans.

But I can only bring up eth0 with this command:

$ /etc/init.d/networking restart
RTNETLINK answers: File exists
Failed to bring up eth1.
...done.

I have checked the question here which shows the same problem like the one I encountered: Can only bring up one of two interfaces

But it seems it's not really solved. And in my situation, I need the 2 ips to use 2 different gateways.

So how to fix this problem?


Edit1, changed the example config ip from 192.168.0.0/16 subnet to another 'real' subnet.


Edit2, the purpose of doing this is fairly simple. Because the ip range I previous in don't have more room for new servers, and I have to move to another ip range. So I want to make the public servers bind to 2 ips for the transition period.

I only have really limited knowledge about routing and subnet. @BillThor @rackandboneman, would you please give me some keywords or links on how to setup route for 2 ips?

and @Mike Pennington, how do you know I speak chinese?

Best Answer

"RTNETLINK answers: File exists" means it is trying to set up a static route that is in conflict with another.

If the original idea behind the question is QoSing traffic out two different interfaces on the same subnet: That really gets advanced quick. The next thing you will discover is how the default ARP behaviours on Linux will sabotage the project :)