Linux Commands

Linux Command: Bridge Usage

In Linux systems, the brctl command has been called a bridge command. The “brctl” term stands for bridge control. It is the ultimate unique command to let you see all the current Ethernet bridges in your system. It may also let you add and create new Ethernet bridges and make changes to many of them with few keywords in them. Therefore, we will be utilizing the Ubuntu 20.04 system to discuss the brctl bridge command. For that, we have to start the shell console of our system via “Ctrl+Alt+T”. So, let’s get started.

We are starting our article with the installation of bridge utilities. For this, we need to use the “apt-get” package command in the shell. The keyword “install” has been used after the apt-get package and the “bridge-utils” package name is utilized after that with the “-y” flag to force installation. At the start of installation, it probably asks for your sudo password and you have to add it necessarily. After that, the bridge utilities will be installed on your Ubuntu system.

If you want to find about the bridge command and its respective usage, you can use the “brctl” keyword in the shell. The below image shows all the information about it.

01: List All Bridges

Now, we will be discussing some of the bridge commands in the Ubuntu terminal to see its working. The very first command we are going to use is the brctl command with the “show” keyword to let us see the information regarding total bridges found in our system. You can see our system has a total of one bridge right now. It has no STP enabled and got no interfaces.

02: Add New Bridge

Let’s say a user doesn’t have any Ethernet bridge in his/her Ubuntu system then he/she has to add one Ethernet bridge. To do so, a user must use the brctl command with the keyword “addbr” and the bridge name. The bridge name can be anything as you can see; we have used “Linux” as a name. After adding the bridge, you have to check again the bridges using the bridge “show” command. You will see that the newly added bridge is now listed in the list.

$ sudo brctl addbr bridge-name

03: Delete a Bridge

To delete a specific bridge, you must discover its name first. After that, you can use the bridge name in the bridge command with the “delbr” keyword to remove it from the bridges list. After the bridge is deleted, you have to check the list once again. You will find out that the bridge is not here anymore as per the bridge “show” command output below.

$ sudo brctl delbr bridge-name

04: Add Interface to Bridge

In your Linux system, there might be many networks Ethernet interfaces. Try avoiding this command as you may lose your current network connection. So, to add the Ethernet interface to a bridge, you have to utilize the bridge command with the keyword “addif”. You have to use the Ethernet interface name after using the bridge name in the command. The bridge “show” command will make you see the newly added Ethernet interface in front of the “Linux” bridge.

$ sudo brctl addif bridge-name interface-name

05: Delete Interface from Bridge

Same as adding an interface to the bridge, we can also delete it or completely remove it. The only change in the bridge command is the use of the “delif” keyword in place of “addif”. All the other parameters would be similar i.e. bridge name, Ethernet interface name. After applying the command, you have to use the show() bridge command to see the changes. In the output, we can view that the enp0s3 ethernet interface is removed from the bridge “Linux”. Same as this, you can add and remove multiple interfaces in the bridges at the same time. To check the Ethernet interfaces, you can use the “ip” command in the shell. You will also find out all the newly added bridges within the Ethernet list.

$ sudo brctl delif bridge-name interface-name

06: Enable STP on Bridge

STP stands for spanning tree that has been used in the Linux system to make a connection between different bridges. It would be quite awesome if it is enabled on your all bridge devices because it will make you collaborate between all those bridges from the shortest way. Initially, you must know about all the bridges which have STP enabled and disabled. To determine that, you have to utilize the same show keyword in the brctl command. You can see both the bridges don’t have STP right now.

To enable the STP on both bridges, we have to utilize the “brctl” command with the keyword “stp” while mentioning the name of a bridge. After the bridge name, you have to use the “on” keyword at the last. The commands for enabling STP for both bridges are shown below. After finding out the information regarding bridges, we have got to know that both our bridges have STP enabled now i.e. “yes”.

$ sudo brctl stp bridge-name on

To disable the STP connection, you have to replace the keyword “on” with “off” in the bridge “stp” command. You can see we have done it for both the bridges and the changes have been implemented successfully.

$ sudo brctl stp bridge-name off

07: Find Mac Address of Bridge

If a user wants to check the mac address of all the bridges that are existing in its system, he/she can do so with the bridge brctl command. You have to utilize the “showmacs” keyword within the brctl command along with the name of a bridge i.e. “Linux”. You will see that the output will be showing you the mac addresses of the specific bridge and also telling if it is local or not. You can also find out the ageing timer of the mac address of a bridge.

$ sudo brctl showmacs bridge-name

08: Set Ageing Time

You can also make your system set the “ageing” time for the mac address of a specific bridge. We have to use the “brctl” command with the keyword “setageing” along with the name of a bridge and time i.e. 150 seconds. Now the ageing time has been set in your system for “Linux”.

09: Show STP Parameters

If any user wants to check the STP settings, parameters, and values for a particular bridge, that can do so by using the same brctl command. You have to use this command along with the keyword “showstp” this time. You can see, the output is showing the STP parametric information of the “Linux” bridge. You can also see the ageing time for Linux mac address i.e. 150.


We have done with the explanation of using the bridge “brctl” command in the Linux shell. We have tried out best to cover all the necessary and easy-to-use details about the bridge command in the shell with every minor detail. We have covered many uses of the bridge command including list all the bridges, adding and deleting the bridges in a list, adding an interface to the bridge, deleting the interface from the bridge, enabling the STP on bridge, finding the MAC address of the bridge, and setting ageing time and showing the STP parameters.

About the author

Aqsa Yasin

I am a self-motivated information technology professional with a passion for writing. I am a technical writer and love to write for all Linux flavors and Windows.