Skip to content

Instantly share code, notes, and snippets.

@mlconnor
Last active March 16, 2017 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mlconnor/2ef19a099e5c947168d868b4c9b1922b to your computer and use it in GitHub Desktop.
Save mlconnor/2ef19a099e5c947168d868b4c9b1922b to your computer and use it in GitHub Desktop.
Diagnose Connectivity
#set -o xtrace
echo "please copy the output of this script and send it to the network team so they can diagnose your issue"
# DESTINATION=destination.foo.com
# PORT=8089
if [ -z ${DESTINATION} ]
then
echo "Enter Server Name and press [ENTER]: "
read DESTINATION
fi
if [ -z ${PORT} ]
then
echo "Enter Port and press [ENTER]: "
read PORT
fi
echo "Dumping local network data"
ifconfig
# get the routing table
route -n
echo "pinging $DESTINATION"
ping -c 5 $DESTINATION
echo "let's see if we can hit tock.na.ko.com"
ping -c 5 tock.na.ko.com
echo "let's see if we can hit an ldap1.na.ko.com"
ping -c 5 ldap1.na.ko.com
echo "let's see if we can hit search.splunk.na.ko.com"
ping -c 5 search.splunk.na.ko.com
echo "Running traceroute..."
traceroute -m 20 $DESTINATION
wget -q --tries=10 --timeout=20 --spider http://google.com
if [[ $? -eq 0 ]]; then
echo "OK - Internet Connectivity to google.com"
else
echo "FAILED - Internet Connectivity to google.com"
fi
echo "Checking connectivity to $DESTINATION on port $PORT"
nc -zv $DESTINATION $PORT
@tgwilliams63
Copy link

Forked it and added some changes to prompt for user input: https://gist.github.com/tgwilliams63/3b5e6e69ac0b4d9566b53ac9c3c76c82

Not sure that there's an easy way to merge the changes in with a gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment