diff --git a/install_shell/set_bonding.sh b/install_shell/set_bonding.sh new file mode 100755 index 0000000..1deff8e --- /dev/null +++ b/install_shell/set_bonding.sh @@ -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} diff --git a/install_shell/set_network.sh b/install_shell/set_network.sh deleted file mode 100755 index 216583e..0000000 --- a/install_shell/set_network.sh +++ /dev/null @@ -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 < /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 - diff --git a/setup.sh b/setup.sh index 9afdf25..1b2b7f6 100755 --- a/setup.sh +++ b/setup.sh @@ -16,7 +16,8 @@ else echo "====Create users...." fi -./set_network.sh +#./set_network.sh +./set_bonding.sh echo "====Set Bonding..." ./set_ssh.sh $1 $2 $3