Multiple NICs with static IP address, default gateway problems
Edit /etc/network/interface
and remove all but one of the gateway
statements.
Related videos on Youtube
hxuanhung
Updated on September 17, 2022Comments
-
hxuanhung almost 2 years
My server is running Ubuntu 10.04 64bit and have 2 NICs, my configuration is one interface for incoming/outgoing traffic of all the KVM guest running on this server, the other interface for different purpose.
I set both NIC card and the virtual bridge with static IP address; here is my
/etc/network/interface
# The primary network interface auto eth0 iface eth0 inet static address 192.168.5.10 netmask 255.255.255.0 network 192.168.5.0 broadcast 192.168.5.255 gateway 192.168.5.5 auto eth1 iface eth1 inet static address 192.168.5.12 netmask 255.255.255.0 network 192.168.3.0 broadcast 192.168.3.255 gateway 192.168.5.5 auto br0 iface br0 inet static address 192.168.5.11 netmask 255.255.255.0 network 192.168.5.0 broadcast 192.168.5.255 gateway 192.168.5.5 bridge_ports eth1 bridge_stp off bridge_fd 0 bridge_maxwait 0
and here is my
netstat -nr output
Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.5.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.5.0 0.0.0.0 255.255.255.0 U 0 0 0 br0 192.168.5.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0 0.0.0.0 192.168.5.5 0.0.0.0 UG 0 0 0 eth1 0.0.0.0 192.168.5.5 0.0.0.0 UG 0 0 0 br0 0.0.0.0 192.168.5.5 0.0.0.0 UG 0 0 0 eth0
I can not access the internet. I manually delete all the default gw using
route del
and add only 1 default gw for the device eth0 to access the internet192.168.5.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.5.0 0.0.0.0 255.255.255.0 U 0 0 0 br0 192.168.5.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0 0.0.0.0 192.168.5.5 0.0.0.0 UG 0 0 0 eth0
The problem is when I reboot the server I manually run the
route del
command again and if I delete the default gw of eth1 in/etc/network/interface
all the guest host can not access the internet.Please help me how to configure that way
-
Philip over 13 yearsWhoa that's one weird configuration... probably not what you were looking for.
-
-
Steven Monday over 13 years+1. Also, the config for
eth1
appears to be inconsistent. On second thought,eth1
should probably be left unconfigured, since it is slaved to bridgebr0
.