Search code examples
c#comupnpportforwarding

Can I instantly forward a port-range with UPnP?


I am currently using the COM object "Interop.NATUPNPLib" in order to port-forward a couple of ports using UPnP.

I can forward ports individually just fine, but now I have a port range that I want to add (say 8463 through 8467), but all that this COM library is letting me do is add single ports in the form of integers.

How am I to forward an entire range? Will I have to add every port in the specified range individually, or is there another solution?


Solution

  • From the UPNP / IGD spec here http://upnp.org/specs/gw/igd2/ I'm not seeing a way to add port ranges in the spec. There is an option to remove mappings by range, but I only see commands to add mappings one at a time. If I'm reading the spec correctly, and some library out there does allow for port ranges, then it must be looping through and adding them one at a time behind the scenes anyway.