# VirtualBox bridged network with FreeBSD - no route to host



## Jakub Siroky (Nov 25, 2016)

Hi all,

I've been fighting with following setup with no success several days: 10.3-RELEASE-p12, virtualbox 5.1.6 from pkg, two nics and bridged nic on vbox and internal nic.

There is "no route to host" when pinging to vm, and there are no replies from inside of vm.
Arp shows the correct values. Nat mode of Virtualbox works, but I cannot connect to SIP provider via two NATS - first on VM and second on public nic.

Thank you, any help would be appreciated.

System specification:
`freebsd-version`

10.3-RELEASE-p12

`ifconfig`


```
xl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=82009<RXCSUM,VLAN_MTU,WOL_MAGIC,LINKSTATE>
        ether 00:04:75:f4:0f:bb
        inet {public ip} netmask 0xfffffff8 broadcast {public broadcast} 
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex,flowcontrol,rxpause,txpause>)
        status: active
re0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
        ether 00:1a:4d:82:c7:17
        inet 192.168.255.1 netmask 0xffffff00 broadcast 192.168.255.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (none)
        status: no carrier
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
vboxnet0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 0a:00:27:00:00:00
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
```

`vboxmanage pbx shovminfo` - actually it is Scientific Linux


```
Guest OS:        Red Hat (32-bit)
Hardw. virt.ext: on
Nested Paging:   on
Large Pages:     on
VT-x VPID:       on
VT-x unr. exec.: on
Paravirt. Provider: Legacy
Effective Paravirt. Provider: None
```


```
NIC 1:           MAC: 080027D8DD52, Attachment: Bridged Interface 're0', Cable connected: on, Trace: on (file: /tmp/trace.pcap), Type: 82540EM, Reported speed: 1000 Mbps, Boot priority: 0, Promisc Policy: allow-all, Bandwidth group: none
```

`arp -a`


```
? (192.168.255.52) at 08:00:27:d8:dd:52 on re0 expires in 1188 seconds [ethernet]
base (192.168.255.1) at 00:1a:4d:82:c7:17 on re0 permanent [ethernet]
? ({public ip}) at 00:04:75:f4:0f:bb on xl0 permanent [ethernet]
```

`netstat -rnf inet`


```
Routing tables

Internet:
Destination        Gateway            Flags      Netif Expire
default            {public gw}       UGS         xl0
{public net}/29    link#1             U           xl0
{public ip}       link#1             UHS         lo0
127.0.0.1          link#3             UH          lo0
192.168.255.0/24   link#2             U           re0
192.168.255.1      link#2             UHS         lo0
```

sample of capture file /tmp/trace.pcap:


```
09:41:55.879137 IP (tos 0x0, ttl 64, id 7594, offset 0, flags [DF], proto UDP (17), length 57)
    192.168.255.52.51132 > 192.168.255.1.53: [udp sum ok] 41229+ A? hlas.802.cz. (29)
09:42:00.879638 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.255.1 tell 192.168.255.52, length 46
09:42:00.879638 ARP, Ethernet (len 6), IPv4 (len 4), Reply 192.168.255.1 is-at 00:1a:4d:82:c7:17, length 28
09:42:00.889136 IP (tos 0x0, ttl 64, id 7595, offset 0, flags [DF], proto UDP (17), length 57)
    192.168.255.52.51132 > 192.168.255.1.53: [udp sum ok] 41229+ A? hlas.802.cz. (29)
```

sample of `tcpdump -vvvn -i re0`


```
11:29:58.345519 IP (tos 0x0, ttl 64, id 22128, offset 0, flags [DF], proto UDP (17), length 57)
    192.168.255.52.54721 > 192.168.255.1.53: [udp sum ok] 4352+ A? hlas.802.cz. (29)
11:30:03.345448 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.255.1 tell 192.168.255.52, length 46
11:30:03.355129 IP (tos 0x0, ttl 64, id 22129, offset 0, flags [DF], proto UDP (17), length 57)
    192.168.255.52.54721 > 192.168.255.1.53: [udp sum ok] 4352+ A? hlas.802.cz. (29)
```


`kldstat`


```
Id Refs Address            Size     Name
 1   24 0xffffffff80200000 17bc6a8  kernel
 2    1 0xffffffff819bd000 2fc440   zfs.ko
 3    2 0xffffffff81cba000 6040     opensolaris.ko
 4    1 0xffffffff81cc1000 23fb0    geom_mirror.ko
 5    1 0xffffffff81e11000 56c6     fdescfs.ko
 6    3 0xffffffff81e17000 4e436    vboxdrv.ko
 7    2 0xffffffff81e66000 2a02     vboxnetflt.ko
 8    2 0xffffffff81e69000 ba02     netgraph.ko
 9    1 0xffffffff81e75000 4123     ng_ether.ko
10    1 0xffffffff81e7a000 3f64     vboxnetadp.ko
```

`dmesg`


```
vboxdrv: fAsync=1 offMin=0x3d6a48 offMax=0x3d6a48
supdrvGipCreate: omni timer not supported, falling back to synchronous mode
vboxnet0: Ethernet address: 0a:00:27:00:00:00
vboxdrv: ffffffff81e7e020 VMMR0.r0
vboxdrv: ffffffff81f7b020 VBoxDDR0.r0
```


----------



## Jakub Siroky (Aug 23, 2017)

For anyone interested: when I recompiled virtualbox from source the bridge mode started to work, hurray!

`pkg info -x virtualbox`

```
virtualbox-ose-5.1.26
virtualbox-ose-kmod-5.1.26
```
`uname -a`

```
FreeBSD xxx.dynaptis.com 11.1-RELEASE-p1 FreeBSD 11.1-RELEASE-p1 #0: Wed Aug  9 11:55:48 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
```
`dmesg | grep vbox`

```
vboxdrv: fAsync=0 offMin=0x2b2 offMax=0x110d
vboxdrv: XXXXXXXXXXXXXXXX VMMR0.r0
vboxdrv: XXXXXXXXXXXXXXXX VBoxDDR0.r0
```


----------



## SirDice (Aug 24, 2017)

Ehm, apparently building VirtualBox from ports also upgraded your FreeBSD from 10.3 to 11.1.


----------



## vermaden (Aug 24, 2017)

SirDice said:


> Ehm, apparently building VirtualBox from ports also upgraded your FreeBSD from 10.3 to 11.1.


Comment of the Day :>


----------



## Jakub Siroky (Nov 16, 2017)

Again, after pkg upgrade it stopped working:
`uname -a`

```
FreeBSD xxx.dynaptis.com 11.1-RELEASE-p1 FreeBSD 11.1-RELEASE-p1 #0: Wed Aug  9 11:55:48 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
```
`pkg info -x virtual`

```
virtualbox-ose-5.1.28_2
virtualbox-ose-kmod-5.1.28
```


----------



## MacGyver (Nov 16, 2017)

There's a bug when using the pkg version of virtualbox-ose-kmod on an 11.1-RELEASE host.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221964
and previously https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221050 which is now closed as not a bug?


----------

