> CentOS > CentOS入门 >

CentOS6.5双网卡绑定教程

[root@localhost]# cd /etc/sysconfig/network-scripts/

[root@localhost network-scripts~]#  ll

-rw-r--r--. 1 root root   149 Aug  3 16:36 ifcfg-bond0

-rw-r--r--. 1 root root    97 Aug  3 16:38 ifcfg-eth0

-rw-r--r--. 1 root root    98 Aug  3 16:38 ifcfg-eth1

-rw-r--r--. 1 root root   182 Aug  3 11:14 ifcfg-eth2

-rw-r--r--. 1 root root   254 Oct 10  2013 ifcfg-lo

[root@localhost network-scripts]# cp ifcfg-eth0 ifcfg-bond0

[root@localhost network-scripts]# vim ifcfg-bond0 

GATEWAY=192.168.x.x

DNS1=114.114.114.114

DEVICE=bond0

BOOTPROTO=none

NETMASK=255.255.255.0

TYPE=Ethernet

IPADDR=192.168.x.x

ONBOOT=yes

USERCTL=no

[root@localhost network-scripts]# vim ifcfg-eth0

EVICE=eth0

ONBOOT=no

TYPE=Ethernet

MASTER=bond0

BOOTPROTO=none

USERCTL=no

SLAVE=yes

IPV6INIT=no

~

[root@localhost network-scripts]# vim ifcfg-eth1

 

EVICE=eth1

ONBOOT=no

TYPE=Ethernet

MASTER=bond0

BOOTPROTO=none

USERCTL=no

SLAVE=yes

IPV6INIT=no

[root@localhost]# cd /etc/modprobe.d/

[root@localhost modprobe.d]#vi dist.conf

 

 

alias bond0 bonding

options bodn0 mode=0 miimon=100

[root@localhost]# vi /etc/rc.d/rc.local

ifenslave bond0 eth0 eth1

 

关闭服务networkmanager

 

 

[root@localhost modprobe.d]# ifconfig

bond0     Link encap:Ethernet  HWaddr F8:0F:41:F8:EC:70  

          inet addr:192.168.x.x  Bcast:192.168.x.x  Mask:255.255.255.0

          inet6 addr: fe80::fa0f:41ff:fef8:ec70/64 Scope:Link

          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

          RX packets:16170 errors:0 dropped:0 overruns:0 frame:0

          TX packets:2271 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:1552817 (1.4 MiB)  TX bytes:198708 (194.0 KiB)

 

eth0      Link encap:Ethernet  HWaddr F8:0F:41:F8:EC:70  

          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1

          RX packets:2476 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1134 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:214254 (209.2 KiB)  TX bytes:99272 (96.9 KiB)

          Memory:dfc20000-dfc40000 

 

eth1      Link encap:Ethernet  HWaddr F8:0F:41:F8:EC:70 

          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1

          RX packets:13694 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1137 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:1338563 (1.2 MiB)  TX bytes:99436 (97.1 KiB)

          Memory:dfc00000-dfc20000 

交换机上配置

[Switch]link-aggregation group 1 mode manual 

[Switch]interface GigabitEthernet 1/0/1

[Switch-GigabitEthernet1/0/1] port link-aggregation group 1

[Switch-GigabitEthernet1/0/1] interface GigabitEthernet 1/0/48

[Switch-GigabitEthernet1/0/2] port link-aggregation group 1

[Switch-GigabitEthernet1/0/2] interface GigabitEthernet 1/0/47

[Switch-GigabitEthernet1/0/3] port link-aggregation group 1


测试结果

(责任编辑:IT)