Port Forwarding! What is it and why do you do it in gamming?

1.09K views

Through the years i’ve seem a lot of games with high latency that tell me to do it. I just never did it nor know how or what it does.

In: Technology

3 Answers

Anonymous 0 Comments

Imagine all the different devices that are using your Wifi as apartment buildings with each program living in one apartment. Now imagine your router as a gatekeeper controlling access to and from your device neighbourhood.

Ports are like the postboxes of each building, so that if you want to talk to f.i Quake you need to put your letter in to the port reserved by Quake in the computer running the game.

However, how do you get past the angry looking guard that is the router? He will happily take your letter and bin it, because he does not know who this “quake” person is and he is not going to find out what apartment has his postbox.

Port forwarding is like you going to the router and saying “I like to reserve one of your community P.O boxes. Whenever someone comes with a letter and puts it in this P.O box, please take it to my Desktop apartment and put it in postbox 140, where Quake lives.

This makes the router happy. Now people can send letter to Quake, leave them with the router, who sends it on to the correct device and program, instead of angrily chucking it in the bin because he doesn’t know where it should go and if it is safe or not.

Anonymous 0 Comments

Basically your internet router has a built in firewall. By default, it blocks a whole bunch of incoming connections because, well, that’s security. Turns out you want to play Quake, and you find out you need to forward a port so that you can connect to a Quake server. If you don’t forward the port, it is impossible to create a connection and you cannot play.

[https://portforward.com/quake/](https://portforward.com/quake/)

This is just an example, but you might need to do so with your streaming software, your discord, etc.

Anonymous 0 Comments

You probably, like most people, have a router in your home, allowing you to connect multiple devices to the internet. Practically every consumer router uses something called Network Address Translation (NAT).

So you know that every device on a computer network is assigned a unique number, called an IP address right? With NAT, each device in your home network is assigned a *local* IP addresses, from a range of IP addresses that everyone in the computer networking industry agreed would be reserved for private networks. Like 10.x.x.x or 192.168.x.x. Your computer might have the IP address 192.168.1.2 on your home network, but that same IP address can be used by your neighbour on their network.

But when your computer wants to talk to a device outside of your local network, like the internet, it needs to be identified with its *public* IP address, otherwise the traffic won’t come back. Your router translates that internal IP address to the external address. And when the response to that request comes back, it does the reverse. This is NAT.

So that’s fine when your computer is initiating the connection, but then the problem is, what happens if you’re waiting for someone else to connect to you, ie. your computer is the server? Your router doesn’t know your computer is waiting for connections from the internet, and will ignore any data packets it doesn’t know which device to send it to. And those internet devices are trying to connect via your public IP address – they don’t know what your private IP address is, and don’t have any way to send data to it even if they did. So you specifically tell your router, the device with address 192.168.1.2 is listening for connections on port 1234. Then it knows that any data it receives for port 1234 should be sent to that device. That function is called port forwarding.

So to summarise, port forwarding is a function of your router that allows you to specify that connections from outside your network, for a specific port, should be forwarded to a specific device on your private network. And the reason you do it, is because it’s necessary in order to receive network data from an unknown source, that your router would otherwise ignore.

As for how you do it, every consumer router I know of allows you to configure it via a web-based interface. So you type the address of your router into your browser, and find the Port Forwarding section of its config. Then specify which ports you want to forward to which device.

So how is it related to multiplayer games? Well first thing is, not every game uses this model of one player connecting directly to the other, which we would call Peer to Peer (P2P). Many games use the client/server model, where every player connects to a commercial server (run by the game developer or multiplayer platform provider, eg. EA, Sony, Valve) already configured to accept incoming connections. So no port forwarding necessary since the players only have outgoing connections.

Where the P2P model is used, there are [several techniques](https://en.wikipedia.org/wiki/NAT_traversal) that game developers can use to try and get around NAT issues, but they’re not always reliable. You would think that this means that the connection either works or it doesn’t; but the way they are implemented, there can be partial failures where the connection ultimately works, but is slower, eg. takes an inefficient path over the network to get there. In this case, the game can have lag, which is why many multiplayer troubleshooting steps recommend port forwarding if you have slowness/connectivity issues. Or at least they used to, I haven’t seen it much recently, but that may be because more games these days use dedicated servers, I guess to persist player progress, prevent cheating etc.