Search code examples
networkingportforwardingnatdhcpupnp

UPnP: Auto-Updating or Removing old port mappings


Does a UPnP portmapping update automatically when the local computers IP updates dynamically? If not then how will you remove the old port mapping if you now have a new IP and will not be "authorised" to do so.

Suppose I could forward right before and remove right after I need the connection to be made. My issue is; what if the computer shuts down mid connection and turns back on with a different IP? Surely something must've been made in order to circumvent this.


Solution

  • Found an answer

    UPnP is soft-state.

    In [1], section 4.1, PortMappingLeaseDuration is described as a state variable that describes that a mapping is only leased for a certain duration. (indeed soft state) also [1], section 5.10, describes that if your router is set up as DHCP it must delete any IGD state for that IP if it changes

    [1] https://www.rfc-editor.org/rfc/rfc6970