Script to Clear Ports Forwarded By UPnP

tbrock47

Occasional Visitor
I'm looking for a command/script that will essentially clear any ports forwarded by UPnP (not necessarily all ports if possible) as I find many ports are not auto-closing.
My current solutions are rebooting the router or disabling and then enabling UPnP via the GUI, both of which are not ideal.
I'd like to be able to either run it on-demand via SSH or set it up to run on a schedule (cron?).

Thanks in advance!
 

ColinTaylor

Part of the Furniture
Try:
Code:
iptables -t nat -F VUPNP
iptables -t nat -F PUPNP
iptables -F FUPNP
 

tbrock47

Occasional Visitor
Try:
Code:
iptables -t nat -F VUPNP
iptables -t nat -F PUPNP
iptables -F FUPNP
One or more of those seemed to do it. However, there was no "PUPNP" chain in the nat table.
Do I actually need all three commands?

Code:
[email protected]:/tmp/home/root#
[email protected]:/tmp/home/root# iptables -t nat -F VUPNP
[email protected]:/tmp/home/root# iptables -t nat -F PUPNP
iptables: No chain/target/match by that name.
[email protected]:/tmp/home/root# iptables -F FUPNP
[email protected]:/tmp/home/root#
 

ColinTaylor

Part of the Furniture
Whether the PUPNP chain exists or not depends on which firmware you're running. It's best to issue all 3 commands anyway (just ignore the errors) so that everything is consistent.
 

Latest threads

Sign Up For SNBForums Daily Digest

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