«

»

Jan 21

What is Port Forwarding

In simple terms port forwarding is the process of forwarding data to a port on a specific computer or ip address. Port forwarding can be complex but this article is intended to give you a basic understanding of what port forwarding does without all the jargon.

A good example of the use port forwarding is gaming in a home with multiple computers or laptops. You do not want your router blocking data that is intended for the game you are playing and you want that data to get to your computer as quick as possible to improve lag and game speed so you setup port forwarding to let that data in and send it straight to your computer.

When data comes into your router even if it only has one computer connected to it there are still 65536 paths it can choose (ports on each computer). When a data packet comes in it has a port number it is destined for. Now sometimes these ports are blocked and the data is not allowed through which results in disconnection or no connection at all to your game server. You can think of these paths as little roads on your network into your computer from the router, you want to send it via the quickest road which is exactly what port forwarding does and you also don’t want it to reach a dead-end.

To simplify we will pretend each device on your network is a highway and each port is a junction or turn off. Think of a typical home network, a router that is used by a desktop computer, a laptop, a tablet and 2 mobile phones. That is 5 devices connected to your home network which means 5 private ip addresses (or highways)

Now we are playing a game on our desktop computer and we are told by the game creators that we need to forward ports 5000  and 6001 for the game to work correctly and get the best experience from it so we need to tell the router to do the following 3 things.

  • We need to allow data from ports 5000 and 6001 to come in.
  • All data that comes in that is destined for ports 5000 and 6001 that we have now allowed needs to be redirected onto the desktop highway.
  • Once on the desktop highway that data needs to turn off at 5000 and 6001 respectively.

Now this is a very basic example there are much more complex settings you can configure such as times to allow and not allow which ports to forward to. For example you may want data that is destined for port 5000 to actually go to port 5001 on the desktop computer as port 5000 is in use.

The following is an example of port forwarding setup in a router.

port forwarding

It should be quite clear to see what is going on here but let’s walk through it.

Application: this is just the name given.

Protocol: There are UDP and TCP protocols we wont get into these now but for the purpose of this article we will just use UDP which is pretty standard for gaming due to its stateless nature

External Port: This is the port number that the packet of data is destined for.

Internal IP: This is the IP address that we want the data to go to.

Time schedule: As previously mentioned for security reasons you can set a time to enable and disable the forwarding.

You may also see that there are a couple that have the following 50000~65535. This means all ports between 50000 and 65535 should be forwarded.

Now each router is different but this should give you an idea of how to set up port forwarding on your router and give you a basic understanding of what port forwarding is.