bhyve Alpine / Debian Linux setup via vm-bhyve not getting DHCP lease

Hey everyone! I am trying to set up a Linux VM using bhyve for the purpose of running docker on my FreeBSD laptop (which is essential to have due to my development workflow). However when setting up a Linux VM using either Debian or Alpine images, I am unable to get the network working properly.

I am following the setup instructions for vm-bhyve on GitHub.

I create a network switch and attach the wlan device of my laptop to it like so:

Code:
vm switch create public
vm switch add public wlan0

Then I am using the default template for creating a debian vm, so nothing should be going wrong there.

Checking with
Code:
vm switch info public
clearly shows that the VM is attached to the switch (at least I presume it shows that):

Code:
local: _netgraph,: bad variable name
------------------------
Virtual Switch: public
------------------------
  type: standard
  ident: vm-public
  vlan: -
  physical-ports: wlan0
  bytes-in: 705640 (689.101K)
  bytes-out: 10106678 (9.638M)

  virtual-port
    device: tap0
    vm: debian-docker

However I am unable to obtain a dhcp lease or ping anywhere to the outside world from the linux guest inside the vm. Even though packages are clearly going in and out, also during the attempt to get a dhcp lease.

Since I have no idea what could be going wrong here, any help would be very much appreciated!
 
I also could not get a switched wifi network to work with bhyve. It seems most wifi adapters cannot handle this.
The solution for me way to use NAT instead as this post suggested:
 
I had a suspicion that it might be the wifi adapter.

However there is no error whatsoever when creating the switch, it also shows the VM being attached to wlan0 and there are bytes flowing in and out. So I was reassured by the fact that something appeared to be happening at least. :D

I will take a look at your solution. Thanks!
 
elgrande Well I tried and I failed. I did follow the instructions on GitHub for NAT configuration, pf is running, the rule is set, the vm switch configured, but Debian is still unable to obtain an IP via DHCP.

Any other ideas?
 
Alright, manually assigning an IP address and a nameserver inside the VM did the trick. My debian VM can now communicate to the outside world!

Edit: I still needed the NAT configuration of course on the FreeBSD host. Then check ping and assigned my router as nameserver in
Code:
/etc/resolv.conf
on the debian guest.
 
This helped me getting DHCP to work:
sysctl net.link.tap.up_on_open=1
sysctl net.link.bridge.ipfw=0
sysctl net.link.bridge.pfil_bridge=0
sysctl net.link.bridge.pfil_member=0

https://github.com/churchers/vm-bhyve/wiki/Guest-example:-Alpine-Linux

Added it to /etc/sysctl.conf permanently:

net.link.tap.up_on_open=1
net.link.bridge.ipfw=0
net.link.bridge.pfil_bridge=0
net.link.bridge.pfil_member=0

Maybe helpful, too is:
View: https://www.youtube.com/watch?v=ReICQa3urv0
 
Back
Top