Solved Ubuntu Budgie emulated with bhyve doesn't connect to internet because the error : network unreachable N. 2

Hello.

I'm trying to virtualize Linux Ubuntu with bhyve. I've reinstalled Ubuntu Budgie 21.04 using BHYVE_UEFI.fd,the problem that I have is that Ubuntu is not able to connect to internet. This is the script that I'm using :
Code:
bhyvectl --vm=vm0 --force-reset
bhyvectl --vm=vm1 --force-reset
setxkbmap it
ifconfig tap0 create
ifconfig vm-public addm tap0

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

vncviewer 0.0.0.0:5900

This is the situation BEFORE the configuration of the network :

Code:
em0: flags=8963<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=481009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,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>

vm-public: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether ae:25:8d:ae:ce:79
        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
        groups: bridge vm-switch viid-4c918@
        nd6 options=9<PERFORMNUD,IFDISABLED>

and AFTER :

Code:
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
        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>

vm-public: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether ae:25:8d:ae:ce:79
        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: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 1 priority 128 path cost 20000
        groups: bridge vm-switch viid-4c918@
        nd6 options=9<PERFORMNUD,IFDISABLED>

tap0: flags=8902<BROADCAST,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        ether 58:9c:fc:10:ff:8e
        groups: tap
        media: Ethernet autoselect
        status: no carrier
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>


Inside the Ubuntu guest I have the situation illustrated by the attached images.
 

Attachments

  • Screenshot_2021-07-15_17-23-01.png
    Screenshot_2021-07-15_17-23-01.png
    687.3 KB · Views: 189
  • Screenshot_2021-07-15_17-24-39.png
    Screenshot_2021-07-15_17-24-39.png
    557.5 KB · Views: 184
  • Screenshot_2021-07-15_17-22-13.png
    Screenshot_2021-07-15_17-22-13.png
    652.4 KB · Views: 172
Your tap0 interface doesn't seem connected. Is net.link.tap.up_on_open set 1?
 
how should be the content of the file /etc/sysctl.conf ? is this good ?

net.link.tap.up_on_open=1
net.inet.ip.forwarding=1
 
Don't set net.inet.ip.forwarding. Do this by adding gateway_enable="YES" to rc.conf.

And I would recommend using sysutils/vm-bhyve to easily set up VMs, networks, etc. It does a lot of work automatically and is much easier to use.

Code:
root@hosaka:~ # vm list
NAME            DATASTORE  LOADER     CPU  MEMORY  VNC           AUTOSTART  STATE
case            default    bhyveload  4    4096M   -             Yes [4]    Running (2948)
jenkins         default    bhyveload  4    4096M   -             Yes [6]    Running (3464)
kdc             default    none       2    2048M   0.0.0.0:5901  Yes [2]    Running (2182)
lady3jane       default    bhyveload  4    8192M   -             Yes [3]    Running (2499)
debian          stor10k    uefi       2    4096M   -             No         Stopped
errol           stor10k    bhyveload  2    4096M   -             Yes [9]    Running (39586)
fbsd-test       stor10k    bhyveload  2    4096M   -             Yes [14]   Running (5296)
gitlab          stor10k    bhyveload  4    6144M   -             Yes [12]   Running (5318)
gitlab-runner   stor10k    bhyveload  4    4096M   -             Yes [13]   Running (5272)
kibana          stor10k    bhyveload  4    6144M   -             Yes [1]    Running (1981)
plex            stor10k    bhyveload  4    4096M   -             Yes [7]    Running (3974)
riviera         stor10k    bhyveload  2    4096M   -             Yes [11]   Running (4760)
sdgame01        stor10k    bhyveload  4    4096M   -             No         Stopped
tessierashpool  stor10k    bhyveload  2    4096M   -             Yes [5]    Running (3442)
wintermute      stor10k    bhyveload  4    4096M   -             Yes [10]   Running (4680)
Code:
root@hosaka:~ # vm switch list
NAME     TYPE      IFACE       ADDRESS  PRIVATE  MTU   VLAN  PORTS
servers  standard  vm-servers  -        no       9000  11    lagg0
public   standard  vm-public   -        no       9000  10    lagg0
 
