实验条件:服务器物理机两个网口(eno4管理口---交换机access,eno5链路聚合以及虚拟机出口,可多个网口做聚合----交换机网口更trunk)
1 首先更改eno5配置 同理,其他端口可同样操作(对应交换机为trunk,否则vlan之间无法通信)
vi /etc/sysconfig/network-scripts/ifcfg-eno5
TYPE=Ethernet
BOOTPROTO=none
NAME=eno5
DEVICE=eno5
ONBOOT=yes
MASTER=bond0
SLAVE=YES
2 创建master=bond0
vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
TYPE=Bond
NAME=bond0
BONDING_MASTER=yes
BOOTPROTO=static
USERCTL=no
ONBOOT=yes
BONDING_OPTS="mode=6 miimon=100"
BRIDGE=br0
3 搭建桥br0
vi ifcfg-br0
TYPE=Bridge
DEVICE=br0
ONBOOT=yes
BOOTPROTO=static
NAME=br0
4 可查看bond状态
cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: adaptive load balancing
Primary Slave: None
Currently Active Slave: eno5
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eno5
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 6c:ae:8b:40:65:15
Slave queue ID: 0
5 至此链路绑定完成,创建不同vlan10 同理创建vlan12
cat ifcfg-br0.10
DEVICE="br0.10"
VLAN="yes"
ONBOOT="yes"
BOOTPROTO="none"
BRIDGE=brvlan-10
cat ifcfg-brvlan-10
YPE=bridge
BOOTPROTO=static
NAME=brvlan-10
DEVICE=brvlan-10
ONBOOT=yes
IPADDR=10.128.0.96
PREFIX=24
GATEWAY=10.128.0.1
6 重启网络,并查看状态
systemctl restart network
brctl show
显示正常
br0 8000.6cae8b406515 no bond0
brvlan-10 8000.6cae8b406515 no br0.10
brvlan-12 8000.6cae8b406515 no br0.12
virbr0 8000.525400de92ad yes virbr0-nic
7 将虚机的网口挂载对应的vlan桥上
brctl addif brvlan-10 vnet0
brctl addif brvlan-12 vnet1
brctl show
#vnet0 为vlan10下的ip 10.128.0.96
#vnet1 为vlan12下的ip 10.128.2.10
bridge name bridge id STP enabled interfaces
br0 8000.6cae8b406515 no bond0
brvlan-10 8000.6cae8b406515 no br0.10
vnet0
brvlan-12 8000.6cae8b406515 no br0.12
vnet1
virbr0 8000.525400de92ad yes virbr0-nic
8 至此,环境搭建完毕,链路聚合,并且划分了不同的vlan