Linux多网卡的bond模式原理

Linux多网卡绑定

​ 网卡绑定mode共有7种: bond0,bond1,bond2,bond3,bond4,bond5,bond6

常用的有三种:

​ mode=0: 平衡负载模式,有自动备援,但需要“Switch”配置聚合

​ 特点: 传输数据包顺序是依次传输,此模式提供负载容错能力,

​ 缺点: 客户端很有可能出现数据包无序到达的问题,无序到达的包需要重新发送,这样网络吞吐量会下降

​ mode=1: 主备模式,只有一块网卡是active,另一块网卡是standby,所有流量都在active链路处理

​ 特点: 只有一个设备处在活动状态,当一个宕掉另一个马上由备转为主设备。此模式提供容错能力,可以 提高网络连接的可用性。

​ 缺点: 资源利用率低

​ mode = 6:平衡负载模式,有自动备援,不需要在“Switch”额外做配置

Linux双网卡bond1 绑定

第一步,配置设定文件:

/etc/sysconfig/network-scripts/ifcfg-bond0

TYPE=bond
BOOTPROTO=none
NAME=bond0
DEVICE=bond0
ONBOOT=yes
IPADDR=192.168.167.10
NETMASK=255.255.255.0
GATEWAY=192.168.167.1
BONDING_OPTS="mode=1 miimon=100"


/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

/etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

重启一下网络,然后确认一下状况:

[root@test ~]# /etc/init.d/network restart

[root@test ~]# cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)

Bonding Mode: fault-tolerance (active-backup)

Primary Slave: None

Currently Active Slave: eth0

……

 [root@test ~]# ifconfig | grep HWaddr

bond0 Link encap:Ethernet HWaddr 00:16:36:1B:BB:74

eth0 Link encap:Ethernet HWaddr 00:16:36:1B:BB:74

eth1 Link encap:Ethernet HWaddr 00:16:36:1B:BB:74

posted on 2021-09-15 22:06  杨小杨~  阅读(566)  评论(0)    收藏  举报

导航