一.bond接口
-
Red Hat Enterprise Linux 允许管理员使用 bonding 内核模块和称为通道绑定接口的特殊网
络接口将多个网络接口绑定到一个通道。根据选择的绑定模式,通道绑定使两个或更多个网络接口作为一个网络接口,从而增加带宽和 / 提供冗余性。
roundrobin平衡轮询模式:两块网卡轮流接收数据包。由于两块网卡都正常工作,它能提供两倍的带宽,在这种情况下出现一块网卡失效,仅仅会是服务器出口带宽下降,也不会影响网络使用。
activebackup主动备份模式:只有主网卡 eth0 工作,eth1 作为备份网卡是不工作的,只有当一个网络接口失效
时 ( 例如主交换机掉电等 ),为了不会出现网络中断,系统会按照配置指定的网卡
顺序启动工作,保证机器仍能对外服务,起到了失效保护的功能。
broadcast广播容错模式:所有数据包都通过接口广播
1.查看网络配置
一.以命令方式添加
1.添加bond接口
2.查看当前已有的连接名nmcli connection show
3.使用ifconfig命令,查看此bond接口的配置
4.查看虚拟网卡的信息
/proc/net/bonding/bond0
注意:当前此接口没有添加任何的物理设备
5.添加真实设备
nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0 将网卡eth0捆绑到bond0
nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0 将网卡eth1捆绑到bond0
6.查看bond0的信息
7.ping网卡bond0
发现:可以ping通
8.将网卡设备eth0关掉,会发现当前使用的设备变成eth1
ifconfig eth0 down 关闭网卡eth0
9再将eth0开启,当前使用设备仍不变,只有当前使用的eth1关闭后,才会使用eth0
10.将网卡设备eth1关掉,会发现当前使用的设备变成eth0
11.删除网卡
nmcil connection delet bond0 删除虚拟网卡bond0
nmcil connection delet eth0 删除物理网卡配置
nmcil connection delet eth0 删除物理网卡配置
二.使用文件方式配置
1.bond0配置
cd /etc/sysconfig/network-scripts/
vim ifcfg-bond0 写bond0的配置文件
2.物理网卡配置
eth0配置:
eth1配置:
3.重启网络
4.查看bond0的信息
三.team接口
1.team优点
team支持hash功能,支持负载均衡,同时支持ipv6,而bond并不支持这些功能,team接口的配置与bond相似。
2.创建team接口
nmcli connection add con-name team0 ifname team0 type team config '{"runner":{"name":"activebackup"}}' ip4 172.25.254.100/24
3.查看当前已有的连接名
4.添加真实设备
nmcli connection add con-name eth0 ifname eth0 type team-slave master team0
nmcli connection add con-name eth1 ifname eth1 type team-slave master team0
5.查看接口状态
teamdctl team0 stat
6.关闭eth0,使用eth1
四.文件方式进行配置
1.team0配置
cd /etc/sysconfig/network-scripts/
vim ifcfg-team0 写team0的配置文件
2.配置网卡eth0
3.配置网卡eth1
4.重启服务查看