What is brctl in Linux and how to use it?

What is brctl in Linux and how to use it?

brctl stands for Bridge Control. In Linux, this command is used to create and manipulate ethernet bridge. This is typically used when you have multiple ethernet networks on your servers, and you want to combine them and present it as one logical network.

How do I add an interface to a bridge in Linux?

Add an Interface to Existing Bridge Using brctl addif, we can add an interface to an existing ethernet bridge. The following example will add the ethernet network eth0 to the bridge “dev” that we just created. Warning: Don’t try this on any critical machines, as you might loose network connection to that machine when something goes wrong.

What happens when multiple interfaces are part of “Dev” bridge?

When multiple interfaces are part of “dev” bridge, then eth0 will be a potential candidate to sent-out the outgoing frames from the bridge. After adding the eth0 to “dev” bridge, the brctl show command will display the following.

Is it possible to connect any device to the bridge-utils?

Report back. The bridge-utils should have no problem connecting any Ethernet, tap, tun, or ppp device to the bridge. However, you can not attach a Wireless device to a bridge. To do that you need to use some iptables magic; let me know if you need to do this.

What is a VLAN port in Linux?

With recent Kernels Linux bridges have become vlan-aware and now allow configuring any bridge port like a port of any decent network switch with respect to 802.1q VLANS. A port can present a VLAN as untagged traffic as well as a number of VLANs in tagged mode.

Is it possible to add a bridge to a brctl interface?

This feature is not available through the obsolete brctl command, but requires the newer replacement bridge command (along with the usual ip link command). It is a simpler setup (one bridge, no sub-interface).

Is it possible to create a bridge with a VLAN tag?

I think this does what I want – it creates two bridges, with a virtual ethernet device connecting them, and adds/removes the VLAN tag as the traffic passes between the bridges. Is there anything simpler? Yes: you can set the bridge to be VLAN aware.

author

Back to Top