CentOS binds eth01/eth02 to an IP address.
Operation example: bind eth01/eth02 to an IP address
(1) Add the following content to the configuration file/etc/modprobe. conf of the kernel module:
######BondingStart######
alias
bond0bonding
optionsbondingmax_bonds=1
######BondingEnd########
(2) establish the bonding Nic file/etc/sysconfig/network-scripts/ifcfg-bond0, the configuration is as follows:
DEVICE=bond0
ONBOOT=
yes
BOOTPROTO=static
IPADDR=192.168.100.21
NETMASK=255.255.255.0
USERCTL=no
BONDING_OPTS=
"mode=1miimon=100primary=eth01"
* Bonding_opts parameter reference:
parm:max_bonds:Maxnumberofbondeddevices(int)
parm:tx_queues:Maxnumberoftransmitqueues(default=16)(int)
parm:num_grat_arp:NumberofgratuitousARPpacketstosendonfailoverevent(int)
parm:num_unsol_na:NumberofunsolicitedIPv6NeighborAdvertisementspacketstosendonfailoverevent(int)
parm:miimon:Linkcheckinterval
in
milliseconds(int)
parm:updelay:Delaybeforeconsideringlinkup,
in
milliseconds(int)
parm:downdelay:Delaybeforeconsideringlinkdown,
in
milliseconds(int)
parm:use_carrier:Usenetif_carrier_ok(vsMIIioctls)
in
miimon;0
for
off,1
for
on(default)(int)
parm:mode:Modeofoperation;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:Primarynetworkdevicetouse(charp)
parm:primary_reselect:Reselectprimaryslaveonceitcomesup;0
for
always(default),1
for
only
if
speedofprimaryisbetter,2
for
onlyonactiveslavefailure(charp)
parm:lacp_rate:LACPDUtxratetorequestfrom802.3adpartner;0
for
slow,1
for
fast(charp)
parm:ad_select:803.adaggregationselectionlogic;0
for
stable(default),1
for
bandwidth,2
for
count(charp)
parm:xmit_hash_policy:balance-xorand802.3adhashingmethod;0
for
layer2(default),1
for
layer3+4,2
for
layer2+3(charp)
parm:arp_interval:arpinterval
in
milliseconds(int)
parm:arp_ip_target:arptargets
in
n.n.n.nform(arrayofcharp)
parm:arp_validate:validatesrc
/dst
ofARPprobes;0
for
none(default),1
for
active,2
for
backup,3
for
all(charp)
parm:fail_over_mac:Foractive-backup,
do
not
set
allslavestothesameMAC;0
for
none(default),1
for
active,2
for
follow(charp)
parm:all_slaves_active:Keepallframesreceivedonaninterfacebysettingactiveflag
for
allslaves;0
for
never(default),1
for
always.(int)
parm:resend_igmp:NumberofIGMPmembershipreportstosendonlinkfailure(int)
(3) modify the NIC configuration file of eth01:
DEVICE=eth01
MASTER=bond0
SLAVE=
yes
HWADDR=54:22:22:00:7A:37:CE
ONBOOT=
yes
Modify the NIC configuration file of eth02:
DEVICE=eth02
MASTER=bond0
SLAVE=
yes
HWADDR=54:22:22:00:7A:37:CE
ONBOOT=
yes
(4) import the bonding driver and restart the network service.
>modprobe-ibondingmax_bonds=1
>servicenetworkrestart