We’ve all been faced with messages telling us that we need to “open ports” or “forward ports” for one reason or another. Whether it’s an Internet security feature, remote desktop access, or an online-based game, there may be good reasons for you to set up port forwarding on your router. Before taking the plunge, you should be aware of what this means exactly, the (relatively small) risks involved, and how to keep control over this process.
What Are Ports?
Think of ports as virtual passages inside your router which control traffic going between your computer and the Internet. Only specific ports are kept open at all times, ensuring you don’t get any unwanted or harmful traffic piling on on your computer.
Certain ports have fixed roles, such as delivering website data to your computers (ports 80 and 443), in most cases. Others, meanwhile, are kept free and can be used by other applications (whose developers assign ports for these apps to run on). You can find a full list of router ports and what they’re assigned to here.
First, Set Up a Static IP Address
In order for port forwarding to work, you’ll need to set a static internal IP address (ipv4) for your device. By default, your ipv4 address is probably dynamic, which means it’s always changing, so the port forwarding won’t be able to pin down your device on your home network.
Go to “Control Panel -> Network and Sharing Centre -> Change adapter settings.”
Right-click “Local Area Connection,” click Properties, then under the Networking tab select “Internet Protocol Version 4” from the list and click Properties.
In the new box select “Use the following IP address.” What you enter here will depend on your IP settings. To check your IP settings, go to the command prompt and enter
IP address: This needs to have the same subnet as your default gateway, so only change the numbers after the final dot. For example, our default gateway is “192.168.0.1,” and we made our IP address “192.168.0.100.”
Subnet mask: Enter the same number as what is shown in ipconfig.
Default gateway: Again, same numbers that you see in ipconfig.
Preferred DNS server: Same as the DNS servers in your ipconfig.
When you’re finished, click OK, and you should have a functioning static IP address.
The process for doing this in Ubuntu is a little more elaborate, so we’ve written up a proper guide for setting up a static IP address in Ubuntu.
How to Open Ports and Set up Port Forwarding on Your Router
First, remember that it might not be your router blocking ports but your firewall, so before digging into your router, check your firewall settings and see if you can control your ports from there. (How to do this will vary between different firewalls.)
Once you’ve done that, and you still need to open up the ports, it’s on to the router. Again, this process will vary from router to router, but the general gist of it is the same. We’ll be doing it on a Virgin Hub 3.0.
1. Log into your router through your web browser. My router address (default gateway) is 192.168.0.1, but this may be 192.168.1.1 for you or something else altogether. There’s a good chance your router address (and password) is written on your actual router, so check that.
2. Once you’ve logged into your router, head over to “Port Forwarding.” For me this is under “Advanced -> Security,” but it may vary slightly for you.
3. Now, the important bit. You’ll be presented with a scary-looking list of boxes to fill with numbers. It’s not so bad.
- Local IP: Enter the number of the static IP address you set up earlier.
- Local start and end point: In most cases these can be the same as the “external start point and external end point.” It can be a range of ports (8035-8040, for example), or it can just be one port in which case you put the same number into the start and end point boxes. If you have multiple devices connecting to the same application, then you may want to make the “local” port number different from the fixed “external” one.
- External start point and end point: This is dictated by the port used by your given application. Refer to the list we linked to earlier to find the application.
- Protocol: The application should specify what kind of protocol it uses. Most are TCP, some are UDP, but if you’re unsure, select “Both.”
- Enabled: Switches the port forwarding on or off.
Below is the port forwarding setup we created to run a private Minecraft server, using the port numbers assigned by Minecraft.
Port forwarding has a lot of uses, and while most applications are set up to do the job for you, it’s good to be prepared should you need to take control of the situation. Now you are, so happy forwarding!