首页 > 代码库 > centos 网卡聚合

centos 网卡聚合

1、cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-bond0
2、vi /etc/sysconfig/network-scripts/ifcfg-bond0 文件,内容如下:
DEVICE=bond0
USERCTL=no
BOOTPROTO=static
IPADDR=192.168.233.232
NETMASK=255.255.255.0
ONBOOT=yes
GATEWAY=192.168.233.1
TYPE=Ethernet

3、vi /etc/sysconfig/network-scripts/ifcfg-eth0 文件,内容如下:
DEVICE=eth0
ONBOOT=yes
TYPE=Ethernet
MASTER=bond0
SLAVE=yes
USERCTL=no

4、vi /etc/sysconfig/network-scripts/ifcfg-eth1 文件,内容如下:
DEVICE=eth1
ONBOOT=yes
TYPE=Ethernet
MASTER=bond0
SLAVE=yes
USERCTL=no

5、vi /etc/modprobe.conf 增加:
alias bond0 bonding
options bond0 miimon=100 mode=0

6、service network restart
结果没有报错:
[root@localhost network-scripts]# service network restart
Shutting down interface bond0:                             [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface bond0:                               [  OK  ]
[root@localhost network-scripts]#

7、重启系统

8、检查配置是否成功,如下显示表示配置成功
[root@localhost network-scripts]# ifconfig
bond0     Link encap:Ethernet  HWaddr 00:0C:29:DF:D6:84  
          inet addr:192.168.233.232  Bcast:192.168.233.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:756 errors:0 dropped:0 overruns:0 frame:0
          TX packets:836 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:74148 (72.4 KiB)  TX bytes:189998 (185.5 KiB)

eth0      Link encap:Ethernet  HWaddr 00:0C:29:DF:D6:84  
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:735 errors:0 dropped:0 overruns:0 frame:0
          TX packets:658 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:70034 (68.3 KiB)  TX bytes:159290 (155.5 KiB)

eth1      Link encap:Ethernet  HWaddr 00:0C:29:DF:D6:84  
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:23 errors:0 dropped:0 overruns:0 frame:0
          TX packets:190 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4234 (4.1 KiB)  TX bytes:32540 (31.7 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1996 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1996 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3242068 (3.0 MiB)  TX bytes:3242068 (3.0 MiB)

[root@localhost network-scripts]#

本文出自 “小白的小窝” 博客,请务必保留此出处http://qing429.blog.51cto.com/5781009/1589368

centos 网卡聚合