1. 网卡做bond
本次是将eth0和eth6做成一个bond0
1. Bond0
[root@EDEVAPP3 ~]# more /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.137.134
NETMASK=255.255.255.192
GATEWAY=192.168.137.190
2. Eth0
[root@EDEVAPP3 ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
HWADDR=08:9E:01:62:9F:AA
MASTER=bond0
SLAVE=yes
3. Eth6
[root@EDEVAPP3 ~]# more /etc/sysconfig/network-scripts/ifcfg-eth6
DEVICE=eth6
BOOTPROTO=none
HWADDR="68:05:CA:05:B6:D4"
ONBOOT=yes
MASTER=bond0
SLAVE=yes
4. 修改下面参数
[root@EDEVAPP3 ~]#vi /etc/modprobe.d/dist.conf
增加
alias bond0 bonding
options bond0 miimon=100 mode=1
--如果是双主交换机,且是主备模式的,两块网卡接到两个交换机上时,最好用mode=1,即主备模式,如果是load balance模式(mode=0)的话,可能会出现丢包的情况。
[root@EDEVAPP3 etc]# vi /etc/rc.d/rc.local
增加
ifenslave bond0 eth0 eth6
5. 将 NetworkManager服务关闭
[root@EDEVAPP2 network-scripts]# service NetworkManager stop
[root@EDEVAPP2 network-scripts]#Chkconfig –level 2345 NetworkManager off
--防火墙也需要设置好,可以关闭,selinux可以禁用掉。
6. 重启机器
配置完成后必须重启机器才能生效。
7. 一些检查
root@EDEVAPP3 etc]# ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000003 (3)
Link detected: yes
[root@EDEVAPP3 etc]# service network status
Configured devices:
lo bond0 eth0 eth1 eth2 eth3 eth4 eth5 eth6 eth7
Currently active devices:
lo eth0 eth6 bond0
[root@JTE7DEVAPP2 ~]# more /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: eth6
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 08:9e:01:62:98:f6
Slave queue ID: 0
Slave Interface: eth6
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 68:05:ca:05:b5:cc
Slave queue ID: 0
[root@JTE7DEVAPP2 ~]#