Brctl function: Used for the management of Ethernet bridging (bridge)
The main usage is as follows:
[email protected]:/# brctl--help
BusyBox v1.22.1 (2016-02-24 11:41:04 CST) multi-call binary.
Usage:brctl COMMAND [BRIDGE [INTERFACE]]
Manage Ethernet Bridges
Commands:
Show show a list of bridges//display bridging information
ADDBR Bridge Create bridges//Add bridged ports
DELBR Bridges Delete Bridge//delete bridging port
addif Bridge IFACE add IFACE to bridge//Add binding Interface for bridging ports
Delif Bridge IFACE Delete IFACE from bridge//Remove bridged port binding interface
Setageing BRIDGE Time Set ageing time
SETFD Bridge time Set Bridge forward delay
Sethello BRIDGE time Set Hello time
Setmaxage BRIDGE time Set Max message age
Setpathcost BRIDGE cost Set path cost
Setportprio BRIDGE PRIO Set Port Priority
Setbridgeprio Bridge PRIO Set Bridge priority
STP BRIDGE [1/yes/on|0/no/off] STP on//whether to participate in spanning Tree protocol
Use the following:
[email protected] :/# brctl Show
Bridge name Bridge id STP enabled Interfaces
br-net 7fff.78c2c0e3004d yes eth0
Wlan0
As you can see, the current bridge interface name is Br-net, which binds two ports eth0 and Wlan0.
[email protected]:/#brctl addif br-net eth1
[1133.440000] Device eth1 entered promiscuous mode
[email protected]:/# brctl Show
Bridge name Bridge ID STP enabled interfaces
Br-net 7fff.78c2c0e3004d Yes eth0
Wlan0
Eth1
For bridging interface Br-net increase the binding interface eth1, after the addition of the check to see that the binding is successful.
[email protected]:/#brctl delif br-net eth1
[1248.150000] Device eth1 left promiscuous mode
[1248.160000] Br-net:port 3 (eth1) entered disabled state
[email protected]:/# brctl Show
Bridge name Bridge ID STP enabled interfaces
Br-net 7fff.78c2c0e3004d Yes eth0
Wlan0
Delete the bridged interface br-net bound Port eth1, after the deletion is complete, the view has been deleted successfully.
[email protected]:/#brctl ADDBR Br-lan //Added bridging interface "Br-lan"
[email protected]:/# brctl Show
Bridge name Bridge ID STP enabled interfaces
Br-net 7fff.78c2c0e3004d Yes eth0
Wlan0
Br-lan 8000.000000000000 No//new bridge interface defaults to "not enabled"
[email protected]:/# brctl addif Br-lan eth1//For bridging interface Br-lan bound Port eth1
[1375.780000] Device eth1 entered promiscuous mode
[email protected]:/# brctl Show
Bridge name Bridge ID STP enabled interfaces
Br-net 7fff.78c2c0e3004d Yes eth0
Wlan0
Br-lan 8000.78c2c0e3004e No eth1
[email protected]:/#brctl STP Br-lan 1//Participate in Spanning Tree protocol
[email protected]:/# brctl Show
Bridge name Bridge ID STP enabled interfaces
Br-net 7fff.78c2c0e3004d Yes eth0
Wlan0
Br-lan 8000.78c2c0e3004e Yes eth1//participate in Spanning Tree protocol, receive and send BPDUs (Bridge Protocol Data Units )
[email protected]:/#brctl DELBR Br-lan
[1635.570000] Device eth1 left promiscuous mode
[1635.570000] Br-lan:port 1 (eth1) entered disabled state
[email protected]:/#
[email protected]:/# Brctl Show
Bridge name Bridge ID STP enabled interfaces
Br-net 7fff.78c2c0e3004d Yes eth0
Wlan0
Delete the bridge interface "Br-lan" directly to see the result deleted successfully.
Use of Brctl