CentOS 7 多网卡绑定 bond
时间:2016-01-30 14:14 来源:linux.it.net.cn 作者:it.net.cn
# 概念
服务器存在多块网卡时,可以通过bond来实现多块网卡并在一起使用;
# 模式
mode 0:load balancing (round-robin)
Support:需要Switch支持 <H3C5510支持>
负载均衡<IN/OUT>:是
冗余:是
bond MAC: 所有slave MAC相同
工作模式:Transmit packets in sequential order from the first available slave through the last.
mode 1: fault-tolerance (active-backup)
Support:无
负载均衡<IN/OUT>:否
冗余:是
bond MAC: 所有slave MAC相同
工作模式:同时只有一块网卡被激活,另一块网卡为backup,不工作
active抢夺:否
工作模式:Only one slave in the bond is active.
mode 4: lacp
802.3ad模式是IEEE标准 。
交换机端配置: interface AggregatePort 1 配置聚合口 interface GigabitEthernet 0/23 port- group 1 mode active 接口下开启lacp
主动模式 interface GigabitEthernet 0/24 port-group 1
mode active
mode 5: transmit load balancing
Support:Ethtool
ingoing:active-backup
outgoing:一块网卡用完,另一块网卡开始
mode 6: adaptive load balancing
IN/OUT:一块网卡用完,另一块网卡开始
这里配置了 bond4 模式 ,交换机开启 lacp, 配置聚合
# 配置
1. 网卡配置
# cat /etc/sysconfig/network-scripts/ifcfg-em1
DEVICE=em1
NAME=em1
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond4
SLAVE=yes
# cat /etc/sysconfig/network-scripts/ifcfg-em2
DEVICE=em2
NAME=em2
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond4
SLAVE=yes
# cat /etc/sysconfig/network-scripts/ifcfg-em3
DEVICE=em3
NAME=em3
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond4
SLAVE=yes
# cat /etc/sysconfig/network-scripts/ifcfg-bond4
DEVICE=bond4
NAME=bond4
TYPE=Bond
BONDING_MASTER=yes
IPADDR=172.16.32.51
GATEWAY=172.16.32.1
NETMASK=255.255.255.0
DNS1=172.16.32.241
DNS2=172.16.32.243
PEERDNS=yes
ONBOOT=yes
BOOTPROTO=static
BONDING_OPTS="mode=802.3ad miimon=100 lacp_rate=fast"
# bonding生效
方法1:重启系统
# bonding状态查看
# cat /proc/net/bonding/bond4
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
802.3ad info
LACP rate: fast
Min links: 0
Aggregator selection policy (ad_select): stable
Active Aggregator Info:
Aggregator ID: 3
Number of ports: 3
Actor Key: 17
Partner Key: 7985
Partner Mac Address: e4:c2:d1:e5:29:40
Slave Interface: em1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 44:a8:42:21:87:ec
Aggregator ID: 3
Slave queue ID: 0
Slave Interface: em2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 44:a8:42:21:87:ed
Aggregator ID: 3
Slave queue ID: 0
Slave Interface: em3
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 44:a8:42:21:87:ee
Aggregator ID: 3
Slave queue ID: 0
2. USB网卡不能加入bonding,不生效
(责任编辑:IT)
# 概念 服务器存在多块网卡时,可以通过bond来实现多块网卡并在一起使用; # 模式 mode 0:load balancing (round-robin) Support:需要Switch支持 <H3C5510支持> 负载均衡<IN/OUT>:是 冗余:是 bond MAC: 所有slave MAC相同 工作模式:Transmit packets in sequential order from the first available slave through the last. mode 1: fault-tolerance (active-backup) Support:无 负载均衡<IN/OUT>:否 冗余:是 bond MAC: 所有slave MAC相同 工作模式:同时只有一块网卡被激活,另一块网卡为backup,不工作 active抢夺:否 工作模式:Only one slave in the bond is active. mode 4: lacp 802.3ad模式是IEEE标准 。 交换机端配置: interface AggregatePort 1 配置聚合口 interface GigabitEthernet 0/23 port- group 1 mode active 接口下开启lacp 主动模式 interface GigabitEthernet 0/24 port-group 1 mode active mode 5: transmit load balancing Support:Ethtool ingoing:active-backup outgoing:一块网卡用完,另一块网卡开始 mode 6: adaptive load balancing IN/OUT:一块网卡用完,另一块网卡开始 这里配置了 bond4 模式 ,交换机开启 lacp, 配置聚合 # 配置 1. 网卡配置 # cat /etc/sysconfig/network-scripts/ifcfg-em1 DEVICE=em1 NAME=em1 TYPE=Ethernet BOOTPROTO=none ONBOOT=yes MASTER=bond4 SLAVE=yes # cat /etc/sysconfig/network-scripts/ifcfg-em2 DEVICE=em2 NAME=em2 TYPE=Ethernet BOOTPROTO=none ONBOOT=yes MASTER=bond4 SLAVE=yes # cat /etc/sysconfig/network-scripts/ifcfg-em3 DEVICE=em3 NAME=em3 TYPE=Ethernet BOOTPROTO=none ONBOOT=yes MASTER=bond4 SLAVE=yes # cat /etc/sysconfig/network-scripts/ifcfg-bond4 DEVICE=bond4 NAME=bond4 TYPE=Bond BONDING_MASTER=yes IPADDR=172.16.32.51 GATEWAY=172.16.32.1 NETMASK=255.255.255.0 DNS1=172.16.32.241 DNS2=172.16.32.243 PEERDNS=yes ONBOOT=yes BOOTPROTO=static BONDING_OPTS="mode=802.3ad miimon=100 lacp_rate=fast" # bonding生效 方法1:重启系统 # bonding状态查看 # cat /proc/net/bonding/bond4 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: IEEE 802.3ad Dynamic link aggregation Transmit Hash Policy: layer2 (0) MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 802.3ad info LACP rate: fast Min links: 0 Aggregator selection policy (ad_select): stable Active Aggregator Info: Aggregator ID: 3 Number of ports: 3 Actor Key: 17 Partner Key: 7985 Partner Mac Address: e4:c2:d1:e5:29:40 Slave Interface: em1 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 44:a8:42:21:87:ec Aggregator ID: 3 Slave queue ID: 0 Slave Interface: em2 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 44:a8:42:21:87:ed Aggregator ID: 3 Slave queue ID: 0 Slave Interface: em3 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 44:a8:42:21:87:ee Aggregator ID: 3 Slave queue ID: 0 2. USB网卡不能加入bonding,不生效 (责任编辑:IT) |