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

1.12K 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

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.

You are viewing 1 out of 3 answers, click here to view all answers.