I have set up various VMs with Ubuntu 16.04 guests and Windows 10 hosts in different physical locations, nevertheless with a stable internet connection. Expecting the hosts to provide an IP address through Virtualbox to all these Virtual OSs, configured with a NAT network adapter (default settings), have a purpose to connect to a server.
For some reason this works perfectly okay for some Virtual OSs and I hope to be guided through a debug to solve this situation.
ip a:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 08:00:27:a3:5b:03 brd ff:ff:ff:ff:ff:ff inet6 fe80::6467:c72f:f210:ad4e/64 scope link valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 08:00:27:93:64:d0 brd ff:ff:ff:ff:ff:ff/etc/network/interfaces:
*NOTE: the following configuration is the same for all the OSs, which makes me think 'network manager' has nothing to do with the IP assigning procedure since most guests get their IPs, not sure though.
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcpI am currently stuck rebooting the guests that fail to get their IPs at their first try to get around the connection problem.
5 Answers
I had the same problem with my Intel adapter, here's my quick workaround:
In the host environment (e.g Windows -> Device Manager) turn the Intel adapter off and then turn it on again. After 5...10 seconds check the guest again,
ifconfig -a...it should get the IP without restarting the host system.
I don't know if this is a Ubuntu 16.04 issue itself.
I have been using 16.04 OS (Host) on a MS Surface Go and sometimes when I power on the device the Ubuntu 16 OS does not get an IP (DHCP).
I have to physically disconnect and connect the USB-C to LAN Ethernet adapter and then it gets an IP. That point I thought it was a Surface Go issue or LAN adapter issue.
But when the same happened recently on a Ubuntu 16.04 Guest VM, it got me quite surprised.
0This happens rarely with the new Vbox updates; it works just fine if I downgrade it back to previous version.
The recent update did it again (v6.0.8) because of the Windows 10 updates this time (and always will).
this simple ifdown and up commands works instantly for me.
ifconfig enp0s3 down
sleep 7
ifconfig enp0s3 upsometimes, it takes more around 10 seconds until the host (Windows 10) detects the new IP from the NIC.
The best solution is to downgrade and wait until the newer version releases.
What worked for me is exactly what Seandex suggested, just using the ip command, as follows:
sudo ip link enp0s3 down
sudo ip link enp0s3 up
sudo ip link enp0s8 down
sudo ip link enp0s8 upI'm using ip now that ifconfig is absent by default and not installed anymore with the net-tools package.
In your /etc/network/interfaces you're saying to get an IP via DHCP for interface eth0 yet you don't have that interface. You have interface enp0s3 and enp0s8. So if you're using enp0s3 just change:
auto eth0
iface eth0 inet dhcpto:
auto enp0s3
iface enp0s3 inet dhcp 14