What Is Port Forwarding

How Do you feel when someone tells you there’s a port forwarding problem and that’s why your shiny new app won’t work? Your Xbox won’t let you play games, your torrent downloads refuse to start, or your web server can’t be accessed? Well, I’m here to dispel the difficulty and explain just what port forwarding is, and how it can help you.

What Are Ports?

You probably have a good idea about how networks work already, in that each device has an IP address. There are two types of IP address; public and private. Public IP addresses are accessible anywhere in the world; private ones are used on internal networks – such as 192.168.x.x, or 10.0.x.x. In order to receive information back from the Internet, data requests are sent out with both a global IP address – corresponding to your router – and a local IP address, corresponding to your PC or other networked device.

Now, this is all well and good when we’re just talking about browsing the web, but what about when you start to request different kinds of data – like from torrents, or game-specific information for that MMO, or even email? How does your computer know which application the data is destined for? That’s where ports come in.

port-fwd-01

Ports

Ports are like mail sorting tubes inside your computer. When a data packet comes in for your PC, the operating system has a look at the port number it’s destined for. Each port corresponds to a different application, and there are 65,536 ports in total available to use.

port-fwd-02

Some of these ports (the first 1,024) are fixed – a per-determined standard that helps core applications to communicate across the globe. For example, unsecured web traffic requests are almost always served through port 80; I say “almost always” because it depends on your server software, but port 80 is the standard for Apache HTTP traffic. POP3 incoming email is handled by 110, while SMTP outgoing in on 25; FTP on 20 and 21. You can see the full list of well-known ports on Wikipedia.

Beyond port 1024 is basically a free for all; for applications to use these, the easiest way is to use Universal Plug and Play.

UPnP

Ports are blocked by default on routers; this is an essential security feature, and prevents malicious requests from reaching all the core services which may be running on your computers. Obviously, this can also cause problems for any application that needs information sent back to it from the Internet; the router will just block it.

In order to allow data to be sent from the Internet side to an internal computer, the computer must tell the router to forward a particular port. This means that when the router sees a packet destined for a specified port, it will forward it on to a specific local machine.

To save you the hassle of setting up port forwarding manually every time, UPnP was invented. This is a protocol whereby an application can request a port and automatically set up the port forwarding rules. For the most part, UPnP works fine and the process of port forwarding will be entirely invisible to you.

Manual Port Forwarding

Sometimes UPnP won’t work; or you might have disabled it for security reasons. A rogue application running on your internal network could potentially open it right up using UPnP. In these case, you need to manually open up the ports.

You’ll need to know a few things to set up manual port forwarding.

  1. How to access your router configuration page; typically, this means typing in the gateway address of your network (such as 192.168.0.1). If you’re unsure, check this list of guides by manufacturer.
  2. Which port, or range of ports need to be forwarded.
  3. The IP address of the computer you’re forwarding to.

Some applications will also specificy whether to send UDP or TCP packets; these are simply different kinds of network traffic and not all applications use both types. If in doubt, just forward on both; there won’t be any adverse effects.

port-fwd-03

Open up the router configuration page to the port forwarding section – this will likely be under security settings. They may be an option to select “Service” for predefined ports, but I’m going to assume you know exactly what port you want forwarded, so skip that bit.

Give your rule an arbitrary name – like “torrents” – then type in the port range that you wish to forward. If it’s just one port, you may need to either enter the same port for both the start and end, or just fill in the start. Again, select both the UDP and TCP protocols if you’re unsure, and then fill in the address of the machine you want it forwarded to. Note that this isn’t going to work if you’re constantly resetting your router; machines may later be assigned a different IP address, and the port forwarding table rules will break.

port-fwd-04

Why Bother?

If the application you’re trying to configure doesn’t work with UPnP, you will almost certainly need to open some ports. That’s rare nowadays, but can happen.

Another occasion you will definitely need to forward ports is if you’re running your own web server that you want to be accessible to the world. In that case, you would forward port 80 to the server and any HTTP requests to your modem would be sent to the server. Bear in mind that running a web server may be against the Terms Of Service of your ISP, so check first.

I hope you now understand what port forwarding is and why you might need to configure it. To be honest, manual configuration is rarely needed nowadays outside of running your own server, and certainly isn’t needed for gaming – but it’s good to know anyway.

Speak your Mind