# VirtualBox: Host-Only routing failure for Linux guests



## Beeblebrox (Feb 5, 2015)

I have a strange situation and I can't figure out what the problem is.

I have VirtualBox networking as Host-Only, all guests get assigned the vboxnet0 virtual NIC. vboxnet0 IP is 192.168.56.1/28 which at the same time is VirtualBox DHCP. Naturally, there is no guest running on 192.168.56.1/28.

Host has routing defined and PF takinng care of NAT. My routing table entries:

```
Destination  Gateway  Flags  Netif Expire
default  192.168.1.1  UGS  re0
127.0.0.1  link#3  UH  lo0
192.168.1.0/24  link#1  U  re0
192.168.1.10  link#1  UHS  lo0
192.168.2.0/26  link#2  U  re1
192.168.2.1  link#2  UHS  lo0
192.168.56.0/28  link#6  U  vboxnet0
192.168.56.1  link#6  UHS  lo0
```

As VM guests, I have several Debian-based Linuxes, Winows-XP and FreeNAS. I get network problems only with the Debian-based Linuxes. The problems I describe below do not happen with FreeNAS nor Windows-XP:
Linux guests can ping or traceroute each other, but not vboxnet0 interface. This also prevents traffic from leaving the vboxnet0 subnet. Typical message is "no route to host"
Cannot ping Linux guests on the vboxnet0 subnet from host.
VM guest Debian_Jessie is unable to obtain IP via VirtualBox's DHCP. tcpdump just repeats below message. The MAC ending with 66:31 is the Debian VM, but I have no idea what f5:16 belongs to - it's not the vboxnet0 MAC either.


```
00:00:00.000173 08:00:27:77:66:31 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 342: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 08:00:27:77:66:31, length 300
00:00:00.000005 08:00:27:18:f5:16 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 590: 192.168.56.1.67 > 255.255.255.255.68: BOOTP/DHCP, Reply, length 548
```

Now I'll start my Windows-XP guest and usually the traffic flows normally from the vboxnet0 subnet to where ever the destination is. I can ping and receive traffic from my jails (on different virtual subnet) and internet. Sometimes this guest is also unable to ping vboxnet0, but it somehow corrects its self after I mess around with some pinging, tracert or god knows what.

After the Windows-XP guest gets traffic flow, the Debian-based Linuxes are now able to ping to outside of vboxnet0 subnet and respond to pings from host. After this, the Linux guests are able contact the outside domains (update the OS, etc.) It's almost like routing fails for the Linuxes untill some other OS creates the necessary routing rule for the subnets.

Document explaining network types in VirtualBox: http://www.virtualbox.org/manual/ch06.html. Basically, Host-Only is about creating a virtual switch and router, which allows host to communicate with the VM. No need for port forwarding, because host is actually directly "plugged" into that virtual switch with its own IP/subnet.

Regards.


----------



## Beeblebrox (Feb 16, 2015)

I had to delete my previous post, as it seems I spoke/wrote too soon.

vboxnet performance with linux is sporadic. Some times it works, some times it does not. I downloaded several non-Debian based Linux iso's to test the extent of the problem. Turns out, it's not just Debian. Many different Linux flavors display the same network throughput problem when placed on vboxnet. I therefore conclude that the problem is in the VBox code or the implementation of VBox under FreeBSD, since non-linux OS do not display such problems.

I plan on filing a PR if there are no objections within the next several days.


----------

