I would like my Ubuntu VM to have both a private IP and a public IP. The private IP should be supplied by my DHCP server.
Currently I am trying this:
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static
address 109.68.162.166
netmask 255.255.255.240
network 109.68.162.160
broadcast 109.68.162.175
gateway 109.68.162.174
The problem is that I can only ping the private IP address, not the public one. When I bring eth0 down I can start pinging the public IP address. So it seems that somehow DHCP is preventing my public IP address from working correctly?
ip route shows:
default via 192.168.168.254 dev eth0
default via 109.68.162.174 dev eth1 metric 100
109.68.162.160/28 dev eth1 proto kernel scope link src 109.68.162.166
192.168.160.0/20 dev eth0 proto kernel scope link src 192.168.164.96
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.168.254 0.0.0.0 UG 0 0 0 eth0
0.0.0.0 109.68.162.174 0.0.0.0 UG 100 0 0 eth1
109.68.162.160 0.0.0.0 255.255.255.240 U 0 0 0 eth1
192.168.160.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0
the routes on my vmhost:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.168.254 0.0.0.0 UG 0 0 0 br925
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
192.168.160.0 0.0.0.0 255.255.240.0 U 0 0 0 br925