首先上层交换机的网口必须要设置成trunk模式的。
然后具体的配置如下:
具体配置如下:
[root@localhost network-scripts]# cat ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=fb6e0d7b-9ac4-490b-bba9-e1892737ea7a
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
HWADDR=3C:A8:2A:0A:CF:F0
NAME="System eth0"
MASTER=bond0
SLAVE=yes
#IPADDR=20.223.0.5
#GATEWAY=20.223.0.14
#NETMASK=255.255.255.240
#BRIDGE=br0
USERCTL=no
[root@localhost network-scripts]# cat ifcfg-eth1
DEVICE=eth1
HWADDR=3C:A8:2A:0A:CF:F1
TYPE=Ethernet
UUID=e546cb00-d77f-4100-982e-6b044bbd8bb0
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
MASTER=bond0
SLAVE=yes
USERCTL=no
[root@localhost network-scripts]# cat ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
USERCTL=no
[root@localhost network-scripts]# cat ifcfg-bond0.202
DEVICE=bond0.202
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
VLAN=yes
BRIDGE=br202
[root@localhost network-scripts]# cat ifcfg-bond0.203
DEVICE=bond0.203
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
VLAN=yes
BRIDGE=br203
[root@localhost network-scripts]# cat ifcfg-bond0.204
DEVICE=bond0.204
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
VLAN=yes
BRIDGE=br204
[root@localhost network-scripts]# cat ifcfg-bond0.205
DEVICE=bond0.205
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
VLAN=yes
BRIDGE=br205
[root@localhost network-scripts]# cat ifcfg-br202
DEVICE=br202
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
TYPE=Bridge
VLAN=yes
IPADDR=20.223.0.27
NETMASK=255.255.255.240
GATEWAY=20.223.0.30
[root@localhost network-scripts]# cat ifcfg-br203
DEVICE=br203
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
TYPE=Bridge
VLAN=yes
IPADDR=20.223.0.44
NETMASK=255.255.255.224
GATEWAY=20.223.0.62
[root@localhost network-scripts]# cat ifcfg-br204
DEVICE=br204
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
TYPE=Bridge
VLAN=yes
IPADDR=20.223.0.89
NETMASK=255.255.255.224
GATEWAY=20.223.0.94
[root@localhost network-scripts]# cat ifcfg-br205
DEVICE=br205
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
TYPE=Bridge
VLAN=yes
IPADDR=20.223.0.108
NETMASK=255.255.255.240
GATEWAY=20.223.0.110
其中bond配置文件
/etc/modprobe.d/bonding.conf
[root@localhost modprobe.d]# cat bonding.conf
alias bond0 bonding
options bond0 miimon=100 mode=1
另外说明,因为在桥接上面配置4个地址,那物理机的地址貌似是随机的,并不是四个网桥地址都通,所以一个一个试,试到其中一个行,那就是物理地址了,我也不知道为啥这样