On a server with multiple network cards I tried to configure the eth3
interface by editing /etc/network/interfaces
(this was an Ubuntu 12.04 machine).
This was the contents of /etc/networking/interfaces
:
# The loopback network interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address xxx.yyy.zzz.mmm netmask 255.255.255.0 gateway xxx.yyy.zzz.1 dns-nameservers xxx.yyy.zzz.aaa xxx.yyy.zzz.bbb dns-search mydomain.nl auto eth3 iface eth3 inet static address 192.168.4.1 netmask 255.255.255.0 gateway 192.168.4.1
When I tried to bring the interface up I got an error message:
$ ifup eth3 RTNETLINK answers: File exists Failed to bring up eth3.
It took me a while to figure it out, but the problem was the gw
line in the eth3
entry. Of course you can only have one default gateway in your setup. I missed this because I was also trying to add routes to networks behind the machine on the other end of eth3
.
In the end, removing the gw
line in the eth3
entry solved the problem.
My final /etc/networking/interfaces
looks like this:
# The loopback network interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address xxx.yyy.zzz.mmm netmask 255.255.255.0 gateway xxx.yyy.zzz.1 dns-nameservers xxx.yyy.zzz.aaa xxx.yyy.zzz.bbb dns-search mydomain.nl auto eth3 iface eth3 inet static address 192.168.4.1 netmask 255.255.255.0 post-up /sbin/route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.4.250 post-up /sbin/route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.4.250 post-up /sbin/route add -net 192.168.3.0 netmask 255.255.255.0 gw 192.168.4.250 post-down /sbin/route del -net 192.168.1.0 netmask 255.255.255.0 post-down /sbin/route del -net 192.168.2.0 netmask 255.255.255.0 post-down /sbin/route del -net 192.168.3.0 netmask 255.255.255.0
Update 2013-08-19: Removed network
entries as per Ville’s suggestion.