网卡的链路聚合
物理网卡总是会坏的,为了保证工作的连续性,我们可以将两块物理网卡绑定成一块。这就是网卡的链路聚合。网卡的链路聚合可有效的防止因网卡损坏带来的损失,同时也可以提高网络访问速
网卡的链路聚合一般常用的有"bond"和"team"两种模式,"bond"模式最多可以添加两块网卡,"team"模式最多可以添加八块网卡。

网卡bond
主机应该拥有至少两块网卡,没有的话手动添加。
添加网卡
nmcli connection show 查看已经存在的ip链接
nmcli connection delete xxxx1 xxx2 xx3 删除所有链接
nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.110/24 添加主备模式bond接口
nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0 添加网卡eth0
nmcli connection add eth1 ifname eth1 type bond-slave master bond0 添加网卡eth1

5.打开一个shell watch -n 1 cat /proc/net/bonding/bond0 此完整目录只有在添加bond0之后才会出现
6.打开一个shell ping 172.25.254.2
ifconfig eth0 down 关闭eth0
ifconfig eth0 up
ifconfig eth1 down 关闭eth1

mode:网卡阵列类型
active-backup ##主备式,一个网卡工作,另一网卡备用;当一个宕掉另一个马上由备份转换为主设备
active-rr ##轮询式,传输数据包顺序是依次传输,你一个,我一个;
链路负载均衡,增加带宽,支持容错,一条链路故障会自动切换正常链路
balance-xor ##平衡策略,表示XOR Hash负载分担,和交换机的聚合强制不协商方式配合; 此模式提供负载平衡和容错能力
broadcast ##广播策略,表示所有包从所有网络接口发出,这个不均衡,只有冗余机制,但过于浪费资源; 在每个slave接口上传输每个数据包,此模式提供了容错能力
team聚合
将上一个实验所建立的链接删除
nmcli connection show
nmcli connection delete xxx1 xxx2
1.nmcli connection add con-name team0 ifname team0 type team config ‘{“runner”:{“name”:“activebackup”}}’ ip4 172.25.254.210/24 #添加team0
2.ifconfig 查看 设置监控和测试
3.watch -n teamd ctl team0 state
4.ping 172.25.254.2
5.nmcli connection add con-name eth0 ifname eth0 type team-slave master team0 添加网卡
6.nmcli connection add con-name eth1 ifname eth1 type team-slave master team0



添加接口 真实网卡
brctl addif br0 eth0
brctl show
ping 172.25.254.2
删除桥接网卡:
停止 br0
ifconfig br0 dow

删除br0
brctl delif br0 eth0 从eth0上把br0卸载下来
brctl show
brctl delbr br0 删除它br0
brctl show
ping 172.25.254.2
添加的接口是真实存在的物理设备
2万+

被折叠的 条评论
为什么被折叠?



