Brctl command
From DD-WRT Wiki
BRCTL is used to create a bridge between two interfaces.
Contents
* 1 Bridges
o 1.1 View
o 1.2 Add
o 1.3 Delete
* 2 Interfaces
o 2.1 Show
o 2.2 Add
o 2.3 Remove
* 3 Other Features
* 4 External Links
1. Bridges
View
To view the current bridges, use the following command on a SSH/Telnet terminal:
# brctl show
The command will then output a bridge name (Often br0 or br1), bridge ID (Used to uniquely specify the bridge), and the current settings for STP (Spanning Tree Protocol). The output wil be formated similar to this:
bridge name bridge id STP enabled
br0 8000.001217318d3e yes
Add
A bridge can be added using the following command, with being replaced with the name of the bridge being replaced.
# brctl addbr
Delete
Where name is the user specified name of the bridge. To delete a bridge, one would use
# brctl delbr
2. Interfaces
Although the preceding commands simply create an instance of a bridge, in order to use them, one must add interfaces to a bridge. The bridge "br0" is standard bridge on DD-WRT.
Show
In order to show the current interfaces that are members of a bridge, we use a command similar to the "show" command:
# brctl showbr br0 (for V23SP2: brctl showstp br0)
This would generate output similar to the following:
br0
bridge id 8000.001217318d3e
designated root 8000.001217318d3e
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 0.00 bridge forward delay 0.00
ageing time 42.30 gc interval 4.00
hello timer 1.28 tcn timer 0.00
topology change timer 0.00 gc timer 2.02
flags
vlan0 (1)
port id 8001 state forwarding
designated root 8000.001217318d3e path cost 100
designated bridge 8000.001217318d3e message age timer 0.00
designated port 8001 forward delay timer 0.00
designated cost 0 hold timer 0.00
flags
eth1 (2)
port id 8002 state forwarding
designated root 8000.001217318d3e path cost 100
designated bridge 8000.001217318d3e message age timer 0.00
designated port 8002 forward delay timer 0.00
designated cost 0 hold timer 0.00
flags
Here we can see that the bridge contains two members, eth0 and vlan0.
Add
To add a interface to a bridge, the command syntax is
brctl addif
Where is the existing bridge name, and ifname is the interface you want to add.
Remove
To remove a interface from a bridge, the syntax is very similar
brctl delif
3. Other Features
There are a few other features that brctl offers, but they are beyond the scope of this page. In order to get a better understanding of them, you should read the brctl Manual Page.
One KEY thing to note is that the brctl commands slightly differ from the man page. Especially the "show" command. The documentation that i suggested recommends "brctl show " but in DD-WRT the proper syntax is "brctl showbr ". If you have any doubts, simply type "brctl" and a list of available commands will be displayed.
4. External Links
阅读(2352) | 评论(0) | 转发(0) |