双网卡绑定

old-----------------------------------------------------------------

ifcfg-eth0内容:
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

ifcfg-eth1内容:
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

ifcfg-bond0内容:
DEVICE=bond0
TYPE=Bond
IPADDR=192.168.8.100
NETMASK=255.255.255.0
GATEWAY=0.0.0.0
DNS1=
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100"


source /opt/ifcfg-eth0
ifconfig eth0 down
ifconfig eth0 hw ether $HWADDR

source /opt/ifcfg-eth1
ifconfig eth1 down
ifconfig eth1 hw ether $HWADDR

source /opt/ifcfg-bond0
modprobe bonding $BONDING_OPTS

ifconfig bond0 down
ifconfig bond0 $IPADDR netmask $NETMASK up

ifenslave bond0 eth0 eth1

new ------------------------------------------------------------------

modprobe bonding
echo active-backup > /sys/class/net/bond0/bonding/mode
ifconfig bond0 192.168.8.100 netmask 255.255.255.0 up
echo 100 > /sys/class/net/bond0/bonding/miimon
ifconfig eth1 down
echo +eth0 > /sys/class/net/bond0/bonding/slaves
echo +eth1 > /sys/class/net/bond0/bonding/slaves

 https://backdrift.org/manage-linux-bonding-without-ifenslave-using-s 

posted on 2019-01-16 18:30  紫枫术河  阅读(97)  评论(0编辑  收藏  举报

导航