How-To Geek

How to Quickly Forward Ports on Your Router from a Desktop Application


UPnP is a convenient way for programs to forward ports without you having to pull up your router’s web interface and forward ports manually. Unfortunately, some programs that require port forwarding don’t support UPnP – that’s where UPnP PortMapper comes in.

This application takes care of port forwarding for you, right from your desktop. If your IP address changes, you don’t need to log into your router and change your port forwarding rules – you can have the application update them for you.

If you visit a friend’s house and join their network, you don’t have to ask for their router’s password to forward ports – just fire up the application and activate your preset rules.


UPnP Port Mapper is written in Java, so you’ll need the free Java Runtime Environment (download from Ninite) installed to run it. After installing Java, you can download UPnP Port Mapper from SourceForge. In addition to Windows, this application also works on Mac OS X and Linux.

UPnP Port Mapper communicates with your router with the UPnP protocol, so you’ll also need a router with UPnP enabled to use this application. If UPnP is disabled on your network’s router, this program can’t do anything.

After downloading UPnP Port Mapper, double-click the .jar file to launch it.


Forwarding Ports

To get started, click the Connect button in UPnP Port Mapper. If you see a Windows Firewall pop-up window, click the Unblock button. You may have to allow Java network access in the Windows firewall pop-up that appears.

If UPnP PortMapper informs you that it can’t find your router, click the Connect button again unblocking the application in the Windows firewall.


If it worked, you’ll see a list of UPnP port mappings in the top pane (this list will be empty by default), as well as your router’s external IP address on the Internet and its IP address on your local network.

To create a new port forwarding preset, click the Create button.


Enter a description for your port forwarding rule and provide a list of one or more ports to forward. You can specify port ranges or forward a list of ports using a single preset.

You can also specify a specific remote host. If you enter an IP address, only traffic from that IP address will be forwarded to your computer from your router. For example, you can use this feature to only allow connections from a friend’s IP address on the Internet.

The Use local host box is checked by default, making it easy to forward ports without having to double-check your computer’s local IP address. However, you could also use this application to forward ports to multiple different computers on your network.


Port forwarding presets you specify will appear  in the Port mapping presets box. Select a preset and click the Use button to activate it.

Clicking this button forwards the ports on your router – they’ll appear in the Port mappings box at the top of the window. You can remove port mappings by selecting them and clicking the Remove button.


The port mappings will be saved on your router until its UPnP data is cleared – depending on your router, this may happen when your router is restarted. If you open UPnP Port Mapper later and click the Connect button, you’ll see your active port mappings.

You will also need to reapply port mapping settings if your computer’s local IP address changes.

With your presets, you can quickly and easily apply these port mapping settings on any network with a router that supports UPnP – this can be convenient if you move around and need to forward ports for gaming, servers, or other purposes.

Chris Hoffman is a technology writer and all-around computer geek. He's as at home using the Linux terminal as he is digging into the Windows registry. Connect with him on Google+.

  • Published 08/21/12

Comments (14)

  1. gifi4

    Ahh, an easier way. I’ve been port forwarding from my routers web page, it’s not hard but I’m sure this will save me time in the future. Thanks!

  2. gerry leddy

    this is way above my head, sorry,

  3. RonV42

    My router has a user interface that works just fine for forwarding ports….I don’t need more Java on my desktop.

  4. r

    exactly, same as RonV42….less Java garbage is always a good thing too.

  5. Holston

    Good information, Chris. Thanks for providing it (in spite of the Apple-knocker comments that contribute nothing).

  6. Lewis Barnett

    I read this site daily, and I agree with MOST tips that get posted. However, on this occasion, I must STRONGLY disagree with this post. From a security standpoint, using UPnP allows changes to be made to your router settings without the need to supply any credentials. This is just a bad idea on the whole. One of the first things that should be done when setting up a router is to disable UPnP. If you don’t know how to forward a port to a certain device, have a friend who understands what to do make the necessary changes for you.

  7. salada

    Great article. I’ve been looking for something like this to install on my laptop. I use an SSH server on my laptop, and if my laptop was ever stolen, this would be a great help in finding it. If someone plugged my stolen laptop into their home network, normally you’d be pretty screwed when trying to make an inbound connection to it (assuming you had the IP, via DynDNS), this app could automatically port forward my SSH connection. Coupled with a dynamic DNS service, it would make finding stolen equipment a lot easier in that short window of time you have before someone wipes it/reformats it etc.

  8. fallout330

    I Didn’t consider that Lewis Barnett. Another good reason to stick with the integrated router interface. DD-WRT ftw. ;)

  9. dohouch

    Using Win 7 x64 Home Premium, have both Java versions installed 32 & 64 bit ,
    but ” PortMapper-1.9.4.jar” won’t launch.

    Been Googling but no luck so far.

  10. nobother

    Thanks for the post.

    The little app is just what I needed. Many landlords are offering Internet now and I am one of the lucky ones who gets it for free. But that means no access to the router settings. So accessing computers while away is a challenge. Teamviewer solves much of that, BUT you have to turn on “File sharing” which exposes you to the whole building. It also exposes your mobile computer to the dangerous public network you’re borrowing. SFTP is the answer. However, the ports need to be forwarded in your home router. (I’d also like to get WOL working.)

    PortMapper to the rescue! It worked like a charm but I have a question below.

  11. nobother

    The graphical interface for Portmapper.jar worked great but I would like to start it with Windows automatically. To get the command line options I typed
    “java -jar PortMapper.jar -h”

    to add the forwardings, I typed

    “java -jar PortMapper.jar -r 3000 tcp”

    the syntax is

    java -jar PortMapper.jar -r

    I got something about IllegalArgumentException: No enum constant. It does query the router, and list the current open ports when I use the -l option alone though. WHAT THE HECK DOES […] MEAN? I have tried everything for that variable including my internal ip, external ip, “udp,” the description, the port range 3000-3000, the external port and protocol (just repeated “3000 tcp” again, and actually typing “external.”

    All of these give me “invalid number of arguments for r.”

  12. nobother

    Sorry. The syntax is:
    java -jar PortMapper.jar -r

  13. nobother

    This website keeps deleting the part after -r. Anyway, query the command line with
    java -jar PortMapper.jar -h

    and you’ll see how he indicated the variables. He seems to want -r port protocol SOMETHING.

  14. PMToolsThatWork (Bruce)

    Great tool. Was looking for something like this the other day. Works fine with dd-wrt router software. Quicker and simpler than pulling up the router web page. Since I have UPnP turned on (makes life easier) than having a tool like this to review and manage it is handy.

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!