123
Senior Member
NOTE: Applies to routers flashed with Tomato or DD-WRT firmware.
I recently upgraded my home router, from an ancient Netgear FVS318 plus WG102 Wireless Access Point, to a Cisco/Linksys e3000. Within a few days, I replaced its stock firmware with TomatoUSB (Toastman's build) and it is running fine. The VOIP hiccups I had with the old gear are gone and I didn't even have to employ Tomato's powerful QoS feature.
Not willing to leave good enough alone, I wanted to have my Home Automation system turn off the router's wireless radio whenever the ELK M1 was Armed Away or at bedtime. Given Tomato's impressive feature set, it seemed like an easy thing to do.
Looking for an easy solution, I wanted to use a URL to enable/disable the radios. After sifting through Tomato and DD-WRT's forums, posting a question and getting meager feedback, it became clear that I'd have to look elsewhere.
Telnet and SSH seemed to be the only way to access the router. After looking high and low for free, scriptable SSH clients, I found two solutions:
Bitvise Tunnelier
WinSCP
Tunnelier includes a console program called "sexec" that allows you to automate the process of logging in to the router, running a command, and logging out.
Assuming you have manually logged in and saved the session details (i.e. host name, username, password, RSA2 public key, etc) in a file called "MyRouter.tpl", here is all that's needed to disable the router's wireless radio:
sexec -profile="MyRouter.tpl" -cmd="wl radio off"
Naturally, your HA software needs to be able to execute DOS shell commands to take advantage of "sexec".
The e3000 has two radios, 2.4GHz (eth1) and 5Ghz (eth2). As a result, the "wl radio off" command only turns off the first radio (2.4GHz). To turn off the 5GHz radio, you use "wl -i eth2 radio off".
The latest version of WinSCP offers a .NET and COM library and allows for true 'native scripting' (assuming your HA software supports .NET or COM). You can write a driver for your HA software as opposed to using a shell command.
For example, here's the code, in VBScript, to turn off the first radio. FWIW, 90% of it is to set up the connection and only the last line executes the desired command.
For my HA software (Premise), WinSCP's .NET and COM Library is a better fit but Tunnelier's sexec also gets the job done.
Given the ability to execute commands on the router (and put/get files) it need not be limited to simply enabling/disabling radios. Your home's occupancy status can govern other router characteristics such as Internet Access, Port Redirection, Guest Networks, etc.
I recently upgraded my home router, from an ancient Netgear FVS318 plus WG102 Wireless Access Point, to a Cisco/Linksys e3000. Within a few days, I replaced its stock firmware with TomatoUSB (Toastman's build) and it is running fine. The VOIP hiccups I had with the old gear are gone and I didn't even have to employ Tomato's powerful QoS feature.
Not willing to leave good enough alone, I wanted to have my Home Automation system turn off the router's wireless radio whenever the ELK M1 was Armed Away or at bedtime. Given Tomato's impressive feature set, it seemed like an easy thing to do.
Looking for an easy solution, I wanted to use a URL to enable/disable the radios. After sifting through Tomato and DD-WRT's forums, posting a question and getting meager feedback, it became clear that I'd have to look elsewhere.
Telnet and SSH seemed to be the only way to access the router. After looking high and low for free, scriptable SSH clients, I found two solutions:
Bitvise Tunnelier
WinSCP
Tunnelier includes a console program called "sexec" that allows you to automate the process of logging in to the router, running a command, and logging out.
Assuming you have manually logged in and saved the session details (i.e. host name, username, password, RSA2 public key, etc) in a file called "MyRouter.tpl", here is all that's needed to disable the router's wireless radio:
sexec -profile="MyRouter.tpl" -cmd="wl radio off"
Naturally, your HA software needs to be able to execute DOS shell commands to take advantage of "sexec".
The e3000 has two radios, 2.4GHz (eth1) and 5Ghz (eth2). As a result, the "wl radio off" command only turns off the first radio (2.4GHz). To turn off the 5GHz radio, you use "wl -i eth2 radio off".
The latest version of WinSCP offers a .NET and COM library and allows for true 'native scripting' (assuming your HA software supports .NET or COM). You can write a driver for your HA software as opposed to using a shell command.
For example, here's the code, in VBScript, to turn off the first radio. FWIW, 90% of it is to set up the connection and only the last line executes the desired command.
Code:
set sessionOptions = WScript.CreateObject("WinSCP.SessionOptions")
with sessionOptions
.Protocol = 1 ' SCP
.HostName = "192.168.X.X"
.UserName = "myusername"
.Password = "mypassword"
.SshHostKey = "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
end with
set session = WScript.CreateObject("WinSCP.Session")
session.Open sessionOptions
session.ExecuteCommand("wl -i eth1 radio off")
For my HA software (Premise), WinSCP's .NET and COM Library is a better fit but Tunnelier's sexec also gets the job done.
Given the ability to execute commands on the router (and put/get files) it need not be limited to simply enabling/disabling radios. Your home's occupancy status can govern other router characteristics such as Internet Access, Port Redirection, Guest Networks, etc.