When you’re hosting a service from your PC and you need to accept incoming connections, you’ll need to configure your router to allow those connections by forwarding a port or enabling UPnP.Image credit: Fawkes Wei on flickr
If you are hosting a service from your PC, such a gaming server, you can allow others to connect to your server by giving them your IP address. Unless your router has been properly configured, it will either block their incoming connection automatically because of security settings, or it will not know which device on your network to send the request to and resort to refusing the connection.
You basically have two options, then. You can manually forward the appropriate port(s) and allocate a static IP address for your PC, or you can enable UPnP on your router. See our guide on enabling UPnP if you’d like to try that route, or continue reading to learn how to forward ports on your router.
What is port forwarding?
By configuring your router to forward a port to your PC, you are telling it to accept that incoming connection and also giving it information about where to send it. Port forwarding is a manual process that must be done in the router’s settings.
Keep in mind that in order for your forwarding settings to remain in place between reboots (of either the PC or the router), you should configure a static IP address for your PC in the router’s settings because the local IP address of your PC (the one that the router uses to communicate with it), likely changes every once in a while, which means your forwarding settings would need changed too.
To prevent that, we can add a setting to your router that tells it to always hand out the same IP address to your PC. We’ll go over how to set that up while also making the necessary configurations for port forwarding.
How to forward a port on your router
Linksys is a popular consumer brand of routers, and we’ll be using one in this guide to show the steps to forward a port and allocate a static IP. If you have a different brand of router, the instructions should be pretty similar, you’ll just have to improvise where applicable.
Accessing your router’s settings page can be done from your PC (or phone, or any device that has a browser and is connected to your network). The first thing we need to do is figure out the local IP address of the router. It’s normally in the 192.168.x.x range, but it can vary by manufacturer.
Start by opening a command prompt by typing ‘cmd’ in the Start menu.
In the command prompt, type ‘ipconfig’ and press enter. What we’re looking for in this output is the IP address of the ‘default gateway’ (a fancy term for your router).
As you can see in the screenshot above, the IP address of my router is 192.168.1.1. Type that address into the URL bar of your browser in order to access your router’s configuration page.
You’ll be asked to enter a password on this page. For Linksys and a lot of other popular manufacturers, it’s ‘admin’ by default. Your password may be on a label on the router itself, so check there if you’re not sure.
We’ll start by configuring a static IP address for our PC. In the Linksys menu, those settings can be found under ‘Connectivity.’ You’ll have to poke around if you’re using a different brand. You’ll know you’re in the right menu when you see something called ‘DHCP reservations.’
On this router, the setting for DHCP reservations was under Connectivity > Local Network.
In the DHCP reservation menu, you can select your PC (the one running the service you’re hosting), click on ‘Add DHCP Reservation,’ and click OK to save the setting.
If your menu doesn’t have your devices listed, you may have to enter the IP address of your PC manually to create the reservation. Refer back to the command prompt to figure out what your PC’s IP address is.
Either way, take note of your IP address (either by seeing it in the DHCP list or the command prompt) because you may need it when filling out the port forwarding settings.
Port forwarding is found under Security > Apps and Gaming in our Linksys router. From here, we can choose to forward a single port or a range of ports. Select whichever is applicable for you, then fill out the ports and your IP address, and click OK.
Your service should now be accessible from the internet. You can use this port forwarding tester website to make sure that it’s working correctly.
Share your public IP address with whomever you’d like to give access to. Keep in mind that you may also have to configure your firewall settings and/or disable your anti-virus, since both of those are also known to block incoming connections.