modify set bonding function

new file:   install_shell/set_bonding.sh
	deleted:    install_shell/set_network.sh
	modified:   setup.sh

	Signed-off-by: swei <swei@linx-info.com>
This commit is contained in:
root
2014-03-19 15:53:35 +08:00
parent 182bbfdace
commit 42a3c37c19
3 changed files with 11 additions and 67 deletions

9
install_shell/set_bonding.sh Executable file
View 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}

View File

@@ -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

View File

@@ -16,7 +16,8 @@ else
echo "====Create users...."
fi
./set_network.sh
#./set_network.sh
./set_bonding.sh
echo "====Set Bonding..."
./set_kernel.sh