brctl 的使用

brctl  作用: 用来进行以太网桥接(bridge)的管理

主要用法如下:

[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                     // 显示桥接信息
        addbr BRIDGE            Create BRIDGE                         // 增加桥接端口
        delbr BRIDGE            Delete BRIDGE                           // 删除桥接端口
        addif BRIDGE IFACE      Add IFACE to BRIDGE           // 为桥接端口增加绑定接口
        delif BRIDGE IFACE      Delete IFACE from BRIDGE    // 删除桥接端口的绑定接口
        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/off          // 是否参与生成树协议

用法如下:

[email protected]:/# brctl show
bridge name     bridge id               STP enabled     interfaces
br-net          7fff.78c2c0e3004d       yes             eth0
                                                                       wlan0

可以看到,目前的桥接接口名称为br-net, 它绑定了两个端口  eth0 和 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

为桥接接口br-net增加绑定接口 eth1, 增加完后查看到已经绑定成功。

[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

删除桥接接口 br-net 绑定的端口eth1,删除完成后查看已经删除成功。

[email protected]:/# brctl addbr br-lan                                           // 增加了桥接接口"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                                // 新增的桥接接口默认为“未使能”的
[email protected]:/# brctl addif br-lan eth1                                        // 为桥接接口br-lan 绑定端口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                                            // 参与生成树协议
[email protected]:/# brctl show
bridge name     bridge id               STP enabled     interfaces
br-net          7fff.78c2c0e3004d        yes             eth0
                                                                        wlan0
br-lan          8000.78c2c0e3004e       yes             eth1           // 参与生成树协议,接收和发送BPDU(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

直接删除桥接接口“br-lan”,查看结果删除成功。

时间: 2024-08-25 17:21:13

brctl 的使用的相关文章

linux下brctl配置网桥

原文:http://zhumeng8337797.blog.163.com/blog/static/1007689142011643834429/ 先装好网卡,连上网线,这是废话,不用说了.然后开始! 设置linux让网桥运行    配置网桥我们需要让linux知道网桥,首先告诉它,我们想要一个虚拟的以太网桥接口:(这将在主机bridge上执行,不清楚的看看测试场景)[email protected]:~> brctl addbr br0其次,我们不需要STP(生成树协议)等.因为我们只有一个路

使用brctl工具创建桥接设备

创建桥接设备: # yun -y install bridge-utils # brctl addbr br0 # ifconfig -a # ifconfig eth0 0 up # ifconfig -a # brctl addif br0 eth0 # ifconfig br0 192.168.1.122/24 up # route add default gw 192.168.1.1 # brctl show # brctl stp br0 on

linux brctl command not found

[[email protected] ~]# brctl-bash: brctl: command not found 解决方法: [[email protected] ~]# yum install bridge-utils ----------------------------------------------------------------------------------------------------------------------------------------

centos7 配置虚拟交换机(物理交换机truckport设置)(使用brctl)

感谢朋友支持本博客.欢迎共同探讨交流,因为能力和时间有限.错误之处在所难免,欢迎指正! 假设转载,请保留作者信息. 博客地址:http://blog.csdn.net/qq_21398167 原博文地址:http://blog.csdn.net/qq_21398167/article/details/46409503 虚拟交换机配置 inux VLAN配置(vconfig) 安装vlan(vconfig)和载入8021q模块 [[email protected]~]#yum install vc

brctl 使用说明

[[email protected] ~]# brctl --help Usage: brctl [commands] commands:         addbr           <bridge>                add bridge         delbr           <bridge>                delete bridge         addif           <bridge> <device>

Linux 网桥配置命令:brctl

Linux网关模式下将有线LAN和无线LAN共享网段实现局域网内互联: 思路其实很简单:就是将虚拟出一个bridge口,将对应的有线LAN和无线LAN都绑定在这个虚拟bridge口上,并给这个bridge口分配一个地址,其他子网微机配置网关为bridge口的地址便可以了.当然,因为是设备是网关模式,路由和nat也是必须的了.如果设备本身便是网桥模式,那么路由和nat便可以省掉了. brctl addbr bridge brctl addif bridge eth0 brctl addif bri

Linux 网桥配置命令:brctl &nbsp; (2)

brctl 用来管理以太网桥,在内核中建立,维护,检查网桥配置.一个网桥一般用来连接多个不同的网络,这样这些不同的网络就可以像一个网络那样进行通讯. 网桥是一种在链路层实现中继,对帧进行转发的技术,根据MAC分区块,可隔离碰撞,将网络的多个网段在数据链路层连接起来的网络设备.网桥工作在数据链路层,将两个LAN连起来,根据MAC地址来转发帧,可以看作一个"底层的路由器" 在网桥上每个以太网连接可以对应到一个物理接口,这些以太网借口组合成一个大的逻辑的接口,这个逻辑接口对应于桥接网络. b

brctl命令

有五台主机.其中一台主机装有linux ,安装了网桥模块,而且有四块物理网卡,分别连接同一网段的其他主机.我们希望其成为一个网桥,为其他四台主机(IP分别为192.168.1.2 ,192.168.1.3,192.168.1.4,192.168.1.5) 之间转发数据包.同时,为了方便管理,希望网桥能够有一个IP(192.168.1.1),那样管理员就可以在192.168.1.0/24网段内的主机上telnet到网桥,对其进行配置,实现远程管理. 前一节中提到,网桥在同一个逻辑网段转发数据包.针

桥接 brctl

把eth0和wlan0桥接在一起 作用:测试wlan0网卡的并发性能   两个网卡桥接后把linux主机模拟成一个“无线路由交换机” Vi   br0.sh #!/bin/bash ifconfig eth0 0.0.0.0 up    #取消eth0的ip ifconfig wlan0 0.0.0.0 up brctl addbr br0 #添加一个网桥 即逻辑网段   br0名字任意  delbr br0删除网桥 sudo brctl addif br0 wlan0   #将wlan0加到网