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

by on July 15, 2010 · 11 comments· LAST UPDATED August 25, 2010

in

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

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

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 11 comments… read them below or add one }

1 tom August 25, 2010 at 4:51 pm

thanks man !,
i was looking for this exact cgi command to reboot my router from a remote location

Reply

2 carlo September 13, 2010 at 9:23 pm

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

Reply

3 Criggie October 20, 2010 at 2:01 am

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’

Reply

4 Sam August 15, 2011 at 12:24 am

Thanks, you saved my day

Reply

5 MIDIphil September 1, 2011 at 8:03 am

Yeah! Thanks man! That’s great…

Reply

6 Saeed July 12, 2012 at 6:41 am

Thanks It works perfectly on windows ;)
just change ‘ to ”

curl -u “username:password” “http://192.168.1.1/setup.cgi?todo=reboot”

Reply

7 Mr. Velous February 8, 2013 at 8:53 pm

How about a command to forcibly release and renew the external IP address for a Linksys E4200?

Reply

8 hima May 12, 2013 at 12:35 pm

Thanks man

Reply

9 nick June 3, 2013 at 12:40 am

Thanks a million

Reply

10 Hamid August 1, 2013 at 12:26 pm

Thanks! This worked for my WAG120N modem.

Reply

11 Mark December 16, 2013 at 8:33 pm

Hi, I’m trying to do the same thing with 2 WRVS4400N in to different locations, But CURL says ‘Authorization required.’

Could anyone help???

full output of CURL below

Many Thanks

Mark

* About to connect() to 192.168.98.1 port 80 (#0)
*   Trying 192.168.98.1... connected
* Connected to 192.168.98.1 (192.168.98.1) port 80 (#0)
* Server auth using Basic with user 'admin'
> GET /setup.cgi?todo=reboot HTTP/1.1
> Authorization: Basic YWRtaW46c3Rhbm1hcnNo
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 192.168.98.1
> Accept: */*
>
< HTTP/1.1 401 Unauthorized
< Server:
< Date: Thu, 01 Jan 1970 13:14:50 GMT
< WWW-Authenticate: Digest qop="auth", realm="Router", algorithm="md5", nonce="69d06f17b485a43084f444ac2958e99e"
< Content-Type: text/html
< Connection: close
<
            401 Unauthorized
            401 Unauthorized
Authorization required.
* Closing connection #0

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: