# VLAN and Bridge - how is the situation on the host



## chrbr (Oct 11, 2022)

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


----------



## SirDice (Oct 11, 2022)

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.


----------

