linux bridge监控,Linux bridge

CentOS bridge 配置:

1、创建br0配置文件

touch /etc/sysconfig/network-scripts/ifcfg-br0

2、修改bro配置文件

vi /etc/sysconfig/network-scripts/ifcfg-br0

DEVICE=br0

TYPE=Bridge

BOOTPROTO=static

IPADDR=0.0.0.0

ONBOOT=yes

3、添加网卡到网桥

vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0 # 把eth0添加到网桥中

TYPE=Ethernet

BOOTPROTO=static

IPADDR=0.0.0.0

ONBOOT=yes

BRIDGE=br0

Ubuntu bridge配置:

root@ubuntu~#vim /etc/network/interfaces

auto lo eth0 eth1 br0

iface lo inet loopback

iface br0 inet static

address 10.10.10.1

netmask 255.255.0.0

gateway 10.10.10.254

pre-up ip link set eth0 promisc on #设置混杂模式

pre-up ip link set eth1 promisc on

pre-up echo "1">/proc/sys/net/ipv4/ip_forward #启用路由转发

bridge_stp off #关闭生成树

bridge_ports eth0 eth1

brctl 命令集

root@Openstack001:~# brctl

Usage: brctl [commands]

commands:

addbr add bridge

delbr delete bridge

addif add interface to bridge

delif delete interface from bridge

hairpin {on|off}turn hairpin on/off

setageing set ageing time

setbridgeprioset bridge priority

setfd set bridge forward delay

sethello set hello time

setmaxage set max message age

setpathcostset path cost

setportprioset port priority

show [ ]show a list of bridges

showmacs show a list of mac addrs

showstp show bridge stp info

stp {on|off}turn stp on/off