Network unreachable in bhyve

Grzegorz Junka list1 at gjunka.com
Mon Sep 12 12:21:58 UTC 2016


I am following the official guide:

https://www.freebsd.org/doc/handbook/virtualization-host-bhyve.html

After installing Centos6 and starting the guest there is no network 
inside the VM:

[root at localhost ~]# ping 8.8.8.8
connect: Network is unreachable
[root at localhost ~]# ifconfig
lo        Link encap:Local Loopback
           inet addr:127.0.0.1  Mask:255.0.0.0
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING  MTU:65536  Metric:1
           RX packets:4 errors:0 dropped:0 overruns:0 frame:0
           TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:260 (260.0 b)  TX bytes:260 (260.0 b)

On the host:

root at ultrabook:~ # ifconfig
ath0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
         ether 74:2f:68:cb:d6:2a
         nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
         media: IEEE 802.11 Wireless Ethernet autoselect mode 11ng
         status: associated
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 0x2
         inet 127.0.0.1 netmask 0xff000000
         nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
         ether 02:6c:a7:69:c7:00
         nd6 options=9<PERFORMNUD,IFDISABLED>
         id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
         maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
         root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
         member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                 ifmaxaddr 0 port 4 priority 128 path cost 2000000
         member: wlan0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                 ifmaxaddr 0 port 5 priority 128 path cost 66666
tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
         options=80000<LINKSTATE>
         ether 00:bd:b1:16:00:00
         nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
         media: Ethernet autoselect
         status: active
         Opened by PID 1918
wlan0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
         ether 74:2f:68:cb:d6:2a
         inet 192.168.8.101 netmask 0xffffff00 broadcast 192.168.8.255
         nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
         media: IEEE 802.11 Wireless Ethernet MCS mode 11ng
         status: associated
         ssid HUAWEI-7DC4 channel 1 (2412 MHz 11g ht/20) bssid 94:fe:22:5c:7d:c4
         regdomain 96 indoor ecm authmode WPA2/802.11i privacy ON
         deftxkey UNDEF AES-CCM 2:128-bit txpower 20 bmiss 7 scanvalid 60
         protmode CTS ampdulimit 64k ampdudensity 8 shortgi wme burst
         roaming MANUAL

I am using the following commands to load the kernel:

   grub-bhyve -m device.map -r hd0,msdos1 -M 2048 centos
   ls (hd0,msdos1)/
   linux (hd0,msdos1)/vmlinuz-2.6.32-642.el6.x86_64 root=/dev/mapper/VolGroup-lv_root
   initrd (hd0,msdos1)/initramfs-2.6.32-642.el6.x86_64.img
   boot

and start the guest:

   bhyve -c 4 -m 2048M -A -H -P \
      -s 0:0,hostbridge \
      -s 1:0,lpc \
      -s 2:0,virtio-net,tap0 \
      -s 3:0,virtio-blk,/dev/zvol/tank4/centos6v \
      -l com1,stdio \
      centos

The following has been added to /etc/rc.conf:

cloned_interfaces="bridge0 tap0"
ifconfig_bridge0="addm wlan0 addm tap0"

/boot/loader.conf

vmm_load="YES"
nmdm_load="YES"
if_bridge_load="YES"
if_tap_load="YES"

What I am missing?

Grzegorz




More information about the freebsd-virtualization mailing list