CentOS 7 链路聚合
1、配置链路聚合
聚合连接(team):网络连接的捆绑、组团(多个网卡组成一个连接)
成员网卡(team-slave):构建聚合连接的实际网卡设备
1.1、聚合连接的类型
热备份 activebackup
轮询负载均衡 roundrobin
1.2、聚合连接的类型时,采用JSON语法标记**
JavaScript Object Notation
标记一个对象 —— { 对象 }
每一个对象 —— 名称:值
每一个字符串 —— “字符串”
热备份配置: { “runner”:{ “name”:“activebackup” } }
轮询配置: { “runner”:{ “name”:“roundrobin” } }
配置:nmcli(命令)、nm-connection-editor(图形)
2、网络连接配置
使用nmcli配置网卡
1)为虚拟机添加两块网卡 eth2、eth3
#nmcli connection show
2)创建新的聚合连接(聚合类型)
#nmcli con add con-name team0 type team ifname team0 config ‘{ “runner”:{ “name”:“activebackup” } }’
3)为聚合连接指定成员网卡
#nmcli con add con-name team0-p1 type team-slave ifname eth2 master team0
#nmcli con add con-name team0-p2 type team-slave ifname eth3 master team0
4)为聚合连接配置IP地址,DNS
#nmcli con modify team0 ipv4.method manual ipv4.addresses “192.168.5.110/24” ipv4.dns “192.168.5.1 8.8.8.8”
5)激活聚合连接(及成员网卡)
#nmcli con up team0
#nmcli con up team0-p1
#nmcli con up team0-p2
6)确认状态
#teamdctl team0 state
#teamnl team0 ports
#teamnl team0 options
7)测试
开启一个ping 窗口,并禁用team0中的其中的一块网卡
#nmcli device disconnect eth2
#nmcli device disconnect eth3
#nmcli con up team0-p1
#nmcli con up team0-p2