├── check-my-net └── README.md /check-my-net: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ghome=google.com 4 | gdns=8.8.8.8 5 | gifc=$(ip route | awk '/default/ { print $5 }') 6 | gway=$(ip route | awk '/default/ { print $3 }') 7 | 8 | if ping -q -c 5 "$ghome" >/dev/null 2>&1 9 | then 10 | tput sgr0 11 | echo "" 12 | echo -e '\E[1;32m'"You are connected to internet via interface \"$gifc\"" 13 | echo "" 14 | tput sgr0 15 | exit 0 16 | else 17 | if ping -q -c 5 "$gdns" >/dev/null 2>&1 18 | then 19 | tput sgr0 20 | echo "" 21 | echo -e '\E[1;36m'"Your DNS server(s) does not seem to be responding" 22 | echo -e '\E[1;36m'"\"/etc/resolv.conf\" file might be of interest to you" 23 | echo "" 24 | tput sgr0 25 | exit 1 26 | else 27 | if ping -q -c 5 "$gway" >/dev/null 2>&1 28 | then 29 | tput sgr0 30 | echo "" 31 | echo -e '\E[1;33m'"Problem seems to be with the ISP. Contact the ISP" 32 | echo "" 33 | tput sgr0 34 | exit 1 35 | else 36 | tput sgr0 37 | echo "" 38 | echo -e '\E[1;31m'"Can't connect to either your router or your modem" 39 | echo -e '\E[1;31m'"Make sure the PC's network is properly configured" 40 | echo -e '\E[1;31m'"Also make sure the router or modem is switched on" 41 | echo -e '\E[1;31m'"Do check that network cable is correctly attached" 42 | echo -e '\E[1;31m'"In case of wireless router check the signal level" 43 | echo "" 44 | tput sgr0 45 | exit 1 46 | fi 47 | fi 48 | fi 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # check-my-net 2 | 3 | **check-my-net** is a simple bash script that can help you in checking your internet connectivity and diagnosing common internet connectivity problems. 4 | 5 | ### Installation : 6 | 7 | **check-my-net** doesn't have any external dependencies and it should work out of box on most modern GNU/Linux systems running on Linux kernel 2.2 or newer. This pretty much means everywhere. Installation is very simple. Download **[check-my-net-main]** zip, extract its contents and copy the file **check-my-net** to **/usr/local/bin/** directory, 8 | ```sh 9 | sudo cp check-my-net /usr/local/bin/ 10 | ``` 11 | And make it executable, 12 | ```sh 13 | sudo chmod 755 /usr/local/bin/check-my-net 14 | ``` 15 | 16 | 17 | ### Usage : 18 | 19 | Open terminal & run, 20 | ```sh 21 | check-my-net 22 | ``` 23 | And **check-my-net** will test your internet connectivity status and if internet connectivity is down it will display a diagnostic message that hopefully will be good enough to guide you towards solving the problem. 24 | 25 | 26 | ### Support : 27 | 28 | If you like **check-my-net**, please consider supporting it, even the smallest contribution goes a long way. It is quick & easy via PayPal, Buy Me a Coffee or Liberapay: 29 | 30 | [![Support via PayPal](https://cdn.jsdelivr.net/gh/twolfson/paypal-github-button@1.0.0/dist/button.svg)](https://paypal.me/hakerdefo) 31 | [!["Buy Me A Coffee"](https://user-images.githubusercontent.com/1376749/120938564-50c59780-c6e1-11eb-814f-22a0399623c5.png)](https://www.buymeacoffee.com/hakerdefo) 32 | [![Support via Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/hakerdefo/donate) 33 | 34 | 35 | 36 | ### License : 37 | [![Public Domain Mark](http://i.creativecommons.org/p/mark/1.0/88x31.png)](http://creativecommons.org/publicdomain/mark/1.0/) 38 | This work (check-my-net, by [hakerdefo](https://github.com/hakerdefo/check-my-net)), identified by [hakerdefo](https://hakerdefo.github.io), is free of known copyright restrictions. 39 | 40 | [check-my-net-main]:https://github.com/hakerdefo/check-my-net/archive/refs/heads/main.zip 41 | --------------------------------------------------------------------------------