OpenWrt routing in relay mode to detect restart scripts

Source: Internet
Author: User

Home routing relay Others distant a tp-link to the Internet, but the distance is too far, often disconnected, the disconnection is not aware of the abnormal, so write a test script to determine whether to drop the line

Mainly ping Superior routing

Through the ping 114dns did not touch the shell script, the logic is not how to do well directly up a while cycle plus multiple if

It's a bad writing.

echo  ' Hello world ' while test  "1"  =  "1" do# do something# first time ping  Superior 192.168.1.1if ping -w 1 -c 1 192.168.1.1then  #若通则ping  114    if ping -w 1 -c 1 114.114.114.114  then echo  ' 01  network ok '   else  #再ping  115 confirm       if -w  1 -c 1 ping 114.114.115.115       then echo   ' 02 network ok '          #上级通, 114,115 non-pass, restart network        else /etc/init.d/network restart    #重启网络, wait           echo  ' F1: network fail '              fi    fi# first Ping Upper 192 not pass, second time pingelse    if ping -w 1 -c 1 192.168.1.1    then  #第二次ping上级通了       if ping -w 1 -c 1 114.114.114.114        then  #ping  114 also pass the        echo  ' 04 network ok '       else  #ping  114  Non-pass ping 115 confirmation           if ping -w 1 -c 1 114.114.115.115           then  #115可达             echo  ' 05 network ok '            #114, 115 is not through, restart network           else /etc/init.d/ network restart    #重启网络, wait             echo  ' F3: network&nbsP Fail '           fi      fi# The second ping superior still does not pass, direct ping 114 try     else      if ping  -w 1 -c 1 114.114.114.114         then   #114可达, network normal           echo  ' 03 network  Ok '        else  #确实不通, only restart          /etc/init.d/network restart    #重启网络, wait           echo  ' F2: network fail '        fi     fifisleep 100done

OpenWrt routing in relay mode to detect restart scripts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.