modprobe --first-time bonding #加载bonding模块 lsmod | grep bonding #查看是否开启
1 vim /etc/sysconfig/network-scripts/ifcfg-eth0 2 3 DEVICE=eth0 #网口名eth0 4 TYPE=Ethernet #以太网接口 5 ONBOOT=yes #LINUX在启动时激活该网口 6 BOOTPROTO=none #使用什么协议激活网口 7 none表示不使用任何协议 8 static表示设置静态IP 9 dhcp表示动态获取IP 10 MASTER=bond0 #指定虚拟网口的名字(主人) 11 SLAVE=yes
1 vim /etc/sysconfig/network-scripts/ifcfg-eth1 2 3 DEVICE=eth1 #网口名eth1 4 TYPE=Ethernet #以太网接口 5 ONBOOT=yes #LINUX在启动时激活该网口 6 BOOTPROTO=none #使用什么协议激活网口 7 none表示不使用任何协议 8 static表示设置静态IP 9 dhcp表示动态获取IP 10 MASTER=bond0 #指定虚拟网口的名字 11 SLAVE=yes
1 vim /etc/sysconfig/network-scripts/ifcfg-bond0 2 3 DEVICE=bond0 4 TYPE=Ethernet 5 ONBOOT=yes 6 BOOTPROTO=static 7 IPADDR=172.16.11.99 8 NETMASK=255.255.0.0 9 GATEWAY=172.16.1.1
1 vim /etc/modprobe.d/dist.conf #末尾增加以下两行 2 3 alias bond0 bonding 4 options bond0 miimon=100 mode=1
#miimon是用来进行链路监测的:miimon=100表示系统每100ms监测一次链路连接状态,如果有一条线路不同就转入另一条线路。
1 vim /etc/rc.d/rc.local #加入如下语句,使系统启动自动运行 2 ifenslave bond0 eth0 eth1
#route add -net 172.16.0.0 netmask 255.255.0.0 bond0---如果有需要添加该路由
reboot
# 如果只重启网卡会很卡,重启服务器后卡顿会消失
ip a s eth1
ip a s eth0
ip a s bond0
原文:https://www.cnblogs.com/shuojie/p/14252010.html