Step1:编辑/etc/modprobe.conf文件
#vi /etc/modprobe.conf
加入
alias bond0 bonding
options bond0 miimon=100 mode=0 (这里设定的是负载均衡方式,如果要使用冗余模式,使用
options bond0 miimon=100 mode=1 来替换之。)
Step2: 修改之后需要重新制作initrd文件:
# mkinitrd -f /boot/initrd-$(uname -r).img $(uname -r)
Step3:配置bonding网卡(和配置普通的网卡类似)
# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.0.8
NETMASK=255.255.255.0
Step4:配置从网卡(直接copy这里的内容即可)
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
MASTER=bond0
SLAVE=yes
#cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
ONBOOT=yes
MASTER=bond0
SLAVE=yes
Step5:重起系统,系统启动后可通过如下命令查看bond设备信息:
# watch -d -n 1 "cat /proc/net/bonding/bond0"