dhcp failing in bhyve guest

I have a FreeBSD bhyve guest in a FreeBSD host. The guest fails to dhcp an ip address from my router. Any suggestions an to what I'm missing? I used the `vm` wrapper tool to create the bridge, tap, virtual machine, etc.

HOST:
FreeBSD system76 15.0-RELEASE-p11 FreeBSD 15.0-RELEASE-p11 releng/15.0-n281086-1183ce3b12d6 GENERIC amd64

GUEST:
FreeBSD fbsdlocal 15.0-RELEASE FreeBSD 15.0-RELEASE releng/15.0-n280995-7aedc8de6446 GENERIC amd64

HOST NETWORK:
Code:
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
    ether d4:93:90:3c:84:69
    inet6 fe80::d693:90ff:fe3c:8469%re0 prefixlen 64 scopeid 0x1
    media: Ethernet autoselect (none)
    status: no carrier
    nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384
    options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
    inet 127.0.0.1 netmask 0xff000000
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
    groups: lo
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
wlan0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=0
    ether 60:45:2e:d0:ed:78
    inet 192.168.1.243 netmask 0xffffff00 broadcast 192.168.1.255
    groups: wlan
    ssid starfish channel 44 (5220 MHz 11a vht/80+) bssid 2c:67:be:36:69:4f
    regdomain FCC country US authmode WPA2/802.11i privacy ON
    deftxkey UNDEF AES-CCM 3:128-bit AES-CCM ucast:128-bit txpower 17
    bmiss 7 mcastrate 6 mgmtrate 6 scanvalid 60 ampdulimit 64k
    ampdudensity 4 -amsdutx amsdurx shortgi -ldpctx ldpcrx -uapsd vht
    vht40 vht80 vht160 -vht80p80 wme roaming MANUAL
    parent interface: iwlwifi0
    media: IEEE 802.11 Wireless Ethernet VHT mode 11ac
    status: associated
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
vm-public: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
    options=10<VLAN_HWTAGGING>
    ether b2:79:c4:89:f8:dd
    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
    bridge flags=0<>
    member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            port 5 priority 128 path cost 2000000 vlan protocol 802.1q
    member: wlan0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            port 3 priority 128 path cost 33333 vlan protocol 802.1q
    groups: bridge vm-switch viid-4c918@
    nd6 options=9<PERFORMNUD,IFDISABLED>
tap0: flags=1008943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
    description: vmnet/testvm/0/public
    options=80000<LINKSTATE>
    ether 58:9c:fc:10:c5:05
    groups: tap vm-port
    media: Ethernet 1000baseT <full-duplex>
    status: active
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    Opened by PID 4372
You have new mail in /var/mail/root

HOST REPRO:
Code:
vm start testvm

GUEST REPRO:
Code:
Starting dhclient.
DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 15
DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 17
DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 11
DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 1
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

GUEST /etc/rc.conf:
Code:
root@fbsdlocal:~ # cat /etc/rc.conf
hostname="fbsdlocal"
zfs_enable="YES"
ifconfig_vtnet0="DHCP"
ifconfig_vtnet0_ipv6="inet6 accept_rtadv"
sshd_enable="YES"
nptd_enable="YES"
ntpd_sync_on_start="YES"

GUEST NETWORK:
Code:
vtnet0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
        options=880028<VLAN_MTU,JUMBO_MTU,LINKSTATE,HWSTATS>
        ether 58:9c:fc:03:29:27
        inet6 fe80::5a9c:fcff:fe03:2927%vtnet0 prefixlen 64 scopeid 0x1
        media: Ethernet autoselect (10Gbase-T <full-duplex>)
        status: active
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        inet 127.0.0.1 netmask 0xff000000
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        groups: lo
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

HYPERVISOR (bhyve):
Code:
root@system76 /home/toddg $ vm list
NAME      DATASTORE  LOADER     CPU  MEMORY  VNC  AUTO  STATE
myalpine  default    grub       1    512M    -    No    Locked (system76)
myubuntu  default    grub       1    1024M   -    No    Locked (system76)
testvm    default    bhyveload  1    256M    -    No    Running (4372)
root@system76 /home/toddg $ vm info
------------------------
Virtual Machine: testvm
------------------------
  state: running (4372)
  datastore: default
  loader: bhyveload
  uuid: 79fa767c-5292-4645-8ad7-f81a5781fd2b
  cpu: 1
  memory: 256M
  memory-resident: 160370688 (152.941M)

  console-ports
    com1: /dev/nmdm-testvm.1B

  network-interface
    number: 0
    emulation: virtio-net
    virtual-switch: public
    fixed-mac-address: 58:9c:fc:03:29:27
    fixed-device: -
    active-device: tap0
    desc: vmnet/testvm/0/public
    mtu: 1500
    bridge: vm-public
    bytes-in: 1584 (1.546K)
    bytes-out: 3432 (3.351K)

  virtual-disk
    number: 0
    device-type: file
    emulation: virtio-blk
    options: -
    system-path: /vms/testvm/disk0.img
    bytes-size: 21474836480 (20.000G)
    bytes-used: 1646822400 (1.533G)
 
AIUI, the problem is you are using a wlan interface, which can only have one mac address. Either use the ethernet interface (re0) to connect to the internet and bridge it, or use NAT (so ip-addr in your bhyve guest will be forwarded by the host and ip addr replaced).
 
bakul and @cracauer,

Thank you. I wondered if it was the wifi. I'm actually in the middle of moving, so I'm forced to use wireless connection until I settle in at my next location.

Can one of you elaborate on the proposed NAT solution?
 
Back
Top