Port Forwarding tutorial with its usage and types. Learn how to Port Forward with the help of examples including Minecraft Port Forwarding:
In this tutorial, we will explore the concept of port forwarding. We will also see the use and configuration steps for different services and applications with the help of suitable examples and diagrams.
Further in this tutorial, we will also learn about the different types of port forwarding. We will also explain some FAQs relevant to this topic further in this tutorial.
What You Will Learn:
What Is Port Forwarding
Let us understand the concept of port forwarding with the help of an example.
Take the case of a home or small office LAN network. Now you need to forward some ports of the router to allow external traffic into the network. Here the router will behave as a shield from the outside Internet network with only some locks open and all others closed.
The router is pre-configured in such a manner that it will give the key of only a few locks to access the Internet, keeping other locks closed. Thus to run some other services on the home network like gaming, e-mail, remote access, etc. we need some more locks to open. This is known as port forwarding.
This technique is deployed to grant external devices access to the host systems on the networks like home or business LAN networks.
This is the kind of configuration method which is available in the NAT enabled router and it routes the communication request from the combination of one IP address and port number to another when packets are sent in the network through the gateway such as a router or firewall.
>> Recommended Reading -> Port Triggering Vs Port Forwarding
It permits the remote end host computers to connect to a particular host device on the network, on the Internet, within a LAN or WAN network. In general, the TCP port 80 is used in the port forwarding method for web-based services so that all the Internet-based applications can run over it.
Uses Of Port Forwarding
The uses are as follows:
- It is used when the host computer needs secure shell access to another host on the LAN network from the Internet.
- It is also used when it is required to grant the FTP access to the host computer on the private network from the Internet.
- It is used to run the video games on the publically available server within a home network.
- It is used for accessing e-mail and chatting online like using SKYPE from the home network.
Types Of Port forwarding
#1) Local Port Forwarding
This forwarding technique is used to bypass the firewall in the network to access other computers or services which are primarily blocked. Thus it forwards the data securely from the host computer to another server running on the same network. This is used in the secure file transfers tunneling and for connecting to a remote file share over the Internet.
#2) Remote Port Forwarding
This kind of method will allow anyone from the remote end to connect to the remote server in the local network on TCP port number 8080. Then the connection will be tunneled to the host computer to port 80. This is used to share the internal web application on the public platform.
This can also be used by the employee of an organization to connect to the office network from home while doing work from home. Thus to deploy this, it is required to know the address of the destination server and two-port numbers of the client hosts.
#3) Dynamic Port Forwarding
In this method, the client is securely connected to the destination server by using an SSH or SOCKS proxy server for transmission of data over the Internet. This is used when the client is working on an untrusted network and needs additional security for the transmission of data.
It is also used when you need to bypass the firewall in the network that resists access to the outside network and applications.
Port Forwarding Example
As explained in the above diagram, by setting the forwarding rule on the home network, one can access the network even from the far end and the router will grant access to the right application with the right host computer.
Suppose a person is outside home for some work and wants to access his home desktop and server, then he will make requests using different port numbers to his router. If he requests to grant access to the home network over port number 80, then the router will direct him to the database server having IP 188.8.131.52.
When he sends a request over port number 22, then the router will route him to the webserver with IP 184.108.40.206 and if he wants to remotely control his home desktop, then the router will send him to IP 220.127.116.11 via port 5800.
In this way, one can connect remotely to all the devices in the home network from outside the network if the port forwarding rule is set for the network on the router. In the rule, the combination of the specific port with the static IP address of the device is defined so that when needed to access, the router can grant access according to the pre-defined set of rules.
Configuring The Port Forwarding
This can be explained as follows:
- In the home network with the server, the port forwarding will allow reaching the certain incoming traffic from the Internet to the server for accessing some applications and game server.
- The first thing which is important before setting the port forwarding rule in your local network is to assign a static IP address to all the network devices in the network. If the IP address is dynamic, then the forwarding rule will not work for the network.
- The services which the host client can access by applying the port forwarding rule are FTP, ICQ (chat), IRC (Internet Relay Chat), PING, POP3, RCMD, NFS (Network File System), RTELNET, TACACS (Terminal Access Controller Access Control System), RTSP (Real-Time Streaming Protocol) via TCP or UDP, SSH, SNMP, VDOLIVE (live web video delivery), SIP-TCP or SIP-UDP, RLOGIN, TEAMVIEWER (remote login), CAMERA, gaming, and NEWS, etc.
Steps to configure Port forwarding on the router in the home or office network:
Step 1: Login into the router by going to the web browser and entering the default gateway IP address of the router.
Step 2: Enter the credentials of the router to log in, as shown in the screenshot below.
>> Recommended Reading -> Default Router Login Password For Top Router Models
Step 3: Go to the “application” tab which is present on the left-hand panel of the router and then select the port forwarding option from the available menu as shown below screenshot.
Step 4: Create port forwarding for the particular application.
- As shown in the screenshot above, first choose the application or service name for which you want to apply the forwarding rule. The services options are already explained above. Here we choose the X-box live service.
- Choose the IP address with the Internet client type from the drop-down menu. The client can be your Laptop or your Smartphone name or any other device which is connected to the home network. Here we have chosen a laptop as an Internet client.
- Now select the service type from the drop-down menu that you want to use as TCP or UDP or BOTH.
- The next field is to enter the starting and ending port number range for LAN and WAN, on which you want to forward the incoming traffic for the service or application.
- Next, enter the internal IP address of the device on which you are applying the port forwarding and then save the settings and click on the Apply button. Here the IP is 192.168.1.10.
- The last field is to specify the WAN connection name from the dropdown list on which your device is connected.
- Now save the settings by clicking on the ADD button. Right after adding the port forwarding rule, you can see the status of your applied changes. If the status is showing ACTIVE, then your applied configuration is working. If you want to DELETE any rule, you can apply by clicking on the delete caption, which is also present in the settings option as shown in the above screenshot.
The configuration is shown in the below two screenshots.
Setting Port Forwarding Rule for X-box Live Part-1:
Setting Port Forwarding Rule for X-box Live Part-2:
Step 5: Now the settings are complete to set port forward in the network. Now the client host can connect to the home router network via a web browser. For this, enter the hostname of the router of your network, followed by the port number in the address bar. For example, http://192.168.1.10:80.
Minecraft Port Forwarding
Minecraft is an open-world gaming application that was developed by Mojang and Microsoft Studios.
When in your home network one wants to invite friends to play the game on the installed Minecraft server, then you need to set up the port forward rule in your home network to allow the incoming traffic from outside the network.
There are some points to make sure of before starting the configuration. These are as follows:
- Get the router IP address.
- Must know the gaming machine’s IP address.
- Must know the TCP or UDP port numbers on which we want to forward traffic.
- To know the router’s IP address, go to the network settings and in the properties, you will find the IP address of the router.
- The incoming ports which are used by Minecraft for forwarding the traffic for different applications are as follows:
- For Minecraft Play station 3: TCP: 3478 to 3480,5223,8080, UDP: 3074,3478,3479,3658
- For Minecraft Play station 4: TCP: 1935,3478 to 3480, UDP: 3074,3478,3479,19132,19133
- For Minecraft PC: TCP: 25565, UDP: 19132,19133,25565
- For Minecraft Switch: TCP: 6667, 12400,28190,29900,29901,29920, UDP: 1 to 65535
- For Minecraft Xbox one: TCP: 3074, UDP: 88,500, 3074, 4500, 3478 to 3480.
Steps for configuration
Step 1: Download the Minecraft server software from the Internet. After downloading, install, and configure the server on your system.
Step 2: Follow step number 1 to step number 3, same as described in the above sub-heading “configuring the port forwarding”.
Step 3: Now enter the IP address of the gaming console in the internal IP address column. The service type will be the Minecraft server. Then enter the TCP or UDP port numbers of Minecraft in the port number column, which is 25565 by default. Restart the router to make the changes effective. This is shown in the screenshot below.
Step 4: Now once the settings are completed, invite your friends to connect to your home network by providing the hostname of the router with the port number. For example, “hostname.domain.com:25565”.
Frequently Asked Questions
Q #1) What are the benefits of port forwarding?
Answer: This technique can shield the servers and the client hosts from unwanted access by hiding the available services from the external world. It also limits access to incoming traffic in a network. Thus add extra security to the network.
Q #2) Can you get hacked through port forwarding?
Answer: No, the hacker can’t access the network through the forwarded port. Hence it is safe.
Q #3) Can two devices use the same port numbers?
Answer: In the case of port forwarding, you can’t port forward two devices in the same network on the same port. Thus the device must have the unique combination of pre-defined IP address and the port in the network.
Q #4) How to use port forwarding for gaming?
Answer: The port forwarding will make the gaming console in your host computer access to other devices on the Internet. It can improve the speed of gameplay and overall connection speed.
Q #5) How to check whether port forwarding is working or not?
Answer: For checking purposes first access the router’s web interface from the browser. Then the service or application for which the forwarding rule is set should be started, so that port is open or not, can be seen.
This tutorial has explained the concept of port forwarding with the help of examples, images, and screenshots in a simple manner.
From now onwards, if you want to port forward in your home network or office network, then you just follow the above-mentioned steps to allow the services or applications from the Internet to access your network.
We have also learned the steps for configuration for the port forwarding for the Minecraft server.
This is very useful when a group of friends playing a game on the Internet and want to access the router or gaming server from outside. It is also used frequently by the employees of various organizations while working from home to access the office network remotely.