step1:創建綁定文件
[root@node-1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-bond0
TYPE="bond"
BOOTPROTO="none"
NAME="bond0"
DEVICE="bond0"
IPADDR="192.168.1.20"
NETMASK="255.255.255.0"
GATEWAY="192.168.1.1"
DNS1="8.8.8.8"
DNS2="8.8.4.4"
ONBOOT="yes"
step2:編輯需要綁定的物理網卡,並且指定主從,如下:
[root@node-1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE="Ethernet"
BOOTPROTO="none"
NAME="eth0"
DEVICE="eth0"
MASTER="bond0"
SLAVE="yes"
ONBOOT="yes"
[root@node-1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1
TYPE="Ethernet"
BOOTPROTO="none"
NAME="eth1"
DEVICE="eth1"
MASTER="bond0"
SLAVE="yes"
ONBOOT="yes"
step3:創建bond文件,並且設定冗余的模式
[root@node-1 ~]# vi /etc/modprobe.d/bonding.conf
alias bond0 binding
options bond0 miimon=100 mode=1
step4:重啟機器
注:關於mode的說明
mode=0 //平衡循環
mode=1 //主備
mode=3 //廣播
mode=4 //鏈路聚合
