What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Turn port forwarding on/off via telnet or REST API?

jmltech

New Around Here
Is there a way to turn port forwarding on or off using telnet commands, or sending a web string to the router using REST?

We have a few pet cams in the house. My wife would like to have these be "off" from accessing from the outside internet when she is home, but be able to easily turn on when we are away. I was thinking of putting something together that can control this from my alarm ' away' mode, or writing a script to telnet into the router and issue the proper commands.

Thanks all!
 
the port forwards are added like thus;

Code:
iptables -A VSERVER -p udp -m udp --dport 3074 -j DNAT --to 192.168.1.100

to specify another inside port i believe would be like;

Code:
iptables -A VSERVER -p udp -m udp --dport 3074 -j DNAT --to 192.168.1.100:3075
and to remove the rule would require using the exact same string, but changing -A to -D, like thus;
Code:
iptables -D VSERVER -p udp -m udp --dport 3074 -j DNAT --to 192.168.1.100

change udp to tcp as needed, etc
 
Thanks for the info. I had seen these commands in the WIKI to add and delete. Since the only port forward rules that I have is the webcams, I was looking for something like an on/off switch. After doing some comparisons with 'nvram show' after changing the gui for turning port forwarding on and off, it appears the switch to do this is:
Nvram set vts_enable_x=0 (or 1 to turn on)
Nvram commit

Now i'm looking for how to reload so the router 'sees' the new value - much like hitting "save" on the gui?

Thanks again for your suggestion and help!
 
After some searching, I found that I can issue a "reboot" to restart the router from telnet. I was wondering if there is another command or service start that I can issue just to reload the value of the port forwarding? Or, is "reboot" faster and safer?
 
After some searching, I found that I can issue a "reboot" to restart the router from telnet. I was wondering if there is another command or service start that I can issue just to reload the value of the port forwarding? Or, is "reboot" faster and safer?

Restarting the firewall would probably be enough (I didn't test it):

Code:
service restart_firewall
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Staff online

Back
Top