首页 > 代码库 > LINUX 双网卡绑定

LINUX 双网卡绑定

cd /etc/sysconfig/network-scripts

cp ifcfg-eth0  bak.ifcfg-eth0

cp ifcfg-eth1  bak.ifcfg-eth1

 

vi ifcfg-bond0

DEVICE=bond0

BROADCAST=192.168.190.255

IPADDR=192.168.190.11

NETMASK=255.255.255.0

GATEWAY=192.168.190.1

ONBOOT=yes

USERCTL=no

BOOTPROTO=none

PEERDNS=yes

BONDING_OPTS=”modo=1 miimon=100”

 

vi ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

MASTER=bondo

BOOTPROTO=none

SLAVE=yes

USERCTL=no

 

vi ifcfg-eht1

DEVICE=eth1

ONBOOT=yes

MASTER=bondo

BOOTPROTO=none

SLAVE=yes

USERCTL=no

 

service NetworkManager stop     //停止NetworkManager服务

chkconfig NetworkManager off    //禁止NetworkManager服务开机启动

 

reboot

 

重启成功后检查 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: eth0

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: 1

Permanent HW addr: e4:1f:13:80:ee:93

Slave queue ID: 0

Slave Interface: eth1

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 1

Permanent HW addr: e4:1f:13:80:ee:94

Slave queue ID: 0