This article aims to help you grasp the basic concept of port forwarding. It will give a generic overview how and where the puzzle pieces fit in.
Although is article is a bit advanced for first time users, the general concept of port forwarding it a very important role within the Internet space.
What is port forwarding?
Port forwarding allows connections from outside (the Internet) to access allowed resources inside (you PC behind a router).
Why do I need port forwarding?
If you want to host a game, or allow people access to files, or share information with the outside world, port forwarding allows you to make those resources available.
- Internet connection
- Server / PC
How it works
To allow connections from outside (Internet) to your server, you use port forwarding. Your router acts as a doorman / bouncer, it will take the incoming request (external port) and guide it to the correct destination (internal port).
A port is indicated as a colon postfixed to an IP address, e.g. port 8080 on your local IP would be 127.0.0.1:8080.
Setting it up
You need to tell you router when a connection / request comes in on a certain port, where in your internal network it should terminate. You will assign an external port to and internal IP address and port. You generally log into your routers web interface, go to your port forwarding or virtual servers section and input the details. The external port is where the outside connection comes into e.g port 8080. The internal port is the IP address and the port number of the PC/server where the service is available.
For this example we have the router connected to the Internet with IP 18.104.22.168 and internally your PC IP is 10.0.0.10. You want to share your webserver on 10.0.0.10 with the world. Within your router config you will make changes to your port forwarding section to all all connections on 22.214.171.124:80 to route to 10.0.0.10:80. Once you have saved the configs on you router. Once you have applied the changes you can then use an external connection to test you forwarding. http://canyouseeme.org/ is a simple and easy to use site to check that your configuration has been done correctly.
Do not try to access your external setup internally, e.g when you try and connect from inside your network (10.0.0.10) to 126.96.36.199, routers act differently. Your router may be configure to translate the request correctly and some may not, thus is method is not advised. Rather try checking using external sources or ask a friend to try and connect.
Even though it is a very generic explanation, it should give you a understanding how the basics of port forwarding works. Every setup is different from where the configurations are made, saved and applied. Understanding where all the sections fit in help you to easily find your way through various types of routers and networks. Sometimes its better to understand how things work, as then you know where you need to go and what you need to do.