RHEL6 Bonding

Article 1 Article 2 Article 3

[@more@]
摘自 Red Hat Enterprise Linux 6 Essentials eBook
1,
For example, if two Ethernet interfaces are being channel bonded, both eth0 and eth1 may look like the following example:
DEVICE=eth
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
2,cp /etc/sysconfig/network-script/ifcfg-eth0
/etc/sysconfig/network-script/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.1.1
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
BONDING_OPTS=" "

3,As root, create a new file named .conf in the /etc/modprobe.d/ directory. Note that you can name this file anything you like as long as it ends with a .conf extension. Insert the following line in this new file:
alias bond bonding
4, You can configure each bond individually by manipulating the files located in the /sys/class/net/bond/bonding/ directory. First, the bond you are configuring must be taken down:~]# ifconfig bond0 down
As an example, to enable MII monitoring on bond0 with a 1 second interval, you could run (as root):
~]# echo 1000 > /sys/class/net/bond0/bonding/miimon
To configure bond0 for balance-alb mode, you could run either:
~]# echo 6 > /sys/class/net/bond0/bonding/mode
...or, using the name of the mode:
~]# echo balance-alb > /sys/class/net/bond0/bonding/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)
---------------------------------------------------------
下面是我的配置:
[root@daodao ~]# modprobe bonding
[root@daodao ~]#
[root@daodao ~]#
[root@daodao ~]# modinfo bonding
filename: /lib/modules/2.6.32-71.el6.x86_64/kernel/drivers/net/bonding/bonding.ko
author: Thomas Davis, tadavis@lbl.gov and many others
description: Ethernet Channel Bonding Driver, v3.5.0
version: 3.5.0
license: GPL
srcversion: 7A9F53F6599AD446BA0629C
depends: ipv6
vermagic: 2.6.32-71.el6.x86_64 SMP mod_unload modversions
parm: max_bonds:Max number of bonded devices (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: lacp_rate:LACPDU tx rate to request from 802.3ad partner (slow/fast) (charp)
parm: ad_select:803.ad aggregation selection logic: stable (0, default), bandwidth (1), count (2) (charp)
parm: xmit_hash_policy:XOR hashing method: 0 for layer 2 (default), 1 for layer 3+4 (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: none (default), active, backup or all (charp)
parm: fail_over_mac:For active-backup, do not set all slaves to the same MAC. none (default), active or follow (charp)
[root@daodao ~]# cd /etc/
[root@daodao etc]# ls mod*
anaconda.conf blacklist.conf blacklist-kvm.conf bond0.conf dist-alsa.conf dist.conf dist-oss.conf openfwwf.conf
[root@daodao etc]# cd modprobe.d/
[root@daodao modprobe.d]# pwd
/etc/modprobe.d
[root@daodao modprobe.d]# touch bond0.conf
[root@daodao modprobe.d]# more bond0.conf
alias bond0 bonding
[root@daodao modprobe.d]# cd /etc/sysconfig/network-scripts/
[root@daodao network-scripts]# cp ifcfg-eth0 ifcfg-bond0
[root@daodao network-scripts]# ls
ifcfg-bond0 ifcfg-eth3 ifdown-eth ifdown-post ifdown-tunnel ifup-eth ifup-plip ifup-routes init.ipv6-global
ifcfg-eth0 ifcfg-lo ifdown-ippp ifdown-ppp ifup ifup-ippp ifup-plusb ifup-sit net.hotplug
ifcfg-eth1 ifdown ifdown-ipv6 ifdown-routes ifup-aliases ifup-ipv6 ifup-post ifup-tunnel network-functions
ifcfg-eth2 ifdown-bnep ifdown-isdn ifdown-sit ifup-bnep ifup-isdn ifup-ppp ifup-wireless network-functions-ipv6
[root@daodao network-scripts]# more ifcfg-bond0
DEVICE=bond0
#NM_CONTROLLED="yes"
ONBOOT="yes"
BOOTPROTO=none
IPADDR=11.11.11.21
NETMASK=255.255.255.0
GATEWAY=11.11.11.1
USERCTL=no
[root@daodao network-scripts]# more ifcfg-eth0
DEVICE=eth0
HWADDR=3C:4A:92:F9:58:6C
#NM_CONTROLLED="yes"
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
[root@daodao network-scripts]#
[root@daodao network-scripts]# more ifcfg-eth1
DEVICE=eth1
HWADDR=3C:4A:92:F9:58:6D
#NM_CONTROLLED=yes
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
[root@daodao bonding]# cd /sys/class/net/bond0/bonding
[root@daodao bonding]# pwd
/sys/class/net/bond0/bonding
[root@daodao bonding]#
[root@daodao bonding]#
[root@daodao bonding]#
[root@daodao bonding]# ls
active_slave ad_num_ports ad_select arp_validate lacp_rate mode primary use_carrier
ad_actor_key ad_partner_key arp_interval downdelay miimon num_grat_arp slaves xmit_hash_policy
ad_aggregator ad_partner_mac arp_ip_target fail_over_mac mii_status num_unsol_na updelay
[root@daodao bonding]# echo 1 > /sys/class/net/bond0/bonding/mode
[root@daodao bonding]# more mode
active-backup 1
[root@daodao bonding]#
[root@daodao bonding]#echo 1000 > /sys/class/net/bond0/bonding/miimon
[root@daodao bonding]# more miimon
1000
[root@daodao network-scripts]#service NetworkManager stop
[root@daodao bonding]# service network restart
Shutting down interface bond0: [ OK ]
Shutting down interface eth3: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface bond0: [ OK ]
Bringing up interface eth3: [ OK ]
[root@daodao network-scripts]# ifconfig|more
bond0 Link encap:Ethernet HWaddr 3C:4A:92:F9:58:6C
inet addr:11.11.11.101 Bcast:11.11.11.255 Mask:255.255.255.0
inet6 addr: fe80::3e4a:92ff:fef9:585c/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:3 errors:0 dropped:0 overruns:0 frame:0
TX packets:279 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:576 (576.0 b) TX bytes:33751 (32.9 KiB)
eth0 Link encap:Ethernet HWaddr 3C:4A:92:F9:58:6C
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:218 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:22720 (22.1 KiB)
Interrupt:65
eth1 Link encap:Ethernet HWaddr 3C:4A:92:F9:58:6C
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:3 errors:0 dropped:0 overruns:0 frame:0
TX packets:61 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:576 (576.0 b) TX bytes:11031 (10.7 KiB)
Interrupt:69
[root@daodao network-scripts]# ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: external
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: g
Wake-on: g
Link detected: yes
[root@daodao network-scripts]# ethtool eth1
Settings for eth1:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: external
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: g
Wake-on: g
Link detected: yes
[root@daodao network-scripts]# cd /proc/net/bonding/
[root@daodao bonding]# ls
bond0
[root@daodao bonding]# pwd
/proc/net/bonding
[root@daodao bonding]# more bond0
Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 3c:4a:92:f9:58:6c
Slave Interface: eth1
MII Status: up
Link Failure Count: 1
Permanent HW addr: 3c:4a:92:f9:58:6d

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9697/viewspace-1053957/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/9697/viewspace-1053957/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值