Brctl command

本文详细介绍了DD-WRT固件中brctl命令的使用方法,包括创建、查看和删除桥接,以及如何添加和移除接口。brctl是用于在两个接口间建立桥接的关键工具,适用于网络配置和管理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Brctl command

From DD-WRT Wiki

Jump to: navigation, search

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

BRCTL is used to create a bridge between two interfaces.

Contents
[ hide]

[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, eth0 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

Retrieved from "http://www.dd-wrt.com/wiki/index.php/Brctl_command"

转载于:https://www.cnblogs.com/fanzi2009/archive/2010/03/02/1676574.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值