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:
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
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop














{ 8 comments… read them below or add one }
thanks man !,
i was looking for this exact cgi command to reboot my router from a remote location
On a italian website someone wrote a script with curl to execute shell commands on the router.
http://www.hwupgrade.it/forum/showthread.php?t=2084276&page=97
I had to use this on a SPA400
username of Admin and no password, and the different path in the URL.
curl -u ‘Admin:’ ‘http://10.56.272.56/html/setup.cgi?todo=reboot’
Thanks, you saved my day
Yeah! Thanks man! That’s great…
Thanks It works perfectly on windows ;)
just change ‘ to ”
curl -u “username:password” “http://192.168.1.1/setup.cgi?todo=reboot”
How about a command to forcibly release and renew the external IP address for a Linksys E4200?
Thanks man