Rebooting the ADSL Router when it cannot Access Internet

The ADSL Modem hangs every now and then.. a reboot work all the time.. this is a issue if there is nobody to reset the modem or the site is remote.

The solution is a simple script in Python which check if “Google” is accessible every 5 min, if google is not available then reboots the ADSL Router, { Not included in the script due to dependencies: you could also send a email or syslog event at every reboot or send the copy of the log File end of the Day}

The Python Script Runs on a Linux Box.. nothing great and simple box. using Python and pExpect, the script logs into the modem whenever it cannot ping and send a reboot command to the router. A log of the Reboot is maintained.

The CRON is enabled to periodically check availability of internet access through the modem.. every 5Mins.. (for India with BSNL) but any larger time frame can be used, as required
 —System Requirements —
1. Linux Box (I use the Synology NAS)
2. Apache (NAS come pre-installed, not essential required only if GUI Interface is required)
3. Python (check after login in through terminal “~$ python -V” should show the version Installed)
4. pExpect (again at terminal “~$ which pexpect” should show the path if installed

if not then type the following at the terminal

for modem with reboot CLI Click to Download RebootADSL
for Modem which use the 1-9 keystrokes CLI Click to Download rebADSL

of course this method works for any network device with has CLI (Telnet), open socket to the IP Address of the Device to check..

Posted in Automation, Network Hardware, Python, Storage, Surveillance and tagged , , .

Leave a Reply