1.ethtool ethX #查询网卡的信息,确定要绑定的网卡
Settings for eth0:
Supported ports: [ FIBRE ]
Supported link modes: 10000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: No
Advertised link modes: 10000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: No
Speed: 10000Mb/s
Duplex: Full
Port: Other
PHYAD: 0
Transceiver: external
Auto-negotiation: off
Supports Wake-on: d
Wake-on: d
Current message level: 0x00000007 (7)
drv probe link
Link detected: no
Settings for eth2:
Supported ports: [ TP ]
Supported link modes: 1000baseT/Full
10000baseT/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Advertised link modes: 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
Current message level: 0x0000000f (15)
drv probe link timer
Link detected: yes
2.我要绑定的是普通的网卡(eth2,eth3),建立绑定网卡,编辑原来的网卡配置文件
##建立bond0
vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.38.3.X
NETMASK=255.255.255.0
GATEWAY=10.38.3.X
DNS1=X.X.X.X
USERCTL=no
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100"
#编辑eth2和 eth3
[root@KSEDI-02 ~]# more /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
#TYPE=Ethernet
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
#NM_CONTROLLED=yes
BOOTPROTO=none
vim /etc/sysconfig/network-scripts/ifcfg-eth3
DEVICE=eth3
#TYPE=Ethernet
USERCTL=no
ONBOOT=no
MASTER=bond0
SLAVE=yes
#NM_CONTROLLED=yes
BOOTPROTO=none
#创建配置文件
vim /etc/modprobe.conf
alias bond0 bonding
options bond0 miimon=100 mode=1
#编辑添加开机自动执行
vim /etc/rc.d/rc.local
#添加到最后
ifenslave bond0 eth2 eth3
3.网卡测试
ifconfig eth2 down
ifconfig eth2 up
ifconfig eth3 down
ifconfig eth3 up