Reference Manual


upnpc - interact with an external UPnP Internet Gateway Device
setuc [ifn.gwn | cname]                  # Host interface and gateway

upnpc -a ip port external_port tcp | udp # Add port mapping
upnpc -d external_port tcp | udp         # Delete port mapping
upnpc -e [ip]                            # External IP address
upnpc -i [msec]                          # Initialize device list
upnpc -g [ip]                            # Gateway status
upnpc -n [ip]                            # Get model name
upnpc -s [ip]                            # Device status
upnpc -l                                 # List port mappings
upnpc -r port1 tcp | udp [...]           # Map these ports to the host interface


The upnpc command sends control and status requests to the external UPnP-enabled Internet Gateway Device gwn via the interface ifn specified with command setuc (default is the first gateway of the current Windows "best" interface).

The upnpc command supports the following arguments:

-a   adds the specified port mapping to the device's Port Forwarding Table.

-d   deletes the specified port mapping from the device's Port Forwarding Table.

-e   prints the device's current external IP address.

-i   initializes the device list.

-n   prints the friendly name of the specified device.

-s   prints current status details of the device.

-l   prints current status details and mappings of the device.

-r   maps the specified ports to the Windows IP address of the host interface.


The UPnP Protocol does not allow port mappings other than those that were added via UPnP itself to be manipulated.

Some IGD's require that an administrator first enable full UPnP support before mappings can be added or deleted. Some even have all UPnP support disabled per default.

NAT32 UPnP support is based on code kindly supplied by Thomas Bernard's MiniUPNP Project. It does not require any UPnP or XML capabilities of the Operating System on which it runs. The code will therefore work correctly on all Windows and Windows-compatible platforms (e.g. ReactOS).