万兆网里面的单位是位,8位为1字节。10000M/8=1250M 大约为1G ##平时,办理的百兆网实际速度 100M/8=12.5M
1.链路聚合的作用
一个设备如果只有一个网卡,那么当这个网卡损坏时,设备的网络就会瘫痪。绑定接口的作用就是让多个物理网卡服务于一个IP地址,使得这个网络的抵抗性强。
一个设备只能有一个bond接口
配置好以后每个网卡需要一根网线,需要插两个网线,交换机也需要作链路聚合,这是cca的工作。
2.bond的设置方法
1).使用命令的方式,设置bond
实验环境:一个主机上至少有两个网卡
步骤一:监控watch -n 1 cat /proc/net/bonding/bond0
##现在还没有,等步骤二结束以后才会有bond0
步骤二:添加链路聚合
nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.152/24
监控:
两种模式:active-backup:特点(备用 稳定) 和balance-rr(轮流 快)
步骤三:给链路聚合添加设备,这里添加两个。
nmcli connection add con-name eth0 ifname etho type bond-slave master bond0
nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0
步骤四:观察实验结果
1.关闭eth0,模仿eth0坏掉
ifconfig eth0 down
观察此时,其作用的网卡为eth1.
2.开启eth0,模仿eth0修好。
ifconfig eth0 up
观察此时,其作用的网卡依旧是eth1,但是eth0是备用状态这就是active-backup的特点。
2).手动编写bond的配置文件,设置bond
步骤一:编写绑定接口文件
在/etc/sysconfig/network-scripts/目录下,编写ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.152
NETMASK=24
TYPE=Bond
BONDING_OPTS=mode=active-backup
观察
步骤二:编写绑定接口设备的配置文件。
编写ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
编写ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
步骤三:观察实验结果
使用ifconfig eth0 down ##假设eth0网卡坏掉了
使用ifconfig eth0 up ##假设eth0网卡修好了
此时,起作用的是eth1网卡。
3.bond与team
team新的链路聚合的软件。
team与bond的主要区别
bond team
hash加密 no yes
负载均衡 no yes
对IPV6 差 好
##均衡负载的意思是:每个网卡执行一个任务。 在team中,如果某一个网卡的一个任务过大,另一个网卡会自动多作几次任务。
4.team的设置方式
1).使用命令的方式,设置team
步骤一:监控 watch -n 1 teamdctl team0 stat
步骤二:添加team链路聚合
nmcli connection add con-name team0 ifname team0 type team config '{"runner":{"name":"activebackup"}}' ip4 172.25.254.152/24
步骤三:给链路聚合添加设备,这里添加两个。
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
步骤四:观察实验结果
使用ifconfig eth0 down ##假设eth0网卡坏掉了
使用ifconfig eth0 up ##假设eth0网卡修好了
此时,起作用的是eth1网卡。
2).手动编写team的配置文件,设置ream
步骤一:编写绑定接口文件
在/etc/sysconfig/network-scripts/目录下,编写ifcfg-team0
DEVICE=team0
TEAM_CONFIG="{\"runner\":{\"name\":\"activebackup\"}}"
DEVICETYPE=Team
BOOTPROTO=none
IPADDR0=172.25.254.152
PREFIX0=24
NAME=team0
ONBOOT=yes
步骤二:编写绑定接口设备的配置文件。
编写ifcfg-eth0
BOOTPROTO=none
DEVICE=eth0
ONBOOT=yes
TEAM_MASTER=team0
DEVICETYPE=TeamPort
编写ifcfg-eth1
BOOTPROTO=none
DEVICE=eth1
ONBOOT=yes
TEAM_MASTER=team0
DEVICETYPE=TeamPort
步骤三:观察实验结果
使用ifconfig eth0 down ##假设eth0网卡坏掉了
使用ifconfig eth0 up ##假设eth0网卡修好了
此时,起作用的是eth1网卡。