I know the subject sounds very odd but it is what happens.
The host is Ubuntu 16.04.1 LTS (Xenial) running VirtualBox 5.0.24. All of my VM's were imported from VirtualBox 4.x installation. Most importantly I did not have this problem using VirtualBox 4.x. It only became a problem after upgrade to 5.x.
So, networking is configured properly on this guest VM (Xenial LTS). Again, it used to work just fine in VirtualBox 4.x and it does so when I start the VM in GUI mode using VirtualBox 5.0.24. Every time. However, it fails to configure networking (just the host-only adapter) if VM is started in headless mode.
When the guest VM finishes the boot process, I cannot ping its Host-Only interface from the host machine:
Code: Select all
iliv@sega ~ $ ping xenial
PING xenial.localdomain (10.0.3.4) 56(84) bytes of data.
From 10.0.3.1 icmp_seq=1 Destination Host Unreachable
From 10.0.3.1 icmp_seq=2 Destination Host Unreachable
From 10.0.3.1 icmp_seq=3 Destination Host Unreachable
^C
--- xenial.localdomain ping statistics ---
6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5031ms
pipe 3
I can log in an see that networking is configured properly:

but it never works until I restart networking:

At which point I can also ping this guest VM from the host:
Code: Select all
iliv@sega ~ $ ping xenial
PING xenial.localdomain (10.0.3.4) 56(84) bytes of data.
64 bytes from xenial.localdomain (10.0.3.4): icmp_seq=1 ttl=64 time=4.43 ms
64 bytes from xenial.localdomain (10.0.3.4): icmp_seq=2 ttl=64 time=13.7 ms
^C
--- xenial.localdomain ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1004ms
rtt min/avg/max/mdev = 4.438/9.086/13.735/4.649 msInterestingly, I have a similar Ubuntu Trusty LTS guest VM that doesn't have this problem. In fact, Xenial is a clone (reconfigured properly) of that Trusty VM, but again, as I have just said above, this particular Xenial guest VM didn't have this problem either until I upgraded VirtualBox from 4.x to 5.x.
I tried to run tcpdump on both the host and the vm but it's like the VM is down:
10.0.3.4 is the Xenial guest VM.
10.0.3.1 is vboxnet0 interface on the host.
Code: Select all
03:35:46.091354 ARP, Request who-has 10.0.3.4 tell 10.0.3.1, length 28
........
.'...
.........
...
03:35:47.090927 ARP, Request who-has 10.0.3.4 tell 10.0.3.1, length 28
........
.'...
.........
...
03:35:48.091036 ARP, Request who-has 10.0.3.4 tell 10.0.3.1, length 28
........
.'...
.........
…This is a host's Host-Only adapter (the only VirtualBox adapter in this system):
Code: Select all
4: vboxnet0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
inet 10.0.3.1/24 brd 10.0.3.255 scope global vboxnet0
valid_lft forever preferred_lft forever
inet6 fe80::800:27ff:fe00:0/64 scope link
valid_lft forever preferred_lft forever
Thanks,
Ivan