Menu Close

DD-WRT – (re)setting the gateway via SSH

Today I was toying with my router and accidentally change the gateway to another address.
I still had internet connectivity, but could not access the GUI for my DD-WRT based router.

Luckily, I had enabled SSH on the router so I figured there must be a way to reset my gateway via the command line and I did eventually figure it.

First, I logged into my shell and ran the following commands to show what was available to me:

You’ll see a long, long, long list of commands that are available in NVRAM, which is the place where all settings are stored on DD-WRT.

Scrolling through the list I noticed an option – lan_gateway=1.2.3.4 and figured that was what I need to change!

Next, I ran the following command to set my gateway to 0.0.0.0) since the router is also my gateway):

Then save the changes to NVRAM:

And finally, to verify the changes…

..which returned 0.0.0.0. Success!

Last step is to simply reboot the router and I was finally able to access the DD-WRT GUI again.

Posted in Code, DD-WRT, Tech

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.