[root@slave ~]# cd /etc/sysconfig/network-scripts
[root@slave network-scripts]# ls
找以ifcfg-開頭的配置文件
[root@slave network-scripts]# vim ifcfg-eth0
[root@slave network-scripts]# cat ifcfg-eth0
DEVICE=eth0 網口名eth0
TYPE=Ethernet 以太網接口
ONBOOT=yes LINUX在啟動時激活該網口
BOOTPROTO=none 使用什么協議激活網口
none表示不使用任何協議
static表示設置靜態IP
dhcp表示動態獲取IP
MASTER=bond0 指定虛擬網口的名字
SLAVE=yes 備用
[root@slave network-scripts]# vim ifcfg-eth1
[root@slave network-scripts]# cat ifcfg-eth1
DEVICE=eth1 網口名eth1
TYPE=Ethernet 以太網接口
ONBOOT=yes LINUX在啟動時激活該網口
BOOTPROTO=none 使用什么協議激活網口
none表示不使用任何協議
static表示設置靜態IP
dhcp表示動態獲取IP
MASTER=bond0 指定虛擬網口的名字
SLAVE=yes 備用
備注:eth0、eth1的MASTER(主人)是bond0,本身是屬於從設備作為bond0的SLAVE(備用)
[root@slave network-scripts]# vim ifcfg-bond0
[root@slave network-scripts]# cat ifcfg-bond0
DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=IP
NETMASK=255.255.0.0
GATEWAY=網關
配置bonding
[root@slave network-scripts]# vim /etc/modprobe.d/dist.conf
末尾增加以下兩行
alias bond0 bonding
options bond0 miimon=100 mode=1
在/etc/rc.d/rc.local文件中加入下面語句,是系統啟動自動運行。
ifenslave bond0 eth0 eth1