Chinaunix首页 | 论坛 | 博客
  • 博客访问: 360880
  • 博文数量: 86
  • 博客积分: 1460
  • 博客等级: 上尉
  • 技术积分: 848
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-12 14:07
文章分类

全部博文(86)

文章存档

2017年(36)

2016年(17)

2015年(1)

2013年(12)

2012年(2)

2011年(1)

2010年(1)

2009年(16)

我的朋友

分类: LINUX

2013-11-20 13:57:39

KVM或者xen 虚拟化配置网络会用到的命令,Ubuntu系统下面是bridge-utils包

Name

brctl - ethernet bridge administration

Synopsis

brctl [command]

Description

 
brctl is used to set up, maintain, and inspect the ethernet bridge configuration in the linux kernel.

An ethernet bridge is a device commonly used to connect different networks of ethernets together, so that these ethernets will appear as one ethernet to the participants.

Each of the ethernets being connected corresponds to one physical interface in the bridge. These individual ethernets are bundled into one bigger ('logical') ethernet, this bigger ethernet corresponds to the bridge network interface.

Instances

The command brctl addbr creates a new instance of the ethernet bridge. The network interface corresponding to the bridge will be called .

The command brctl delbr deletes the instance of the ethernet bridge. The network interface corresponding to the bridge must be down before it can be deleted!

The command brctl show shows all current instances of the ethernet bridge.

Ports

Each bridge has a number of ports attached to it. Network traffic coming in on any of these ports will be forwarded to the other ports transparently, so that the bridge is invisible to the rest of the network (i.e. it will not show up in (8) ).

The command brctl addif will make the interface a port of the bridge . This means that all frames received on will be processed as if destined for the bridge. Also, when sending frames on , will be considered as a potential output interface.

The command brctl delif will detach the interface from the bridge .

The command brctl show will show some information on the bridge and its attached ports.

Ageing

The bridge keeps track of ethernet addresses seen on each port. When it needs to forward a frame, and it happens to know on which port the destination ethernet address (specified in the frame) is located, it can 'cheat' by forwarding the frame to that port only, thus saving a lot of redundant copies and transmits.

However, the ethernet address location data is not static data. Machines can move to other ports, network cards can be replaced (which changes the machine's ethernet address), etc.

brctl showmacs shows a list of learned MAC addresses for this bridge.

brctl setageingtime sets the ethernet (MAC) address ageing time, in seconds. After

brctl setgcint sets the garbage collection interval for the bridge to

Spanning Tree Protocol

Multiple ethernet bridges can work together to create even larger networks of ethernets using the IEEE 802.1d spanning tree protocol. This protocol is used for finding the shortest path between two ethernets, and for eliminating loops from the topology. As this protocol is a standard, linux bridges will interwork properly with other third party bridge products. Bridges communicate with eachother by sending and receiving BPDUs (Bridge Protocol Data Units). These BPDUs can be recognised by an ethernet destination address of 01:80:c2:00:00:00.

The spanning tree protocol can also be turned off (for those situations where it just doesn't make sense, for example when this linux box is the only bridge on the LAN, or when you know that there are no loops in the topology.)

brctl(8) can be used for configuring certain spanning tree protocol parameters. For an explanation of these parameters, see the IEEE 802.1d specification (or send me an email). The default values should be just fine. If you don't know what these parameters mean, you probably won't feel the desire to tweak them.

brctl stp controls this bridge instance's participation in the spanning tree protocol. If is "on" or "yes" the STP will be turned on, otherwise it will be turned off. When turned off, the bridge will not send or receive BPDUs, and will thus not participate in the spanning tree protocol. If your bridge isn't the only bridge on the LAN, or if there are loops in the LAN's topology, DO NOT turn this option off. If you turn this option off, please know what you are doing.

brctl setbridgeprio sets the bridge's priority to . The priority value is an unsigned 16-bit quantity (a number between 0 and 65535), and has no dimension. Lower priority values are 'better'. The bridge with the lowest priority will be elected 'root bridge'.

brctl setfd sets the bridge's 'bridge forward delay' to

brctl sethello sets the bridge's 'bridge hello time' to

brctl setmaxage sets the bridge's 'maximum message age' to

brctl setpathcost sets the port cost of the port to . This is a dimensionless metric.

brctl setportprio sets the port 's priority to . The priority value is an unsigned 8-bit quantity (a number between 0 and 255), and has no dimension. This metric is used in the designated port and root port selection algorithms.

brctl sethashel sets the 'hash elasticity' to .

brctl sethashmax sets 'hash max' to .

brctl setmclmc sets the 'multicast last member count' to .

brctl setmcrouter sets 'multicast router' to .

brctl setmcsnoop sets 'multicast snooping' to .

brctl setmcsqc sets the 'multicast startup query count' to .

brctl setmclmi sets the 'multicast last member interval' to

brctl setmcmi sets the 'multicast membership interval' to

brctl setmcqpi sets the 'multicast querier interval' to

brctl setmcqi sets the 'multicast query interval' to

brctl setmcqri sets the 'multicast query response interval' to

brctl setmcqri sets the 'multicast startup query interval' to

brctl setportmcrouter sets port for multicast router .

Notes

brctl(8) replaces the older brcfg tool.

See Also

ipchains(8), (8)

Author

Lennert Buytenhek <>

Referenced By

(8), (8)


Usage: brctl [commands]
commands:
 addbr        add bridge
 delbr        delete bridge
 addif        add interface to bridge
 delif        delete interface from bridge
 setageing  
 setbridgeprio    set bridge priority
 setfd      
 sethello   
 setmaxage  
 setpathcost   set path cost
 setportprio   set 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
 
阅读(3191) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~