Reboot Linksys WAG160N / WAG54 / WAG320 / WAG120N Router / Gateway

I‘m using a Cisco Linksys WAG320N Router to connect my OS X UNIX and Linux systems to the Web. How do I reboot my Linksys WAG series router / gateway (modem) from UNIX / Linux / OS X bash command prompt or using a shell script?

The Cisco linksys series modem removed reboot option from its web interface but you can reboot the router using the following url format:

http://your-router-ip/setup.cgi?todo=reboot
http://192.168.1.1/setup.cgi?todo=reboot

Sample outputs:

Fig.01: Rebooting Cisco Linksys Router / Gateway

The web interface hack works with any web browser regardless of the operating system.

Command Line Options

curl is a command line tool for transferring data with URL syntax, supporting various protocosl such as FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, IMAP, SMTP, POP3, RTMP and RTSP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos), file transfer resume, proxy tunneling and much more. The same tool can be used to reboot your router as follows:

curl -u 'Router-username:password' 'http://192.168.1.1/setup.cgi?todo=reboot'
curl -u 'admin:Your-Password-Here' 'http://192.168.1.1/setup.cgi?todo=reboot'

Further readings:

man curl

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.