Until I found a solution for the bad mouse behavior that I've found when I have configured a vm with vm-bhyve,I can't use it. The problem is that the mouse does not move anymore when It is on the borders of the VM window. I should move the window of the VM window up or down to grab it. And I can't even enlarge the window because the enlarge icon is not clickable. This situation is very very annoying and is not present when I use bhyve normally.
 
that's not true. I see that behavior when I configure a vm using vm-bhyve,but not when I use bhyve without that wrapper. Anyway,it's more complicated than a wrapper.
 
Anyway,it's more complicated than a wrapper.
It's not. Really. Just look at the logs and you'll see it just executes bhyve(8) with a bunch of arguments. Just like you're doing in your own scripts. What is important however is how you configure those options for a VM. Heck, you can even look at the code, it's just a bunch of shell scripts.

This is an old run for example, starting a debian VM:
Code:
Feb 08 02:22:34:  [bhyve options: -c 2 -m 4096M -Hwl bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd -U 137ea5a5-58d0-11eb-bcdc
-002590f15838 -u]
Feb 08 02:22:34:  [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,virtio-blk,/dev/zvol/stor10k/DATA/vm/debian/disk0 -s 5:0,virtio-n
et,tap13,mac=58:9c:fc:05:c8:d6 -s 6:0,fbuf,tcp=0.0.0.0:5900]
Feb 08 02:22:34:  [bhyve console: -l com1,/dev/nmdm-debian.1A]
Feb 08 02:22:34:  [bhyve iso device: -s 3:0,ahci-cd,/vm/.config/null.iso]
Feb 08 02:22:34: starting bhyve (run 2)
 
Your solution to add the parameter "gateway_enable="YES" to rc.conf worked only for some time. I've rebooted the PC and the network inside the Ubuntu VM does not work again.

Code:
This is my /etc/rc.conf ;

sendmail_enable="NONE"
hostname="marietto"
keymap="it.kbd"
ifconfig_em0="DHCP"
local_unbound_enable="YES"
sshd_enable="YES"
moused_enable="YES"
ntpdate_enable="YES"
ntpd_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
dbus_enable="YES"
hald_enable="YES"
slim_enable="YES"
sound_load="YES"
snd_hda_load="YES"
kld_list="i915kms"
#kld_list="/boot/modules/i915kms.ko"
moused_enable="YES"
libvirt_enable="YES"
linux_enable="YES"
zfs_enable="YES"
linux_mounts_enable="YES"
gateway_enable="YES"

root@marietto:~ # kldstat

Id Refs Address                Size Name

 1  103 0xffffffff80200000  1f11ef8 kernel
 2    1 0xffffffff82112000     4110 nmdm.ko
 3    1 0xffffffff82117000   5748f0 vmm.ko
 4    1 0xffffffff8268c000     fc48 if_bridge.ko
 5    2 0xffffffff8269c000     8178 bridgestp.ko
 6    1 0xffffffff82e00000   478910 zfs.ko
 7    1 0xffffffff82c10000    11f10 fusefs.ko
 8    1 0xffffffff82c22000     3378 acpi_wmi.ko
 9    1 0xffffffff82c26000     3250 ichsmb.ko
10    1 0xffffffff82c2a000     2180 smbus.ko
11    1 0xffffffff82c2d000     2340 uhid.ko
12    1 0xffffffff82c30000     4350 ums.ko
13    1 0xffffffff82c35000     3380 usbhid.ko
14    1 0xffffffff82c39000     31f8 hidbus.ko
15    1 0xffffffff82c3d000     3320 wmt.ko
16    1 0xffffffff82c41000    388f8 linux.ko
17    4 0xffffffff82c7a000     db70 linux_common.ko
18    1 0xffffffff82c88000    30ac8 linux64.ko
19    1 0xffffffff82cb9000     2260 pty.ko
20    1 0xffffffff82cbc000     639c linprocfs.ko
21    1 0xffffffff82cc3000     3284 linsysfs.ko
22    1 0xffffffff82cc7000     3530 fdescfs.ko
23    1 0xffffffff82ccb000     2a08 mac_ntpd.ko
24    1 0xffffffff83279000   158458 i915kms.ko
25    1 0xffffffff82cce000    7f4c8 drm.ko
26    2 0xffffffff82d4e000     cbc8 linuxkpi_gplv2.ko
27    2 0xffffffff82d5b000     2328 lindebugfs.ko

