日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網(wǎng)為廣大站長(zhǎng)提供免費(fèi)收錄網(wǎng)站服務(wù),提交前請(qǐng)做好本站友鏈:【 網(wǎng)站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(wù)(50元/站),

點(diǎn)擊這里在線咨詢客服
新站提交
  • 網(wǎng)站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會(huì)員:747

今天,是linux回爐的第八十六天

shell

我們生產(chǎn)環(huán)境下,發(fā)現(xiàn)Linux路由無(wú)法完成永久寫(xiě)入,不得已只能寫(xiě)個(gè)shell

#!/bin/bash

COUNT=`route -n|grep -v ^K|grep -v ^D|wc -l`

if [ $COUNT == 7 ]

then

echo "路由正常"

else

if [ `route -n|awk '{print $1}'|grep -v ^K|grep -v ^D|sed -n 1p` == "0.0.0.0" ]

then

echo "網(wǎng)關(guān)59.217.9.129啟動(dòng)"

else

route add -net 0.0.0.0 netmask 0.0.0.0 gw 59.217.9.129

fi

if [ `route -n|awk '{print $1}'|grep -v ^K|grep -v ^D|sed -n 2p` == "0.0.0.0" ]

then

echo "網(wǎng)關(guān)10.255.30.30啟動(dòng)"

else

route add -net 0.0.0.0 netmask 0.0.0.0 gw 10.255.30.30

fi

if [ `route -n|awk '{print $1}'|grep -v ^K|grep -v ^D|sed -n 3p` == "10.0.0.0" ]

then

echo "網(wǎng)關(guān)10.255.30.30啟動(dòng)"

else

route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.255.30.30

fi

if [ `route -n|awk '{print $1}'|grep -v ^K|grep -v ^D|sed -n 4p` == "10.255.30.0" ]

then

echo "網(wǎng)關(guān)0.0.0.0啟動(dòng)"

else

route add -net 10.255.30.0 netmask 255.255.255.0 gw 0.0.0.0

fi

if [ `route -n|awk '{print $1}'|grep -v ^K|grep -v ^D|sed -n 5p` == "59.217.0.0" ]

then

echo "59.217.9.129啟動(dòng)"

else

route add -net 59.217.0.0 netmask 255.255.255.0 gw 59.217.9.129

fi

if [ `route -n|awk '{print $1}'|grep -v ^K|grep -v ^D|sed -n 6p` == "59.217.9.128" ]

then

echo "0.0.0.0啟動(dòng)"

else

route add -net 59.217.9.128 netmask 255.255.255.128 gw 0.0.0.0

fi

if [ `route -n|awk '{print $1}'|grep -v ^K|grep -v ^D|sed -n 7p` == "192.168.122.0" ]

then

echo "0.0.0.0啟動(dòng)"

else

route add -net 192.168.122.0 netmask 255.255.255.0 gw 0.0.0.0

fi

fi

route -n >route1.txt

diff route.txt route1.txt>route2.txt

DIFF_COUNT=`cat route2.txt|awk '{print $4}'|sed '/^$/d'|grep -v routing|grep -v Genmask|wc -l`

if [ "$DIFF_COUNT" == "0" ];then

echo "diff顯示相同"

else

for i in `cat route2.txt|awk '{print $2}'|sed '/^$/d'|grep -v ^K|grep -v ^D`

do

COUNT_MASK=`cat route2.txt|awk '{print $4}'|sed '/^$/d'|grep -v routing|grep -v Genmask|awk '{print $1}'|wc -l`

for ((n=1;n<=$COUNT_MASK;n++))

do

MASK=`cat route2.txt|awk '{print $4}'|sed '/^$/d'|grep -v routing|grep -v Genmask|awk '{print $1}'|sed -n "$n"p`

if [ "$MASK" == "255.255.255.0" ];then

SUBET_MASK=24

route del -net $i/$SUNET_MASK

if [ "echo $?" == 0 ];then

echo "已經(jīng)關(guān)閉IP地址為:"$i

continue

else

2>&1

fi

elif [ "$MASK" == "0.0.0.0" ];then

SUNET_MASK=0

route del -net $i/$SUNET_MASK

if [ "echo $?" == 0 ];then

echo "已經(jīng)關(guān)閉IP地址為:"$i

continue

else

2>&1

fi

elif [ "$MASK" == "255.0.0.0" ];then

SUNET_MASK=8

route del -net $i/$SUNET_MASK

if [ "echo $?" == 0 ];then

echo "已經(jīng)關(guān)閉IP地址為:"$i

continue

else

2>&1

fi

elif [ "$MASK" == "255.255.0.0" ];then

SUNET_MASK=16

route del -net $i/$SUNET_MASK

if [ "echo $?" == 0 ];then

echo "已經(jīng)關(guān)閉IP地址為:"$i

continue

else

2>&1

fi

fi

done

done

fi

fi

分享到:
標(biāo)簽:route
用戶無(wú)頭像

網(wǎng)友整理

注冊(cè)時(shí)間:

網(wǎng)站:5 個(gè)   小程序:0 個(gè)  文章:12 篇

  • 51998

    網(wǎng)站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會(huì)員

趕快注冊(cè)賬號(hào),推廣您的網(wǎng)站吧!
最新入駐小程序

數(shù)獨(dú)大挑戰(zhàn)2018-06-03

數(shù)獨(dú)一種數(shù)學(xué)游戲,玩家需要根據(jù)9

答題星2018-06-03

您可以通過(guò)答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫(kù),初中,高中,大學(xué)四六

運(yùn)動(dòng)步數(shù)有氧達(dá)人2018-06-03

記錄運(yùn)動(dòng)步數(shù),積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓(xùn)練成績(jī)?cè)u(píng)定2018-06-03

通用課目體育訓(xùn)練成績(jī)?cè)u(píng)定