bhyve I'm tryng to emulate Ubuntu Budgie with bhyve,but it doesn't connect to internet because the error : network unreachable.

ziomario

Well-Known Member

Reaction score: 29
Messages: 376

Hello to everyone. I'm a new freebsd user. I come from the linux world. I'm learning freebsd because I like its old fashion centralized / synthetic configuration style. At the moment I'm trying to virtualize Linux Ubuntu because I want to learn bhyve. I've been able to boot Ubuntu Budgie 21.04 using BHYVE_UEFI.fd,the problem that I have is that Ubuntu is not able to connect to internet. Below I will show you all the files that I have configured from A to Z.

On Freebsd :

Code:
root@lozioma:~ # uname -a
FreeBSD lozioma 13.0-RELEASE-p1 FreeBSD 13.0-RELEASE-p1 #0: Wed May 26 22:15:09 UTC 2021     root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64

# pkg install grub2-bhyve

# pkg info | grep grub2
grub2-bhyve-0.40_8             Grub-emu loader for bhyve

# mkdir vms
# cd vms
# mkdir iso
# mkdir ubuntu
# cd /home/zioma
# mv /root/ubuntu-budgie-21.04-desktop-amd64.iso /vms/iso/
# kldstat

Id Refs Address                Size Name
1   46 0xffffffff80200000  1f11ef8 kernel
2    1 0xffffffff82113000   5748f0 vmm.ko
3    1 0xffffffff82688000     4110 nmdm.ko
4    1 0xffffffff8268d000     fc48 if_bridge.ko
5    2 0xffffffff8269d000     8178 bridgestp.ko
6    1 0xffffffff82920000     3378 acpi_wmi.ko
7    1 0xffffffff82924000     3250 ichsmb.ko
8    1 0xffffffff82928000     2180 smbus.ko
9    1 0xffffffff8292b000     2340 uhid.ko
10    1 0xffffffff8292e000     4350 ums.ko
11    1 0xffffffff82933000     3380 usbhid.ko
12    1 0xffffffff82937000     31f8 hidbus.ko
13    1 0xffffffff8293b000     3320 wmt.ko
14    1 0xffffffff8293f000     2a08 mac_ntpd.ko

# kldload vmm
kldload: can't load vmm: module already loaded or in kernel

# kldload nmdm
kldload: can't load vmm: module already loaded or in kernel

# kldload if_bridge
kldload: can't load vmm: module already loaded or in kernel

# kldload if_tap
kldload: can't load vmm: module already loaded or in kernel

# sysctl net.link.tap.up_on_open=1
net.link.tap.up_on_open: 0 -> 1

# sysctl net.inet.ip.forwarding=1
net.inet.ip.forwarding: 0 -> 1

# echo "sysctl net.link.tap.up_on_open=1" >> /etc/sysctl.conf

# nano /boot/loader.conf

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

# echo 'vm1:dv=/dev/nmdm0B:br#9600:pa=none:' >> /etc/remote

# ifconfig tap1 create
# ifconfig bridge0 create
# ifconfig bridge0 addm tap1 addm em0 up

# ifconfig

em0: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=481049b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LRO,VLAN_HWFILTER,NOMAP>
    ether
    inet 192.168.1.6 netmask 0xffffff00 broadcast 192.168.1.255
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
    inet 127.0.0.1 netmask 0xff000000
    groups: lo
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

tap1: flags=8902<BROADCAST,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=80000<LINKSTATE>
    ether
    groups: tap
    media: Ethernet autoselect
    status: no carrier
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

bridge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether
    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 0 ifcost 0 port 0
    member: tap1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 3 priority 128 path cost 2000000
    groups: bridge
    nd6 options=9<PERFORMNUD,IFDISABLED>


/vms/ubuntu # truncate -s 50g vm1.img

/vms/ubuntu # nano device.map

(hd0) /vms/ubuntu/vm1.img
(cd0) /vms/iso/ubuntu-budgie-21.04-desktop-amd64.iso


# nano installer.sh

grub-bhyve -r cd0 -m /vms/ubuntu/device.map -M 1024 vm1

# nano os-uefi.sh

bhyve -c 4 -m 8G -w -H \
        -s 0,hostbridge \
        -s 3,ahci-cd,/vms/iso/ubuntu-budgie-21.04-desktop-amd64.iso \
        -s 4,ahci-hd,/vms/ubuntu/vm1.img \
        -s 5,virtio-net,tap1 \
        -s 29,fbuf,tcp=0.0.0.0:5900,w=1920,h=1080,wait \
        -s 30,xhci,tablet \
        -s 31,lpc -l com1,stdio \
        -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
        vm1

nano /etc/rc.conf

hostname="lozioma"
keymap="it.kbd"
ifconfig_em0="DHCP"
local_unbound_enable="YES"
sshd_enable="YES"
hald_enable="YES"
dbus_enable="YES"
moused_enable="YES"
ntpdate_enable="YES"
ntpd_enable="YES"
powerd_enable="YES"
libvirt_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
linux_enable="YES"
#kld_list="nvidia-modeset"
kld_list="i915kms"

