Solved Network in bhyve win10 guest

Very much not sure if this is the right place for this question. Since it might as well be a very Win10 centered problem.

I am struggling to get a network connection in a bhyve guest with win10.

The bhyve guest is running fine and I can reach it from the host with vnc.
In the guest installed the virtio driveres v0.1.190.
And after a guest reboot I still get "Unidentified network" from my guest Ethernet. And the win10 "diagnose" routine tells me it does not have a valid ip configuration.

I suspect some dhcp or firewall setting. But I am a novice in both. I am not using PF and this is all on a laptop in a simple home network.

Anysuggestions how to get a internet connection into the bhyve guest?

The host is:
Code:
uname -a
13.0-RELEASE FreeBSD 13.0-RELEASE #0 r369549M: Sun Apr 18 07:05:21 CEST 2021


/etc/rc.conf
Code:
em0: flags=8963<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=800000<>
        ether iwmMAC
        hwaddr c8:5b:76:e0:98:de
        media: Ethernet autoselect
        status: no carrier
        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>
wlan0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether iwm0MAC
        groups: wlan
        ssid mynet channel 6 (2437 MHz 11g) bssid 08:96:d7:b6:a9:06
        regdomain ETSI country CH authmode WPA2/802.11i privacy ON
        deftxkey UNDEF AES-CCM 2:128-bit AES-CCM 3:128-bit txpower 30 bmiss 10
        scanvalid 60 protmode CTS wme roaming MANUAL
        parent interface: iwm0
        media: IEEE 802.11 Wireless Ethernet OFDM/54Mbps mode 11g
        status: associated
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
lagg0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether iwmMAC
        inet6 fe80::228:f8ff:fe48:8028%lagg0 prefixlen 64 scopeid 0x4
        inet 192.168.178.25 netmask 0xffffff00 broadcast 192.168.178.255
        laggproto failover lagghash l2,l3,l4
        laggport: em0 flags=1<MASTER>
        laggport: wlan0 flags=4<ACTIVE>
        groups: lagg
        media: Ethernet autoselect
        status: active
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1331
        options=80000<LINKSTATE>
        inet 10.6.220.69 --> 10.6.220.69 netmask 0xffffffff
        inet6 2001:67c:10ec:578f:8000::6f prefixlen 115
        inet6 fe80::228:f8ff:fe48:8028%tun0 prefixlen 64 scopeid 0x5
        groups: tun
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        Opened by PID 12576
tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        ether 58:9c:fc:10:f8:05
        groups: tap
        media: Ethernet autoselect
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        Opened by PID 32804
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 58:9c:fc:00:5d:62
        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 6 priority 128 path cost 55
        member: lagg0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 4 priority 128 path cost 2000000
        groups: bridge
        nd6 options=9<PERFORMNUD,IFDISABLED>

/etc/sysctl.conf
Code:
net.link.tap.up_on_open=1
net.link.ip.forwarding=1

the guest:
Code:
bhyve -c sockets=1,cores=2,threads=1 -m 8G -H -w \
    -s 0,hostbridge \
    -s 3,virtio-blk,/var/images/win10/win10.img \
    -s 5,ahci-cd,/var/images/win10/virtio-win-0.1.190.iso \
    -s 10,virtio-net,tap0 \
    -s 11,fbuf,tcp=0.0.0.0:5900,wait \
    -s 20,xhci,tablet \
    -s 31,lpc \
    -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
    win10

Inside the win 10 guest
Code:
ipconfig -all

Windows IP Configuration
 
  Host Name : DESKTOP
  Primary Dns Suffix :
  Node Type : Hybrid
  IP Routing Enabled : No
  WINS Proxy Enabled : No

Ethernet adapter Ethernet:
 
  Connection-specific DNS Suffix :
  Description : Red Hat VirtIO Ethernet Adapter
  Physical Address : SOME-MAC
  DHCP Enabled : Yes
  Autoconfiguration Enabled : Yes
  Autoconfiguration IPv4 Adress : 169.254.80.69(Preferred)
  Subnet Mask : 255.255.0.0
  Default Gateway :
  NetBIOS over Tcpip : Enabled
 
I would avoid bridging with wlan0, as far as I can see, in your example above namely wlan0 is up, not em0.
In short, you cannot have more than one MAC address on the same WiFi interface. Although, there exist some tricks and work-arounds which I never tried. I always use NAT in such cases.
 
So, do you have a DHCP service running on 192.168.178.0/24?
The DHCP server should be on
Code:
192.168.178.1

My situation stays the same for a simple host network with just an em0

/etc/rc.conf
Code:
ifconfig_em0="ether DHCP"
ifconfig_bridge0="addm em0 addm tap0"
cloned_interfaces="bridge0 tap0"

Code:
% ifconfig
em0: flags=8963<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=4812099<RXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,VLAN_HWFILTER,NOMAP>
        ether c8:5b:76:e0:98:de
        inet6 fe80::ca5b:76ff:fee0:98de%em0 prefixlen 64 scopeid 0x1
        inet 192.168.178.20 netmask 0xffffff00 broadcast 192.168.178.255
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,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 58:9c:fc:00:5d:62
        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
        nd6 options=9<PERFORMNUD,IFDISABLED>
tap0: flags=8942<BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        ether 58:9c:fc:10:f8:05
        groups: tap
        media: Ethernet autoselect
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        Opened by PID 49600

That is with the bhyve guest running. When it is not running, the tap0 status is no carrier.
Which sounds reasonable to me.
 
Got it.
In the last round I commented the net.link.tap.up_on_open=1 out of /etc/sysctl.conf.
Everything is working like a charm now. It's great.
 
Back
Top