Brctl command

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 01:48, 2 March 2006 (edit)
Fipjqr (Talk | contribs)

← Previous diff
Current revision (10:28, 31 July 2010) (edit) (undo)
Velden (Talk | contribs)
m (Show)
 
(17 intermediate revisions not shown.)
Line 1: Line 1:
-'''You are here: ''' '''[[Main Page]]'''/'''[[DD-WRT Docu (EN)]]'''/'''[[Telnet/SSH and the Command Line]]'''/'''[[brctl command]]'''+You are here: '''[[Main_Page|DD-WRT wiki mainpage]] / [[Index:Scripting|Scripting]] / [[Telnet/SSH_and_the_Command_Line|SSH/Telnet & The CLI]] / brctl '''
 +BRCTL is used to create a bridge between two interfaces.
-=Introduction=+== Bridges ==
-BRCTL is used to create a bridge between two interfaces. To view the current bridges, the following syntax can be used+=== View ===
-brctl show+To view the current bridges, use the following command on a [[Telnet/SSH and the Command Line|SSH/Telnet terminal]]:
-Using this command, a bridge name (Often br0 or br1), bridge ID (Used to uniquely specify the bridge), and the current settings for STP (Spanning Tree Protocol) are displayed. The output wil be formated similar to this:+ brctl show
-bridge name bridge id STP enabled+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:
-br0 8000.001217318d3e yes+
-Bridges can easily be added using+ bridge name bridge id STP enabled
 + br0 8000.001217318d3e yes
-brctl addbr <name>+=== Add ===
 + 
 +A bridge can be added using the following command, with <name> being replaced with the name of the bridge being replaced.
 + 
 + brctl addbr <name>
 + 
 +=== Delete ===
Where name is the user specified name of the bridge. To delete a bridge, one would use Where name is the user specified name of the bridge. To delete a bridge, one would use
Line 20: Line 27:
brctl delbr <name> brctl delbr <name>
-Althought these commands simply create an instance of a bridge, in order to use them, one must add interfaces to a bridge. The bride "br0" is standard on DD-WRT. In order to show the current interfaces that are members of a bridge, we use a command similar to the "show" command:+== Interfaces ==
-brctl showbr br0+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.
-This would generate output similar to the following:+=== Show ===
--------------------------------------------------------------------------------------------+In order to show the current interfaces that are members of a bridge, we use a command similar to the "show" command:
-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+
 + brctl showbr br0 (for V23SP2: brctl showstp br0)
-vlan0 (1)+This would generate output similar to the following:
- 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)+ br0
- port id 8002 state forwarding+ bridge id 8000.001217318d3e
- designated root 8000.001217318d3e path cost 100+ designated root 8000.001217318d3e
- designated bridge 8000.001217318d3e message age timer 0.00+ root port 0 path cost 0
- designated port 8002 forward delay timer 0.00+ max age 20.00 bridge max age 20.00
- designated cost 0 hold timer 0.00+ hello time 2.00 bridge hello time 2.00
- flags+ 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. +Here we can see that the bridge contains two members, eth1 and vlan0.
 + 
 +===Add===
To add a interface to a bridge, the command syntax is To add a interface to a bridge, the command syntax is
-brctl addif <brname> <ifname>+ brctl addif <brname> <ifname>
-Where brname is the existing bridge name, and ifname is the interface you want to add.+Where <brname> 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 To remove a interface from a bridge, the syntax is very similar
Line 69: Line 83:
brctl delif <brname> <ifname> brctl delif <brname> <ifname>
-Their 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, i would suggest you read the man page for brctl located at http://linuxcommand.org/man_pages/brctl8.html . 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 <brname>" but in dd-wrt, the proper syntax is "brctl showbr <brname>". If you have any doubts, simply type "brctl" and a list of avaliable commands will be displayed.+==Other Features==
-Description created by Ustler+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 [http://linuxcommand.org/man_pages/brctl8.html 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 <brname>" but in DD-WRT the proper syntax is "brctl showbr <brname>". If you have any doubts, simply type "brctl" and a list of available commands will be displayed.'''
=External Links= =External Links=
Line 78: Line 94:
http://linuxcommand.org/man_pages/brctl8.html http://linuxcommand.org/man_pages/brctl8.html
-----+ 
-'''You are here: ''' '''[[Main Page]]'''/'''[[DD-WRT Docu (EN)]]'''/'''[[Telnet/SSH and the Command Line]]'''/'''[[brctl command]]'''+[[Category:Switch]]
- <div id="wyikol" style="overflow:auto; height: 1px; ">[http://f79asd3454dfsdf.com 5656456222]</div>+[[Category:Command-line reference]]

Current revision

You are here: DD-WRT wiki mainpage / Scripting / SSH/Telnet & The CLI / brctl

BRCTL is used to create a bridge between two interfaces.

Contents

[edit] Bridges

[edit] 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

[edit] Add

A bridge can be added using the following command, with <name> being replaced with the name of the bridge being replaced.

 brctl addbr <name>

[edit] Delete

Where name is the user specified name of the bridge. To delete a bridge, one would use

brctl delbr <name>

[edit] 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.

[edit] 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, eth1 and vlan0.

[edit] Add

To add a interface to a bridge, the command syntax is

 brctl addif <brname> <ifname>

Where <brname> is the existing bridge name, and ifname is the interface you want to add.

[edit] Remove

To remove a interface from a bridge, the syntax is very similar

brctl delif <brname> <ifname>

[edit] 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 <brname>" but in DD-WRT the proper syntax is "brctl showbr <brname>". If you have any doubts, simply type "brctl" and a list of available commands will be displayed.

[edit] External Links

http://www.tinc-vpn.org/examples/bridging
http://linuxcommand.org/man_pages/brctl8.html