####链路聚合####
链路聚合是指将两个或更多的数据信道结合成一个单个的信道,该信道以一个单一的更高带宽的逻辑链路出现,
链路聚合能够提高链路带宽,增强网络可用性,支持负载分担。
##1.bond##
1删除全部网络配置
nm-connection-editor ##删除ip##
nmcil connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.150 ##添加bond0##
ifconfig ##查看ip##
nmcil connection add con-name eth0 ifname eth0 type bond-slave master bond0 ##插入eth0和eth1两块网卡##
nmcil connection add con-name eth1 ifname eth1 type bond-slave master bond0
watch -n 1 cat /proc/net/bonding/bond0 ##实施监控##
2分别写bond0和eth0的配置文件,复制eth0为eth1,之后查看/proc/net/bonding/bond0目录下的状态
注意:bond最多可以添加两个网卡,team可以添加八个网卡
cd /etc/sysconfig/network-scripts ##cd到此路径下##
vim ifcfg-bond0 ##写bond0配置文件##
vim ifcfg-eth0 ##写eth0配置文件##
cp ifcfg-eth0 ifcfg-eth1 ##给eth1复制eth0的配置文件##
vim ifcfg-eth1 ##修改eth1的配置文件##
systemctl restart network ##重启网络##
##2.team##
1.team服务,首先nm-connection-editor删除网络配置
之后添加team0,注意命令格式写正确。之后输入watch -n 1 teamdctl team0 stat监控team0,可以看到程序活跃但是没有网卡,之后添加eth0与eth1,可以在监控处看见eth0与eth1均为up状态
nm-connection-editor 删除其他网络配置
nmcli connection add con-name team0 ifname team0 type team config '{“runner”:{“name”:“activebackup”}}‘ip4 172.25.254.150/24##增加team##
打开另以shell输入watch -n 1 teamdctl team0 stat可以看到team开启成功,但是没有添加网卡
nmcli connection add con-name eht0 ifname eth0 type team-slave master team0 ##添加eth0网卡##
nmcli connection add con-name eht1 ifname eth1 type team-slave master team0 ##添加eth1网卡##
可以在监控出看到两块网卡已经被添加
通过修改文件开启team
nm-connection-editor 删除其他网络配置
cd /etc/sysconfig/network-scripts 切换到此目录下
vim ifcfg-team0 写team0的配置文件##
vim ifcfg-eth0 写eth0的配置文件
cp ifcfg-eth0 ifcfg-eth1 复制eth0为eth1
vim ifcfg-eth1 修改eth1的配置文件
systemctl restart network 重启网络服务
systemctl restart NetworkManage 重启网络服务
##3.桥接##
cd /etc/sysconfig/network-scripts ##切换到此路径下##
ls ##查看设备,此时无br0与enp0s25##
vim ifcfg-enp0s25 ##写enp0s25配置文件#
vim ifcfg-br0 ##写br0的文件##
systemctl stop NetworkManage.service ##停止网络服务##
systemctl restart NetworkManage.service ##重启网络服务##
通过指令实现桥接
brctl addbr br0 ##添加br0##
ifconfig br0 172.25.254.152/24 ##给br0赋予ip##
ifconfig ##查看有无br0##
brctl show ##查看桥接设备,此时br0已经出现,但是并无真实的接口##
brctl addif bro eth0 ##将br0插在eth0##
brctl show ##查看br0是否挂在了eth0上##
删除桥接
ifconfig br0 down ##让br0停止工作##
brctl delif br0 eth0 ##将br0在eth0上拔下##
brctl delbr br0 ##删除br0##