码迷,mamicode.com
首页 > 系统相关 > 详细

Linux bridge

时间:2017-01-18 11:06:14      阅读:509      评论:0      收藏:0      [点我收藏+]

标签:misc   proc   als   eth1   路由转发   work   pre   nbsp   otp   

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     	<bridge>		add bridge
	delbr     	<bridge>		delete bridge
	addif     	<bridge> <device>	add interface to bridge
	delif     	<bridge> <device>	delete interface from bridge
	hairpin   	<bridge> <port> {on|off}	turn hairpin on/off
	setageing 	<bridge> <time>		set ageing time
	setbridgeprio	<bridge> <prio>		set bridge priority
	setfd     	<bridge> <time>		set bridge forward delay
	sethello  	<bridge> <time>		set hello time
	setmaxage 	<bridge> <time>		set max message age
	setpathcost	<bridge> <port> <cost>	set path cost
	setportprio	<bridge> <port> <prio>	set port priority
	show      	[ <bridge> ]		show a list of bridges
	showmacs  	<bridge>		show a list of mac addrs
	showstp   	<bridge>		show bridge stp info
	stp       	<bridge> {on|off}	turn stp on/off

 

Linux bridge

标签:misc   proc   als   eth1   路由转发   work   pre   nbsp   otp   

原文地址:http://www.cnblogs.com/vincenshen/p/6295711.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!