I have two virtual interfaces, one configured as NAT and another as host only adapter. The NAT interface is intended to provide Internet access from inside the virtual box (to pull Docker images, etc) while the host only adapter is for communication between host and quest.
My /etc/network/interfaces is
auto enp0s8
iface enp0s8 inet static
address 193.168.56.101
netmask 255.255.255.255
broadcast 193.168.56.255
gateway 193.168.56.1
auto enp0s3
iface enp0s3 inet dhcp
I am using Oracle VM VirtualBox Manager 5.2.18_Ubuntu. The guest is Ubuntu Server 5.0.0-13-generic, the host is Ubuntu Mate 4.18.0-18-generic.
The NAT interface (enp0s3) works correctly as long as the host only interface (enp0s8) is down. As soon as I put the second interface up (with ifup
), the Internet stops being accessible. It is nicely accessible again as soon as I put the second interface down but I need both working at the same time.
With both interfaces up, ifconfig on the virtual machine gives
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 193.168.56.101 netmask 255.255.255.255 broadcast 193.168.56.255
How can the machine confuse 10.0.2.15 with 193.168.53.101?
Ifconfig on host gives
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.43 netmask 255.255.255.0 broadcast 192.168.1.255
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
vboxnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 193.168.56.1 netmask 255.255.255.0 broadcast 193.168.56.255
Most I was able to do is to add the routing rule to enp0s3 so that the guest can be accessed from host at localhost rerouted port. I however would still like to understand what is going wrong and how to get both interfaces working.
gateway
andbroadcast
fields.