Initial commit

Signed-off-by: Qin Bo <bqin@linx-info.com>
This commit is contained in:
Qin Bo
2014-02-13 09:22:20 +08:00
commit 2235771f09
261 changed files with 34439 additions and 0 deletions

88
install_shell/set_network.sh Executable file
View File

@@ -0,0 +1,88 @@
#!/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
#blacklist,Just for bonding crash,maybe it can help us..
if [ -f /etc/modprobe.d/blacklist-ipv6.conf ];then
echo "blacklist ipv6 exist.."
else
echo "blacklist ipv6" >> /etc/modprobe.d/blacklist-ipv6.conf
chown sysadmin:sysadmin /etc/modprobe.d/blacklist-ipv6.conf
fi
#for blade
NET_CONFIG=/etc/sysconfig/network
check_config $NET_CONFIG NETWORKING yes
if [ $rtn -eq 2 ];then
echo "NETWORKING=yes" >> $NET_CONFIG
elif [ $rtn -eq 1 ];then
sed -i '/NETWORKING/s@no@yes@' $NET_CONFIG
fi