this is my /etc/sysctl.conf :

net.link.tap.up_on_open=1
#net.inet.ip.forwarding=1

and this is my /boot/loader.conf

vmm_load="YES"
nmdm_load="YES"
if_tap_load="YES"
if_bridge_load="YES"
#fusefs_load="YES"
fuse_load="YES"

#/etc/remote

vm0:dv=/dev/nmdm0B:br#9600a=none:

# 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>

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

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 3 priority 128 path cost 2000000
    groups: bridge
    nd6 options=9<PERFORMNUD,IFDISABLED>

# 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
192.168.1.0/24     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:0.0.0.0/96                 ::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                           UGRS        lo0

/etc/resolv.conf :

# Generated by resolvconf
search homenet.telecomitalia.it
# nameserver 192.168.1.1

nameserver 127.0.0.1
options edns0
 
You have two entries for:
Code:
moused_enable="YES"

If you're having problems with your mouse try:
Code:
moused_enable="YES"
mouse_type="auto"

This is off, what I have underneath yours:
Code:
ntpdate_enable="YES"
ntpd_enable="YES"

ntpd_enable="YES"
ntpd_sync_on_start="YES"

No need for this:
Code:
sound_load="YES"

The correct syntax if you choose to use it:
Code:
snddetect_enable="YES"

This something I've never seen before:
Code:
libvirt_enable="YES"


This what mine consists of:
/etc/rc.conf
Code:
hostname="bakemono"
ifconfig_em0="DHCP"
ntpd_enable="YES"
ntpd_sync_on_start="YES"
powerd_enable="YES"
powerd_flags="-a hiadaptive -b adaptive"
dumpdev="NO"
sendmail_enable="NO"
syslogd_flags="-c -ss"
microcode_update_enable="YES"
hald_enable="YES"
dbus_enable="YES"
linux_enable="YES"
avahi_daemon_enable="YES"
fsck_y_enable="YES"
swapexd_enable="YES"
clean_tmp_X="YES"
clear_tmp_enable="YES"
devd_enable="YES"
devfs_system_ruleset="devfsrules_common"

pf_enable="YES"
pf_rules="/etc/pf.conf"
pf_flags=""
pflog_enable="YES"
pflog_logfile="/var/log/pflog"
pflog_flags=""

tcp_drop_synfin="YES"

ssh_enable="NO"
telnet_enable="NO"
cupsd_enable="NO"
portmap_enable="NO"
rlogin_enable="NO"
inetd_enable="NO"
webcamd_enable="NO"
samba_enable="NO"
lpd_enable="NO"
winbindd_enable="NO"
nfs_server_enable="NO"
nfs_client_enable="NO"

To update your CPU microcode you need to have sysutils/devcpu-data installed first.
 
Which freeBSD version are u using ? Some parameters that I have and u don't have are working great for me. They are :

with :

sound_load="YES"
snd_hda_load="YES"

I can hear music and sounds

without this : libvirt_enable="YES" virt-manager does not work.

Yes,I had two moused_enable="YES" and that's wrong,I've fixed it.

yes,these works and mine not :

ntpd_enable="YES"
ntpd_sync_on_start="YES"

To update your CPU microcode you need to have sysutils/devcpu-data installed first : that's right,thanks.

where is your kld_list="i915kms" ? this is the line that does not work for me. for some reason it is not accepted and I should load the i915kms driver manually when freebsd is ready to go,before to write "startx" otherwise it will give an error.
 
Code:
jitte@bakemono:~ $ uname -a
FreeBSD bakemono 12.2-RELEASE-p7 FreeBSD 12.2-RELEASE-p7 GENERIC  amd64
jitte@bakemono:~ $

Please run uname -a so we can be sure what we're working with.

I've never used "virt-manager" and is why I didn't recognoze it.

I get sound from my laptop speakers and headphones with no sound settings, only what's shown in my file. If that works for you that's what counts.

Mine is a Nvidia box. This is a shot from sysutils/screenfetch:
screenfetch01.jpg


Or try out screenfetch and the commands I used. :)
 
