bhyve Does the virtual switch interface have to be a bridge?

I am trying to get to run Debian as a VM. I have never used bhyve before, so you can imagine the steep learning curve here.

When creating a virtual switch to use with bhyve, does it have to be a bridge interface?

vm switch create -t manual -b bridge0 public

Can't I just use an existing interface instead, like bge3?
 
I don't use sysutils/vm-bhyve, but the basic principle of VM network is simple. You create a tap(4) interface and pass it into your VM (virtio-net). On the host, you create a bridge(4). You make this tap and your physical interface members of this bridge. I think sysutils/vm-bhyve does that for you behind the curtain. Maybe you have to specify your physical interface with the "-i" option.

During the installation of Debian, you specify the ip address of the VM (static, + gateway and dns) or dhcp.

So, if this is the first VM, "-t standard" is better suited. If you have already created a bridge you can use the same with "-t manual -b ExistingBridge", if I understand correctly.

A "virtual switch" is NOT a physical interface.
 
There is not necessarily always a bridge used. It depends on how the connectivity of the guest should look like.
I don't use sysutils/vm-bhyve, but the basic principle of VM network is simple. You create a tap(4) interface and pass it into your VM (virtio-net).
Yes. One or more tap interface(s).

Inside the bhyve, this then appears as a network interface vtnetN.
On the host the tapN interface appears also as a network interface. And it behaves as if the vtnetN interface in the bhyve were the machine at the other end of the wire (if there were a wire). That is, the tap interface on the host and the corresponding vtnetN interface in the bhyve together form a network.

On the host, you create a bridge(4). You make this tap and your physical interface members of this bridge.
If you do that, then the virtual network (consisting of tapN+vtnetN) and the physical network (attached to the physical interface) are bridged together to form a single network.

This is a common usecase: the bhyve should then be reachable from the external physical network.

Can't I just use an existing interface instead, like bge3?
No. You need to use a tap interface, because the tap interface transports the network traffic from the kernel into userland, where the bhyve process is running. Only there can the bhyve process grab the network traffic, then emulate a vtnet interface inside the guest and provide that network traffic into the guest's kernel.
 
1. You can use Chelsio (cxgbe)
OR
2. SR-IOV (ix) is another pcie device connectivity for bhyve

BUT both depends on network card = Broadcom is good for SR-IOV from what I review for my own specs....

What I and VladiBG are suggesting is NOT easier to do than Bridge + Tap... but they do lead to less overhead (choose your battles).

Churchers Bhyve ( https://github.com/churchers/vm-bhyve ) and majority bhyve managers do (bridge + tap) for ease of use and compatibility.

If you want to go deeper into network for bhyve:

3. netmap/VALE switches
and
4. netgraph

BOTH above are a little 🔥 hotter of a learning curve.
 
There is good answer above, so here is how I set up vm-bhyve servers.
Note, this setup are using VLANs for all networks

The config in /etc/rc.conf depends on you setup. I use a lot of VLANs, so here at two setups.

This one is simple and just on one interface. It’s used for ssh to the server, default GW and transporting VLANs etc. (non direct vm server data)
Code:
cloned_interfaces="vlan65"

ifconfig_ix0="up mtu 9000 -rxcsum -txcsum -tso -lro"
ifconfig_vlan65="inet 10.65.1.20    netmask 255.255.255.0 vlan 65  vlandev ix0 mtu 9000"
defaultrouter="10.65.1.5"


But I use LACP on two interfaces, so the config is title different. Again, it’s used for ssh to the server, default GW and transporting VLANs etc. (non direct vm server data)
Code:
cloned_interfaces="lagg0 vlan65"

ifconfig_ix0="up mtu 9000 -rxcsum -txcsum -tso -lro"
ifconfig_ix1="up mtu 9000 -rxcsum -txcsum -tso -lro"
ifconfig_lagg0="laggproto lacp laggport ix0 laggport ix1 up"
ifconfig_vlan65="inet 10.65.1.20 netmask 255.255.255.0 vlan 65 vlandev lagg0 mtu 9000"
defaultrouter="10.65.1.5"



When I install vm-bhyve and vm-switch I use a lot of VLANs for the vm-servers and make them with:

# vm switch create -n 166 -m 9000 -i ix0 vlan166
or
# vm switch create -n 166 -m 9000 -i lagg0 vlan166

One for every VLAN. Above make VLAN 166 for ix0 or lagg0.



Then in /vm/SERVER/SERVER.conf for the vm-servers I have two networks rows:
Code:
network0_type="virtio-net"
network0_switch="vlan166"

That’s it!
Vm-bhyve makes all the networks, TAP interface etc.
It’s just works out of the box. :)
 
Back
Top