nano /boot/loader.conf

vmm_load="YES"
nmdm_load="YES"
if_tap_load="YES"
if_bridge_load="YES"
#nvidia_load="YES"
#nvidia_name="nvidia"
#nvidia_modeset_load="YES"
#nvidia_modeset_name="nvidia-modeset"
#i915kms_load="YES"

# netstat -rn

Routing tables

Internet:
Destination        Gateway            Flags     Netif Expire
default            192.168.1.1        UGS         em0
127.0.0.1          link#2             UH          lo0
[URL='http://192.168.1.0/24']192.168.1.0/24[/URL]     link#1             U           em0
192.168.1.6        link#1             UHS         lo0

Internet6:
Destination                       Gateway                       Flags     Netif Expire
::/96                             ::1                           UGRS        lo0
::1                               link#2                        UHS         lo0
::ffff:[URL='http://0.0.0.0/96']0.0.0.0/96[/URL]                 ::1                           UGRS        lo0
fe80::/10                         ::1                           UGRS        lo0
fe80::%lo0/64                     link#2                        U           lo0
fe80::1%lo0                       link#2                        UHS         lo0
ff02::/16                         ::1

# ifconfig

em0: flags=8963<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=4810099<RXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,VLAN_HWFILTER,NOMAP>
    ether e0:d5:5e:e2:1f:22
    inet 192.168.1.6 netmask 0xffffff00 broadcast 192.168.1.255
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
    inet 127.0.0.1 netmask 0xff000000
    groups: lo
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

tap1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=80000<LINKSTATE>
    ether 58:9c:fc:10:ff:e9
    groups: tap
    media: Ethernet autoselect
    status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    Opened by PID 1733

bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 58:9c:fc:10:ff:b7
    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: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 1 priority 128 path cost 20000
member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 4 priority 128 path cost 2000000
    groups: bridge
nd6 options=9<PERFORMNUD,IFDISABLED>


I have the file /etc/resolv.conf like this and it works :

# Generated by resolvconf
search [URL='http://homenet.telecomitalia.it']homenet.telecomitalia.it[/URL]
nameserver 127.0.0.1


nameserver 192.168.1.1
options edns0 trust-ad


On Ubuntu Budgie guest :

on the attached picture you can see how I have configured the netplan file. It does not connect,telling : network unreachable...
 

Attachments

  • Schermata del 2021-06-16 20-49-20.png
    Schermata del 2021-06-16 20-49-20.png
    582.4 KB · Views: 25
Last edited:

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,963
Messages: 38,420

You're using tap1 here:
Code:
bhyve -c 4 -m 8G -w -H \
        -s 0,hostbridge \
        -s 3,ahci-cd,/vms/iso/ubuntu-budgie-21.04-desktop-amd64.iso \
        -s 4,ahci-hd,/vms/ubuntu/vm1.img \
        -s 5,virtio-net,tap1 \
        -s 29,fbuf,tcp=0.0.0.0:5900,w=1920,h=1080,wait \
        -s 30,xhci,tablet \
        -s 31,lpc -l com1,stdio \
        -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
        vm1
But only attached tap0 to the bridge(4) here:
Code:
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 58:9c:fc:10:ff:b7
    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: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 1 priority 128 path cost 20000
member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 4 priority 128 path cost 2000000
    groups: bridge
nd6 options=9<PERFORMNUD,IFDISABLED>
 
OP
ziomario

ziomario

Well-Known Member

Reaction score: 29
Messages: 376

You're using tap1 here:
Code:
bhyve -c 4 -m 8G -w -H \
        -s 0,hostbridge \
        -s 3,ahci-cd,/vms/iso/ubuntu-budgie-21.04-desktop-amd64.iso \
        -s 4,ahci-hd,/vms/ubuntu/vm1.img \
        -s 5,virtio-net,tap1 \
        -s 29,fbuf,tcp=0.0.0.0:5900,w=1920,h=1080,wait \
        -s 30,xhci,tablet \
        -s 31,lpc -l com1,stdio \
        -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
        vm1
But only attached tap0 to the bridge(4) here:
Code:
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 58:9c:fc:10:ff:b7
    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: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 1 priority 128 path cost 20000
member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 4 priority 128 path cost 2000000
    groups: bridge
nd6 options=9<PERFORMNUD,IFDISABLED>

thanks. it works now. it was a typo.
 
OP
ziomario

ziomario

Well-Known Member

Reaction score: 29
Messages: 376

Anyway,I would like to have some additional informations,like :

1) does kvm work on freebsd ?
2) currently is possible to make the passthrough of my rtx 2080 ti from freebsd host os to windows or linux guest os ?
 
OP
ziomario

ziomario

Well-Known Member

Reaction score: 29
Messages: 376

Note: VGA / GPU pass-through devices are not currently supported.
 
Top