you know,I'm very hungry for knowledge and curious. I realized that if the vm-bhyve wrapper creates and configures by itself the network interfaces, the Linux virtual machine it is able to grab the internet connection during the installation and after,but without it,it doesn't. So,I would like to know what differences there are. What's the magic key that open the door ? I'm trying to understand it from 2 weeks,I'm tired but I really want to know where I make the mistake. So,when vm-bhyve creates these network interfaces, Linux can connect to internet out of the box :

Code:
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>

vm-public: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether aa:1f:f5:c1:4d:21
    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: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 1 priority 128 path cost 20000
    groups: bridge vm-switch viid-4c918@
    nd6 options=9<PERFORMNUD,IFDISABLED>

tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
    description: vmnet-hirsute-gpu-0-public
    options=80000<LINKSTATE>
    ether 58:9c:fc:10:ff:8e
    groups: tap vm-port
    media: Ethernet autoselect
    status: active
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    Opened by PID 2143

instead when I use this script :

Code:
ps ax | grep bhyve | awk '{ print $1; }' | xargs kill -9
lklfuse -o type=ext4 /dev/da2s1 /mnt/da2s1
setxkbmap it
ifconfig tap0 create
ifconfig bridge0 create
ifconfig bridge0 addm tap0 addm em0 up

or this :

Code:
ifconfig tap0 create
ifconfig vm-public addm tap0

or this :
Code:
ifconfig tap0 create
ifconfig vm-public addm tap0 up

and :

Code:
bhyve -c 4 -m 8G -w -H \
        -s 0,hostbridge \
        -s 3,ahci-cd,/vms/iso/linux/ubuntu-21.04-desktop-amd64.iso \
        -s 4,virtio-blk,/mnt/da2s1/OS/freebsd/amd64/hirsute.img \
        -s 5,virtio-net,tap0,mac=58:9c:fc:01:58:f9 \
        -s 29,fbuf,tcp=0.0.0.0:5900,w=1440,h=900,wait \
        -s 30,xhci,tablet \
        -s 31,lpc -l com1,stdio \
        -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
        vm0 &

the network interfaces created in this case are the following ones :

Code:
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
        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>

bridge0: flags=8843<UP,BROADCAST,RUNNING,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 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>

tap0: 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>

and it can't. Please take in consideration that the status : no carrier of the tap0 interface changes in status active when I launch the VM with these commands :

Code:
bhyve -c 4 -m 8G -w -H \
        -s 0,hostbridge \
        -s 3,ahci-cd,/vms/iso/linux/ubuntu-21.04-desktop-amd64.iso \
        -s 4,virtio-blk,/mnt/da2s1/OS/freebsd/amd64/hirsute.img \
        -s 5,virtio-net,tap0,mac=58:9c:fc:01:58:f9 \
        -s 29,fbuf,tcp=0.0.0.0:5900,w=1440,h=900,wait \
        -s 30,xhci,tablet \
        -s 31,lpc -l com1,stdio \
        -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
        vm0 &

The odd thing is that in both cases I'm using the same configuration on the host OS. Something like this :

Code:
/etc/rc.conf

hostname="marietto"
keymap="it.kbd"
ifconfig_em0="DHCP"
local_unbound_enable="YES"
gateway_enable="YES"
vm_enable="YES"
vm_dir="/vms/os/linux"

/boot/loader.conf

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

/etc/sysctl.conf

net.link.tap.up_on_open=1
net.inet.ip.forwarding=1

PS :

I tried also to remove net.inet.ip.forwarding=1 from /etc/sysctl.conf as suggested,leaving intact gateway_enable="YES" but it worked only until the next reboot.

the only difference I see is that when the net is configured by the wrapper,the tap interface is not present before to launch the VM,but it is created in same moment I launch it,and it works. Instead,when I create the tap interface with these commands before to launch the VM :

Code:
ifconfig tap0 create
ifconfig bridge0 create
ifconfig bridge0 addm tap0 addm em0 up

the VM can't connect to internet. someone knows why ?
 
Post the configuration of the VM; you can edit it with vm configure <vm name>. Then show the output from vm switch list.
 
this works :

Code:
loader="uefi"
cpu=8
memory=8GB
graphics="yes"
graphics_res="1440x900"
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
#disk0_name="/mnt/da2s1/OS/freebsd/amd64/hirsute.img"
disk0_name="hirsute.img"
#passthru0="0/1/0=0:0"
uuid="703ad283-eccf-11eb-a36d-e0d55ee21f22"
network0_mac="58:9c:fc:01:58:f9"
xhci_mouse="yes"


