VM and jail bridged network virtual interface

Hello,

I recently brought online my first FreebSD bhyvevm running Linux in and a VLAN jail, both use bridged networking. It works great. One question that I have is that the sources I followed to setup this up lead me down a path where the bhyve VM is using tap device while the jail is using an epair device.

I want to understand why each of these deployments uses a different virtual network interface stack. What's the difference between tap and epair what makes each more suited for the VM / jail deployment?
 
If you pass a tap interface to a vnet jail the interface will disappear from the host and the bridge and the jail network will be isolated. The epair interface instead create 2 devices, one for the host and one for the jail, so when you pass one epair to the jail the other stay on the bridge and the jail can comunicate with the outside network
 
🌐 How bhyve connects to the network (The practical equivalent)

Although bhyve does not use VNET, the way you organize and manage its network on the host is very similar.
Both use FreeBSD's same "virtual cables and switches":

* Jails with VNET: Use a virtual interface called `epair` (which acts like a two-ended virtual network cable: `epairXa` stays on the host and `epairXb` goes inside the Jail).

* bhyve (VMs): Uses a virtual interface called `tap` (which simulates a physical Ethernet network card for the VM).

In both cases, to connect them to the outside world or to each other, you use a `bridge` interface (which acts exactly like a physical network switch in FreeBSD).

📊 Network Architecture Comparison

FeatureJails with VNETbhyve (VM)
Network Stack (inet)Managed by the Host Kernel (but logically isolated in "drawers")Managed entirely by the Operating System inside the VM.
Virtual Interface Usedepair (a pair of connected interfaces).tap (a network device emulator).
Virtual Switch (bridge)Yes, used to group epair and the physical interface.Yes, used to group tap and the physical interface.
Resource ConsumptionExtremely lightweight (software isolation only).Heavier (requires hardware network emulation by bhyve).


Other ref: VNET by Examples
 
Back
Top