1. 编辑文件:
#vi /etc/modprobe.conf
alias eth0 tg3
alias eth1 tg3
alias eth2 e1000 注:e1000为服务器单加的网卡
添加:
alias bond0 bonding
options bond0 miimon=100 mode=1
(0 表示load blance ;1 表示热备)
#vi /etc/modprobe.conf
alias eth0 tg3
alias eth1 tg3
alias eth2 e1000 注:e1000为服务器单加的网卡
添加:
alias bond0 bonding
options bond0 miimon=100 mode=1
(0 表示load blance ;1 表示热备)
2. 创建bond0起动配置文件:
cd /etc/sysconfig/network-scripts/
vi ifcfg-bond0
内容如下:
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.36
NETMASK=255.255.255.0
USERCTL=no
内容如下:
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.36
NETMASK=255.255.255.0
USERCTL=no
3. 编辑ifcfg-eth0 , ifcfg-eth1两个网卡配置文件,内容如下:
#vi ifcfg-eth0
DEVICE=eth0
USERCTL=no
ONBOOT=yes
#MASTER=bond0
#SLAVE=yes
BOOTPROTO=none
#HWADDR=XXXXXXXXXXXXXX
注意:如下最好在ifcfg-eth*文件中标明MASTER和SLAVE,方便排错,如果不写在这里的话,排措时也就得重启服务器了。。
#vi ifcfg-eth1
DEVICE=eth1
USERCTL=no
ONBOOT=yes
#MASTER=bond0
#SLAVE=yes
BOOTPROTO=none
#HWADDR=XXXXXXXXXXXXXX
#vi ifcfg-eth1
DEVICE=eth1
USERCTL=no
ONBOOT=yes
#MASTER=bond0
#SLAVE=yes
BOOTPROTO=none
#HWADDR=XXXXXXXXXXXXXX
4. 编辑启动文件
#vi /etc/rc.d/rc.local
在最后加入:
ifenslave bond0 eth0 eth1 这句话相当于分别在eth0和eth1添加MASTER=bond0 SLAVE=yes
(如果改变网卡的顺序及eth0等对应的物理网卡,一定要在做bond0前来做,不然改不过来,改变网卡顺序的文件为/etc/sysconfig/hwconf)
#vi /etc/rc.d/rc.local
在最后加入:
ifenslave bond0 eth0 eth1 这句话相当于分别在eth0和eth1添加MASTER=bond0 SLAVE=yes
(如果改变网卡的顺序及eth0等对应的物理网卡,一定要在做bond0前来做,不然改不过来,改变网卡顺序的文件为/etc/sysconfig/hwconf)
5. 编辑主机名和默认网关
#vi /etc/sysconfig/network
HOSTNAME=test01
注意:如果需要绑定两个bond,需在/etc/modprobe.d/下建立多个bond*conf文件,以便调用
#vi /etc/sysconfig/network
HOSTNAME=test01
注意:如果需要绑定两个bond,需在/etc/modprobe.d/下建立多个bond*conf文件,以便调用
6、关闭网卡NetworkManager启动方式
service NetworkManager stop
chkconfig NetworkManager off
service network restart
ifenslave bond0 eth0 eth1 生效
如果不生效或者上述命令有错误 请键入 modprobe bonding 加载bond驱动
service NetworkManager stop
chkconfig NetworkManager off
service network restart
ifenslave bond0 eth0 eth1 生效
如果不生效或者上述命令有错误 请键入 modprobe bonding 加载bond驱动