1.[root@rac1 network-scripts]# ls   查看网卡类型

ifcfg-bond0  ifdown       ifdown-ppp     ifup-eth    ifup-ppp          network-functions

ifcfg-eth0   ifdown-bnep  ifdown-routes  ifup-ippp   ifup-routes       network-functions-ipv6

ifcfg-eth1   ifdown-eth   ifdown-sit     ifup-ipv6   ifup-sit

ifcfg-eth2   ifdown-ippp  ifdown-tunnel  ifup-isdn   ifup-tunnel

ifcfg-eth3   ifdown-ipv6  ifup           ifup-plip   ifup-wireless

ifcfg-lo     ifdown-isdn  ifup-aliases   ifup-plusb  init.ipv6-global

ifcfg-usb0   ifdown-post  ifup-bnep      ifup-post   net.hotplug


2.查看bond接口配置

(1)[root@rac1 network-scripts]# cat ifcfg-bond0 

DEVICE=bond0

ONBOOT=yes

TYPE=Ethernet

BOOTPROTO=static

IPADDR=192.168.40.40

NETWORK=192.168.40.0

NETMASK=255.255.255.0

BROADCAST=192.168.40.255

GATEWAY=192.168.40.254

USERCTL=NO

(2)[root@rac1 network-scripts]# cat ifcfg-eth2

DEVICE=eth2

HWADDR=90:E2:BA:73:49:52

TYPE=Ethernet

UUID=7431769c-f1d9-41bc-8e8a-fa702a355296

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

USERCTL=no

(3)[root@rac1 network-scripts]# cat ifcfg-eth3

DEVICE=eth3

HWADDR=90:E2:BA:73:49:53

TYPE=Ethernet

UUID=496784dc-b5f5-4b50-8cb8-72eec3fdea3c

ONBOOT=yes

NM_CONTROLLED=yes

MASTER=bond0

SLAVE=yes

BOOTPROTO=none

IPV6INIT=no

USERCTL=no

[root@rac1 network-scripts]# 


3.设置bond模式

[root@rac1 network-scripts]# cat /etc/modprobe.d/bonding.conf 

alias eth2 pcnet32

alias scsi_hostadapter mptbase

alias scsi_hostadapter1 mptscsih

alias eth3 pcnet32

alias bond0 bonding

options bond0 miimon=100 mode=1

[root@rac1 network-scripts]# 


4.设置开机启动接口

[root@rac1 network-scripts]# cat /etc/rc.d/rc.local 

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don't

# want to do the full Sys V style init stuff.


touch /var/lock/subsys/local

route add -net 192.168.10.0/24 gw 192.168.10.254 dev eth0

route add -net 192.168.20.0/24 gw 192.168.20.254 dev eth1

route add -net 192.168.1.0/24 gw 192.168.10.254 

route add -net 0.0.0.0/0 gw 192.168.20.254 metric 20

ifenslave bond0 eth2 eth3 

[root@rac1 network-scripts]# 


5.查询bond状态

[root@rac1 network-scripts]# cat /proc/net/bonding/bond0 

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)


Bonding Mode: fault-tolerance (active-backup)

Primary Slave: None

Currently Active Slave: eth2

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0


Slave Interface: eth2

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 1

Permanent HW addr: 90:e2:ba:73:49:52

Slave queue ID: 0


Slave Interface: eth3

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 1

Permanent HW addr: 90:e2:ba:73:49:53

Slave queue ID: 0

[root@rac1 network-scripts]#