What's new

Scripting/Automating Port Forwarding?

  • 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!

reub

New Around Here
I'd like to programmatically enable and disable port forwarding on my router (use case below).

It should be straightforward enough to write the IPTables rules, but I'm not sure what event (if any) I can use as a trigger. Is updating the nat-start script and rebooting the router the best option here or are there other (less kludgy) approaches I might take?

Use Case: As part of the Let's Encrypt project, SSL certificate issuance and renewal is automated but requires that the requesting domain be reachable. My domain typically resides behind my router and is not reachable from the public internet for a domain validation challenge. Since certificates are relatively short-lived, renewal automation is encouraged. So, I'd like to be able to programmatically open and close the relevant ports in Merlin as part of my renewal scripts.
 
... I think it has been asked several times that this feature is available via the GUI itself and indeed, that would be a very nice and handy feature (available in Tomato) ....
GS
 
What about a cron job that runs an iptables script in jffs?


Sent from my iPhone using Tapatalk
 
@Schuby Good thought, that would allow it to be open at certain intervals perhaps, but not as part of a script and thus not easily orchestrated into a larger effort.
@GSpock thank you, good to know.
 
Since we're on this subject and I've searched for the last day or so for it, is there a way via command line (ssh of course) to reload the firewall once you make a chance, say to nat-start? I'd rather not have to reboot every time as it seems I have an issue with the ISP constantly issuing me a new IP when I do (like the MAC address of the device attached to the modem is changing, although I have it cloned in settings".

Thanks for any help.
 

Similar threads

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!
Top