Cyberithub

10 Best brctl Command Examples in Linux

Advertisements

In this article, we will look at the top 10 best Linux brctl command examples for Ethernet Network Bridge. brctl command used for ethernet bridges. When you have multiple ethernet interfaces on your server and want to combine and present them as single entity then you need to use the concept of ethernet bridges.

For example, if you have enp0s3 and enp1s3 interface, you can always combine them and present it as just br0, which will again use both enp0s3 and enp1s3 for network traffic. This will get further cleared through below brctl command examples.

brctl Command Examples

Prerequisites

You need to install bridge-utils package using yum install command.

For RedHat/CentOS 

[root@localhost ~]# yum install bridge-utils -y

For Ubuntu

[root@localhost ~]# sudo apt-get install bridge-utils -y

10 Best brctl Command Examples in Linux 1

 

1. Show all bridge enabled devices

To show all the bridges currently available in the node, use brctl show command.

[root@example1 ~]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000d3a8a7868 no eth1
vnet0
virbr0 8000.5254005098ae yes virbr0-nic

1. Add new interface to bridge br0  

If you want to add an interface in an existing ethernet bridge, you need to use brctl addif command.

[root@example1 ~]# brctl addif br0 eth1

3. Add a new Ethernet bridge br0

If you want to create a new ethernet interface bridge, use command brctl addbr.

[root@example1 ~]# brctl addbr br0

4. Delete an Ethernet bridge

If you want to delete an ethernet bridge br0, use command brctl delbr br0.

[root@example1 ~]# brctl delbr br0

5. Check bridge STP info

To  show all the STP parameters of ethernet bridge br0.

[root@localhost ~]# brctl showstp br0
br0
bridge id 8000.000000000000
designated root 8000.000000000000
root port 0 path cost 0
max age 20.00 bridge max age 20.00
hello time 2.00 bridge hello time 2.00
forward delay 15.00 bridge forward delay 15.00
ageing time 300.00
hello timer 0.00 tcn timer 0.00
topology change timer 0.00 gc timer 0.00
flags

6. Delete an interface from Bridge 

To delete an interface enp0s3 from ethernet bridge br0, use below command.

[root@localhost ~]# brctl delif br0 enp0s3

7. Turn Spanning Tree on or off

You can also turn spanning tree on and off using below command.

[root@localhost ~]# brctl stp br0 off

[root@localhost ~]# brctl stp br0 on

8. Show all MAC Address connected to br0

If you want to see all the MAC Addresses connected to ethernet bridge br0, use brctl showmacs command.

[root@localhost ~]#brctl showmacs br0
port no mac addr                is local?       ageing timer
1       00:74:16:87:14:de       yes                0.00

9. Add Multiple Interfaces to Bridge br0

You can also add multiple interfaces to an ethernet bridge br0 using below command.

[root@localhost ~]#brctl addif br0 enp0s3 enp1s3

10. Change STP Parameter Value

If you want to change STP Parameter value, you can do that by using below brctl command.

[root@localhost ~]#brctl setageing br0 100

Also Read: How to install lspci, lsscsi,lsusb and lsblk in RedHat/CentOS 7

Reference: More on brctl Usage

Leave a Comment