测试过的系统环境:Centos Linux 5.10/6.5,
所以CentOS 5.x 或者 CentOS 6.x的用户可以放心配置使用,
对于CentOS 7.x还没有正式测试过,因为出现了另一种配置方法,这里不做记录。
1、新建bond文件
-
[root@xxxx ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
-
DEVICE=bond0
-
BOOTPROTO=none
-
IPADDR=172.16.3.120
-
NETMASK=255.255.255.0
-
ONBOOT=yes
-
GATEWAY=172.16.3.254
-
USERCTL=no
2、配置网卡0文件
-
[root@xxxx ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
-
DEVICE=eth0
-
BOOTPROTO=none
-
ONBOOT=yes
-
MASTER=bond0
-
slave=yes
-
USERCTL=no
3、配置网卡1文件
-
[root@xxxx ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
-
DEVICE=eth1
-
BOOTPROTO=none
-
ONBOOT=yes
-
USERCTL=no
-
MASTER=bond0
-
slave=yes
4、编辑/etc/modprobe.conf文件, 增加13-14行内容
-
[root@xxxx ~]# cat /etc/modprobe.conf
-
alias scsi_hostadapter shpchp
-
alias eth0 bnx2
-
alias eth1 bnx2
-
alias scsi_hostadapter1 megaraid_sas
-
alias scsi_hostadapter2 ata_piix
-
alias scsi_hostadapter3 usb-storage
-
alias net-pf-10 off
-
alias ipv6 off
-
options ipv6 disable=1
-
alias usb0 cdc_ether
-
-
alias bond0 bonding
-
options bond0 miimon=100 mode=1
4、在启动项加入 ifenslave bond0 eth0 eth1 ,第10行
点击(此处)折叠或打开
-
[root@xxxx ~]# cat /etc/rc.d/rc.local
-
#!/bin/sh
-
#
-
# This script will be executed *after* all the other init scripts.
-
# You can put your own initialization stuff in here if you don\'t
-
# want to do the full Sys V style init stuff.
-
-
touch /var/lock/subsys/local
-
-
ifenslave bond0 eth0 eth1
-
-
su oracle -lc /dbbak/scripts/startup.sh
5、重启服务器完成
6、服务器启动后执行ifconfig检查配置结果
-
[root@xxxx ~]# ifconfig
-
bond0 Link encap:Ethernet HWaddr E4:1F:13:65:1A:C8
-
inet addr:172.16.3.120 Bcast:172.16.3.255 Mask:255.255.255.0
-
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
-
RX packets:4075442 errors:0 dropped:2736870 overruns:0 frame:0
-
TX packets:1760516 errors:0 dropped:0 overruns:0 carrier:0
-
collisions:0 txqueuelen:0
-
RX bytes:327142540 (311.9 MiB) TX bytes:2302923391 (2.1 GiB)
-
-
eth0 Link encap:Ethernet HWaddr E4:1F:13:65:1A:C8
-
UP BROADCAST SLAVE MULTICAST MTU:1500 Metric:1
-
RX packets:54996 errors:0 dropped:26 overruns:0 frame:0
-
TX packets:2497 errors:0 dropped:0 overruns:0 carrier:0
-
collisions:0 txqueuelen:1000
-
RX bytes:4838283 (4.6 MiB) TX bytes:576512 (563.0 KiB)
-
-
eth1 Link encap:Ethernet HWaddr E4:1F:13:65:1A:C8
-
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
-
RX packets:4020446 errors:0 dropped:92143 overruns:0 frame:0
-
TX packets:1758019 errors:0 dropped:0 overruns:0 carrier:0
-
collisions:0 txqueuelen:1000
-
RX bytes:322304257 (307.3 MiB) TX bytes:2302346879 (2.1 GiB)
bond0、eth0、eth1的mac地址相同,只有bond0有IP地址。
至此,配置成功。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28538954/viewspace-1255425/
,如需转载,请注明出处,否则将追究法律责任。