Last active
March 10, 2017 00:19
-
-
Save ahadsheriff/524345273652cc3ab0a437cd21974a7d to your computer and use it in GitHub Desktop.
Ping script to test local, remote, and DNS connectivity, written in bash.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ echo off | |
echo Testing local connectivity | |
ping 192.168.1.102 > nul | |
if errorlevel 1 goto :ERRORLocal | |
goto :LocalSuccess | |
:TRYRemote | |
echo Testing remote connectivity | |
ping 8.8.8.8 > nul | |
if errorlevel 1 goto :ERRORRemote | |
goto :RemoteSuccess | |
:TRYDNS | |
echo Testing DNS | |
ping www.google.com > nul | |
if errorlevel 1 goto :ERRORDNS | |
goto :DNSSuccess | |
:LocalSuccess | |
echo Test Successful | |
goto :TRYRemote | |
:RemoteSuccess | |
echo Test Successful | |
goto :TRYDNS | |
:DNSSuccess | |
echo Test Successful | |
goto :END | |
:ERRORLocal | |
echo Local Ping test failed! | |
goto :TRYRemote | |
:ERRORRemote | |
echo Remote Ping test failed! | |
goto :TRYDNS | |
:ERRORDNS | |
echo DNS test failed! | |
goto :END | |
:END | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment