br桥接网络配置
生产中通常使用方式
具体配置
[root@centos_13 network-scripts]# ll ifcfg-*
-rw-r--r-- 1 root root 115 Mar 18 14:30 ifcfg-bond0
-rw-r--r-- 1 root root 115 Mar 18 14:35 ifcfg-bond1
-rw-r--r-- 1 root root 128 Mar 18 14:38 ifcfg-br0
-rw-r--r-- 1 root root 91 Mar 18 14:36 ifcfg-br1
-rw-r--r-- 1 root root 70 Mar 18 14:28 ifcfg-eth0
-rw-r--r-- 1 root root 70 Mar 18 14:28 ifcfg-eth1
-rw-r--r-- 1 root root 70 Mar 18 14:34 ifcfg-eth2
-rw-r--r-- 1 root root 70 Mar 18 14:34 ifcfg-eth3
-rw-r--r--. 1 root root 254 Mar 29 2019 ifcfg-lo
1.eth0
[root@centos_13 network-scripts]# vim ifcfg-eth0
DEFROUTE=yes
DEVICE=eth0
ONBOOT=yes
MASTER=bond0
USERCTL=no
SLAVE=yes
2.eth1
[root@centos_13 network-scripts]# vim ifcfg-eth1
DEFROUTE=yes
DEVICE=eth1
ONBOOT=yes
MASTER=bond0
USERCTL=no
SLAVE=yes
eth0和eth1绑定为bond0
3.bond0
[root@centos_13 network-scripts]# vim ifcfg-bond0
BOOTPROTO=static
NAME=bond0
DEVICE=bond0
ONBOOT=yes
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100"
BRIDGE=br0
mode:是bonding的模式,用哪种,填哪种;
模式:
mode 0 (balance-rr)
轮转策略:从头到尾顺序的在每一个slave接口上发送数据包,本模式提供负载均衡和容错的能力
mode 1 (active-backup)
活动-备份策略:只有一个slave被激活,当活动的slave接口失效时才会激活其他slave,为了避免交换机发生混乱此时绑定的MAC地址只有一个外部端口可见
mode 3 (broadcast)
广播策略:在所有slave接口上传送所有数据报,提供容错能力
注意:active-backup、balance-tlb、balance-alb模式不需要交换机的任何特殊配置,其他的绑定模式需要配置交换机以便整合连接,如思科交换机在模式0、2、3中使用etherchanne,但在模式4中需要LACP和etherchannel
miimion:是多网卡之间经过多长时间互相发送一个报文,测一下对方是否工作正常,如有损坏,立马接替工作;
BRIDGE=br0:桥接到br0
4.br0
[root@centos_13 network-scripts]# vim ifcfg-br0
TYPE=Bridge
BOOTPROTO=static
NAME=br0
DEVICE=br0
ONBOOT=yes
IPADDR=192.168.0.200
PREFIX=24
GATEWAY=192.168.0.1
DNS1=192.168.0.1
TYPE=Bridge:类型一定要对,表示为桥接模式
第二个仅主机配置基本相同
1.eth2
[root@centos_13 network-scripts]# vim ifcfg-eth2
DEFROUTE=yes
DEVICE=eth2
ONBOOT=yes
MASTER=bond1
USERCTL=no
SLAVE=yes
2.eth3
[root@centos_13 network-scripts]# vim ifcfg-eth3
DEFROUTE=yes
DEVICE=eth3
ONBOOT=yes
MASTER=bond1
USERCTL=no
SLAVE=yes
3.bond1
[root@centos_13 network-scripts]# vim ifcfg-bond1
BOOTPROTO=static
NAME=bond1
DEVICE=bond1
ONBOOT=yes
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100"
BRIDGE=br1
4.br1
[root@centos_13 network-scripts]# vim ifcfg-br1
TYPE=Bridge
BOOTPROTO=static
NAME=br1
DEVICE=br1
ONBOOT=yes
IPADDR=192.168.40.13
PREFIX=24