操作示例:将eth01/eth02绑定到一个IP上
(1)在修改内核模块配置文件/etc/modprobe.conf,加入以下内容:
1
2
3
4
|
###### Bonding Start ###### alias bond0 bonding
options bonding max_bonds = 1 ###### Bonding End ######## |
(2)建立bonding网卡文件/etc/sysconfig/network-scripts/ifcfg-bond0,配置如下:
1
2
3
4
5
6
7
|
DEVICE=bond0 ONBOOT= yes
BOOTPROTO=static IPADDR=192.168.100.21 NETMASK=255.255.255.0 USERCTL=no BONDING_OPTS= "mode=1 miimon=100 primary=eth01"
|
*bonding_opts参数参考:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
parm: max_bonds:Max number of bonded devices (int) parm: tx_queues:Max number of transmit queues (default = 16) (int) parm: num_grat_arp:Number of gratuitous ARP packets to send on failover event (int) parm: num_unsol_na:Number of unsolicited IPv6 Neighbor Advertisements packets to send on failover event (int) parm: miimon:Link check interval in milliseconds (int)
parm: updelay:Delay before considering link up, in milliseconds (int)
parm: downdelay:Delay before considering link down, in milliseconds (int)
parm: use_carrier:Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default) (int)
parm: mode:Mode of operation; 0 for balance-rr, 1 for active-backup, 2 for balance-xor, 3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, 6 for balance-alb (charp)
parm: primary:Primary network device to use (charp) parm: primary_reselect:Reselect primary slave once it comes up; 0 for always (default), 1 for only if speed of primary is better, 2 for only on active slave failure (charp)
parm: lacp_rate:LACPDU tx rate to request from 802.3ad partner; 0 for slow, 1 for fast (charp)
parm: ad_select:803.ad aggregation selection logic; 0 for stable (default), 1 for bandwidth, 2 for count (charp)
parm: xmit_hash_policy:balance-xor and 802.3ad hashing method; 0 for layer 2 (default), 1 for layer 3+4, 2 for layer 2+3 (charp)
parm: arp_interval:arp interval in milliseconds (int)
parm: arp_ip_target:arp targets in n.n.n.n form (array of charp)
parm: arp_validate:validate src /dst of ARP probes; 0 for none (default), 1 for active, 2 for backup, 3 for all (charp)
parm: fail_over_mac:For active-backup, do not set all slaves to the same MAC; 0 for none (default), 1 for active, 2 for follow (charp)
parm: all_slaves_active:Keep all frames received on an interfaceby setting active flag for all slaves; 0 for never (default), 1 for always. (int)
parm: resend_igmp:Number of IGMP membership reports to send on link failure (int) |
(3)修改eth01的网卡配置文件:
1
2
3
4
5
|
DEVICE=eth01 MASTER=bond0 SLAVE= yes
HWADDR=54:22:22:00:7A:37:CE ONBOOT= yes
|
修改eth02的网卡配置文件:
1
2
3
4
5
|
DEVICE=eth02 MASTER=bond0 SLAVE= yes
HWADDR=54:22:22:00:7A:37:CE ONBOOT= yes
|
(4)导入bonding驱动,重启网络服务后生效
1
2
|
>modprobe -i bonding max_bonds=1 >service network restart |
本文转自 bannerpei 51CTO博客,原文链接:http://blog.51cto.com/281816327/1615281,如需转载请自行联系原作者