for循环批量添加网关
时间:2010-11-15 来源:expert1
#!/bin/sh
#expert1
#name addgw.sh
out=$1
in=$2
###### add gateway to network#####
mv /etc/rc.local /etc/rc.local.bak
echo "#!/bin/sh -e ">>/etc/rc.local && chmod 755 /etc/rc.local
###### for loop start###
for i in 202.108.12.0/24 202.108.13.0/24 202.108.15.0/24 202.108.29.0/24 61.135.158.0/24 61.135.159.0/24 ;do echo "route add -net $i gw ${out} ">>/etc/rc.local;done
echo "" >>/etc/rc.local
echo "route add -host 218.30.x.x gw ${in} ">>/etc/rc.local
echo "route add -host 202.108.x.x gw ${in} " >>/etc/rc.local
echo "route add -host 61.135.x.x gw ${in} " >>/etc/rc.local
echo "" >>/etc/rc.local