Is it possible to change a Linksys router's configuration from a command line?
If you're using ssh, you can have that set up a quick, temporary proxy:
ssh -L 9000:routerip:80 homemachine
Then on your local computer, point your webbrowser to http://127.0.0.1:9000/ and you should see your router's configuration screen. routerip
is the IP that your home ubuntu machine would use to connect to the router.
If you're using puTTY, these settings are under Connection->SSH->Tunnels
Source-port 9000
, destination routerip:80
, type Local
(then click "Add", then open the connection like you usually would).
It's a quick, simple proxy that you can set up any time you need to connect and tweak something.
Some third-party router firmwares (like DD-WRT, OpenWRT, Tomato, etc) provide an SSH interface to the router. I'd enable this on the LAN side but not the WAN. (You could also enable it on the WAN side using a nonstandard port, and a very strong password; likewise you could enable WAN access to the web interface; but I don't recommend those configurations.)
Once enabled, you can SSH into your router from within the LAN. (Eg, if the SSH interface is enabled on the LAN but not the WAN, you'd SSH into your Ubuntu machine, and SSH again from there into the router.) Once there you get a minimal shell (often provided by BusyBox), and have access to configuration files, daemon scripts, firmware settings and whatever commands are installed.
For example, I have an older Linksys WRT54G running OpenWRT. Via the SSH interface, I have access to:
- iptables (eg, for opening temporary ports);
- the /etc/hosts and /etc/dnsmasq.conf files (eg, for adding local DNS overrides or tweaking the DHCP server); and
- the reboot command (if needed).
I can also inspect firmware settings (nvram show), alter them (nvram set), and write them to nonvolitile flash memory (nvram commit). Much of what you can access in the web interface is directly accessible with nvram, but be careful. This old OpenWRT HowTo describes basic nvram usage; there are probably better and more recent guides online, so read up and take care when using that utility.