Search code examples
linuxrouterportforwardinggatewayupnp

UPnP portforwarding persist


I'm trying to make a portforwarding for different ports for communications, but it seems they are lost on reboot.

I'm using a script to make them, and it uses the following syntax:

upnpc -a 192.168.1.95 22 22 TCP
...

Since my system is made to actually stress the gateway to reboot, I need to have these ports open after a reboot. I could do it in the software (running the script if connection lost), but I don't want to do that unless it is absolutely necessary.

Do you have some idea of how to make a portforwarding with UPnP such that the forwarding is persisted after a reboot?


Solution

  • Port mappings are specifically not required to be persistent between gateway reboots, clients are supposed to keep an eye on the mappings and re-map when needed. WANIPConnection spec v2 also does not even allow indefinite mappings: another reason to keep the client running as long as you need the mapping to exist.