VLAN and Bridge - how is the situation on the host

Dear community,
I am digging for information about VLAN and how to handle jails. As far as I understood a bridge is able to put different VLAN together and assign them to a network interface as em0 or others. The handbook https://docs.freebsd.org/en/books/handbook/advanced-networking/#network-bridging states In many respects, a bridge is like an Ethernet switch with very few ports. .

If the bridge is like a Ethernet switch there is only one line to the networking interface as em0 or so. On a Ethernet switch only one cable connects a router or other "uplink hardware". Then the host must be connected by a VLAN, too. On the other hand the bridge is located on the host and the host could directly access the networking interface.

What is the situation? Or are both options possible?

Thank you very much for your help in advance,
Christoph
 
A bridge(4) is a layer 2 connection. In it's most basic form it's indeed similar to a switch.

There are several ways to deal with VLANs. You typically create a vlan(4) interface on the host and link that to your bridge. Then the traffic on the bridge will be the untagged traffic of that VLAN. You could also pass all the tagged VLANs on the bridge, connect your VMs or jails to that and do the vlan(4) interface on the jail or VM.

Whatever you do you need to remember there's a difference between tagged and untagged traffic when dealing with VLANs. All the vlan(4) interface does is add/remove the VLAN header (with the corresponding VLAN ID) and pass the traffic.
 
Back
Top