Merge remote-tracking branch 'origin/4.3/1691-swei'
This commit is contained in:
9
install_shell/set_bonding.sh
Executable file
9
install_shell/set_bonding.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
IF_CONFIG="/etc/sysconfig/network-devices"
|
||||||
|
|
||||||
|
echo 'bonding mode=6 max_bonds=1' >> /etc/sysconfig/modules
|
||||||
|
|
||||||
|
cp ${IF_CONFIG}/bond-examples/ifcfg-bond0 ${IF_CONFIG}
|
||||||
|
cp ${IF_CONFIG}/bond-examples/ifcfg-eth0 ${IF_CONFIG}
|
||||||
|
cp ${IF_CONFIG}/bond-examples/ifcfg-eth1 ${IF_CONFIG}
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
|
|
||||||
. ./check_function.sh
|
|
||||||
|
|
||||||
declare -i a=0
|
|
||||||
declare -i b=2
|
|
||||||
|
|
||||||
IF_CONFIG="/etc/sysconfig/network-devices"
|
|
||||||
|
|
||||||
grep bond0 /etc/rc.d/rc.local &> /dev/null
|
|
||||||
if [ $? -eq 0 ];then
|
|
||||||
echo "bond0 exist..."
|
|
||||||
else
|
|
||||||
ip=`ifconfig eth0 | grep inet | cut -d ':' -f 2 | cut -d ' ' -f 1`
|
|
||||||
mask=`ifconfig eth0|grep Mask|cut -d ':' -f 4|cut -d ' ' -f 1`
|
|
||||||
GATEWAY=`route -n|grep ^0.0.0.0|awk '{print $2}'`
|
|
||||||
if [ -z ${ip} ];then
|
|
||||||
ip="10.19.21.101"
|
|
||||||
GATEWAY="10.19.21.254"
|
|
||||||
mask="255.255.255.0"
|
|
||||||
fi
|
|
||||||
cat >> /etc/rc.d/rc.local <<EOF
|
|
||||||
|
|
||||||
#modprobe bonding max_bonds=2
|
|
||||||
modprobe bonding
|
|
||||||
#echo 0 > /sys/class/net/bond0/bonding/miimon
|
|
||||||
echo 100 > /sys/class/net/bond0/bonding/miimon
|
|
||||||
#echo 100 > /sys/class/net/bond0/bonding/arp_interval
|
|
||||||
#echo 6 > /sys/class/net/bond0/bonding/mode
|
|
||||||
echo 1 > /sys/class/net/bond0/bonding/mode
|
|
||||||
#echo 3 > /sys/class/net/bond0/bonding/arp_validate
|
|
||||||
#echo +gw > /sys/class/net/bond0/bonding/arp_ip_target
|
|
||||||
|
|
||||||
/sbin/ifconfig bond0 ${ip} netmask ${mask} up
|
|
||||||
echo +eth${a} > /sys/class/net/bond0/bonding/slaves
|
|
||||||
echo +eth${b} > /sys/class/net/bond0/bonding/slaves
|
|
||||||
/sbin/ifconfig eth${a} up
|
|
||||||
/sbin/ifconfig eth${b} up
|
|
||||||
|
|
||||||
/sbin/ifconfig bond0 down
|
|
||||||
/sbin/ifconfig eth${a} down
|
|
||||||
/sbin/ifconfig eth${b} down
|
|
||||||
|
|
||||||
/sbin/ifconfig bond0 up
|
|
||||||
/sbin/ifconfig eth${a} up
|
|
||||||
/sbin/ifconfig eth${b} up
|
|
||||||
|
|
||||||
# route information
|
|
||||||
route add default gw ${GATEWAY}
|
|
||||||
# route add -net netmask gw
|
|
||||||
EOF
|
|
||||||
for i in $a $b
|
|
||||||
do
|
|
||||||
ifconfig -a | grep eth${i} > /dev/null
|
|
||||||
if [ $? != 0 ];then
|
|
||||||
sed -i "/eth${i}/s/^/# &/g" /etc/rc.d/rc.local
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f $IF_CONFIG/ifcfg-eth${i} ];then
|
|
||||||
mkdir -p $IF_CONFIG/interface_bak
|
|
||||||
mv $IF_CONFIG/ifcfg-eth${i} $IF_CONFIG/interface_bak
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user