now,let's assume that I have removed vm-bhyve,this doesn't work :


Code:
ifconfig tap1 create
ifconfig bridge0 create
ifconfig bridge0 addm tap1 addm em0 up


or,without removing vm-bhyve,this doesn't work :


Code:
ifconfig vm-public deletem em0
ifconfig bridge1 create
ifconfig bridge1 up
ifconfig bridge1 addm em0
ifconfig tap1 create
ifconfig tap1 up
ifconfig bridge1 addm tap1


this doesn't even work :


Code:
ifconfig tap1 create
ifconfig tap1 up
ifconfig vm-public addm tap1


Code:
bhyve -c 4 -m 8G -w -H \
        -s 0,hostbridge \
        -s 3,ahci-cd,/vms/iso/linux/ubuntu-21.04-desktop-amd64.iso \
        -s 4,virtio-blk,/vms/os/linux/hirsute-gpu/hirsute.img \
        -s 5,virtio-net,tap1 \
        -s 29,fbuf,tcp=0.0.0.0:5900,w=1440,h=900,wait \
        -s 30,xhci,tablet \
        -s 31,lpc -l com1,stdio \
        -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
        vm0 &

Code:
root@marietto:~ #  vm switch list

NAME    TYPE      IFACE      ADDRESS  PRIVATE  MTU  VLAN  PORTS
public  standard  vm-public  -        no       -    -     em0
 
Last edited:
As for the mouse problem with vm-bhyve. Boot linux in a non-graphical and if you have network up and running than you can use vnc.
 
because it changes the keymapping for vnc and bhyve,and both these tools are used in FreeBSD to emulate a VM. From what I've understood I have already configured correctly the language inside xfce4,but it does not stick because what counts more is the key map that's located inside the bhyve source code and the solution is to extend that key map with more combinations altering the source code of some bhyve files. Bhyve has one only key mapping as default and that's the US language.
 
I just installed linux-debian with lxqt window manager using vm-bhyve.
On the linux guest i installed tigervnc-standalone-server.
On the freebsd host i used vncviewer (tightvnc)
Mouse and keyboard work just like that without me having to do any additional configs.
My keyboard layout is a Belgium.
 
how did u boot debian ? when I reboot the VM that I've just created,this is what happens :


Screenshot_20210727_143618.png


this is the conf. file that I'm using :

Code:
loader="uefi"
cpu=8
memory=8GB
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="debian-gpu.img"
uuid="ca6be87e-eed2-11eb-abbb-e0d55ee21f22"
network0_mac="58:9c:fc:03:33:60"
graphics="yes"
graphics_res="1440x900"
xhci_mouse="yes"

I've installed debian with this command :

Code:
vm install debian-gpu debian-10.10.0-amd64-DVD-1.iso

I tried also with this conf file :

Code:
loader="grub"
grub_run_partition="1"
grub_run_dir="/boot/grub"
cpu=8
memory=8GB
network0_type="virtio-net"
network0_switch="public"
#disk0_type="virtio-blk"
disk0_type="ahci-hd"
disk0_name="debian-gpu.img"
uuid="ca6be87e-eed2-11eb-abbb-e0d55ee21f22"
network0_mac="58:9c:fc:03:33:60"
graphics="yes"
graphics_res="1440x900"
xhci_mouse="yes"

but I think that it is freezed on the bootloader :

Code:
root@marietto:~/.local/share/Trash/files # vm list

NAME         DATASTORE  LOADER  CPU  MEMORY  VNC  AUTOSTART  STATE

debian-gpu   default    grub    8    8GB      -    No         Bootloader (6057)

I don't know how to interact with it,since vncviewer does not work.

even vm console does not work :

root@marietto:~/.local/share/Trash/files # vm console debian-gpu
Connected : yes,but now ? what should I do ?

I tried also using this image file : debian-live-10.10.0-amd64-xfce.iso ; but nothing.

According with this website,it seems that Debian won't boot in UEFI mode,until some modifications are made : https://blahg.josefsipek.net/?p=595

So I suppose that you have used grub,but in this case,can u explain to me why vm console says "connected" but then,nothing happens ?


 
Last edited:
Back
Top