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:


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' ''
curl -u 'admin:Your-Password-Here' ''

Further readings:

man curl

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 14 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
14 comments… add one
  • tom Aug 25, 2010 @ 16:51

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

  • carlo Sep 13, 2010 @ 21:23

    On a italian website someone wrote a script with curl to execute shell commands on the router.

  • Criggie Oct 20, 2010 @ 2:01

    I had to use this on a SPA400
    username of Admin and no password, and the different path in the URL.

    curl -u ‘Admin:’ ‘’

  • Sam Aug 15, 2011 @ 0:24

    Thanks, you saved my day

  • MIDIphil Sep 1, 2011 @ 8:03

    Yeah! Thanks man! That’s great…

  • Saeed Jul 12, 2012 @ 6:41

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

    curl -u “username:password” “”

  • Mr. Velous Feb 8, 2013 @ 20:53

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

  • hima May 12, 2013 @ 12:35

    Thanks man

  • nick Jun 3, 2013 @ 0:40

    Thanks a million

  • Hamid Aug 1, 2013 @ 12:26

    Thanks! This worked for my WAG120N modem.

  • Mark Dec 16, 2013 @ 20:33

    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


    * About to connect() to port 80 (#0)
    *   Trying connected
    * Connected to ( 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/ zlib/1.2.3 libidn/1.18 libssh2/1.4.2
    > Host:
    > 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
  • ramkumara Oct 14, 2014 @ 22:29

    thanks worked perfectly on my stupid wag120n router

    i dunno y the guys from linksys din give this option to reboot form web console


  • Dan Dec 28, 2014 @ 16:16

    I did the firmware update to version 1.00.19 and they removed this feature!!
    i am so mad!!!!
    can anyone help?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum