Skip links

What is port forwarding? Need of port forwarding and How to perform port forwarding?

Port :

Port is nothing but entry and exit point for your device, like if you want to go into the house, you will need some entry point like door, window. Same with a particular device. If your computer wants to  communicate or to transfer and receive any information, it will be done with the help of port. A computer port is a nothing but type of electronic, software- or programming-related docking point through which information flows from a program on your computer or to your computer from the Internet or another computer in a network.

What is Port Forwarding?

Port forwarding, or tunneling, is the process of accessing a device of a private network over the internet. This means a device in a local network can access another device of another local network if the device of another network forwards a port through which port you can communicate. In port forwarding, data traffic is passing from a computer are redirected to a targeted combination of host destination which we call it as an internet protocol address and port number. Generally, we do port forwarding while we want to share our data and/or service all over the internet from our server.

In other words, port forwarding allows a server to receive a request from client machine over the internet. So, any device using the internet can access the data of that server. Generally, using a proxy or VPN services these redirection jobs are done. Instead of these proxy servers or VPNs, these redirections can be done through some hardware components such as a router or a firewall device.

Types of port forwarding:

Port forwarding is divided into multiple forms. The following are the types of port forwarding.

Local Port Forwarding:

Local port forwarding allows us to forward the data traffic of my local computer on a port that is running on my computer to an SSH server, which is forwarded to a targeted destination server. It is the most widely used port forwarding type. It is generally used to send data on the same system from a different client application. By the process of Local Port Forwarding, we can connect to another server from our local computer. Not only these we also can get around firewalls that are blocking some web sites by this technique, named Local Port Forwarding.

For better understanding, I am giving you an example, If someone wants to connect with the MySQL database server through port number 3306 on your system. As we know the MySQL database server runs on the default port
3306. So, a firewall is installed in your network system and that blocks the malicious activities of an external attacker. So, this means no one can access the database server, you can do it through a secure shell (SSH).

Remote Port Forwarding:

Remote Port Forwarding is done when a Secure Shell client needs to access the applications running on the server-side of Secure Shell (SSH) connection. It enables the SSH server to accept the request of SSH client which wants to communicate with the applications that are installed on the server. For that same general purpose, there are other proprietary tunneling schemes as well that use remote port forwarding.
In other words, Remote port forwarding allows the users to a remote network which is located at the client-side of a tunnel through a tunnel from the server-side.

For example, Let suppose a developer is developing a web application that is running on port number 7777 on your local computer and your network is configured with NAT. So, no one can access that web application directly just because the network of that developer’s computer network is configured with NAT. When you want to show your client the demo of your developed application. So, by doing Remote Port Forwarding allows that developer to do that. Remote port forwarding forwards all the data packets are received are forwarded to another port which is forwarded by the Remote Port Forwarding.

ssh -R 8888:127.0.0.1:7777 user@example.com

This command allows the SSH server to bind to port number 8888 on example.com. All the data traffic the SSH server receives on this port forwarded to the SSH client on the developer’s local computer which is forwarding all the data to the port number 7777 on localhost/127.0.0.1. So, now anyone can access that web application through the internet by the URL example.com:8888 in any browser that is installed on that system.

Dynamic Port Forwarding:

Dynamic port forwarding is the third most widely used method for redirection of port with Secure Shell. In the previous two types, those are Local Port forwarding and Remote Port Forwarding were used to interact with a single port but Dynamic Port Forwarding allows a server to forward all the ports of TCP communication over the range of ports that is 65535.

Why do we need Port Forwarding?

To preserve a public IP address port forwarding is a great method for us. From unwanted access like an attack from a hacker can protect a server as well as a client. By hiding the services running on a server and the servers are connected to a network and limiting access to the network can protect the server and the whole networking devices as well. The end-user adds an extra layer of security and it is also transparent to the end-user.

Summarization of port forwarding is to keep unwanted traffic like a malicious attacker to that server. For all external communications on the internet, it allows network administrators to use one IP address while multiple IPs are dedicated to multiple servers. For the network users, port forwarding is very useful if someone wants to run a game server or a web server on the same network.

For redirection of data packets to the proper server on the internal network, the network administrator can set up a single public IP address. For doing all the tasks by using one IP address and all the incoming data packets that are not relatable to the services provided to the firewall, the network administrator can hide the services running on the server from the attacker who wishes to do a malicious activity.

How does Port Forwarding work?

For sending any through the internet, data packets are generated and the generated data packets are transferred through the internet. The details of that request we made are sent thr=rough the data packets generated for making the request. The generated data packets may contain destination address.

Generally, we use a router for communicating to the internet and every time each data is transmitted through the router checks the data header of an IP packet before sending it to the destination address. Basically, the router checks the data packet header to know where the data packet should be sent.

By port forwarding, things get changed. While port forwarding is going on the application for intercepting the data packets reads the header of that data packets, check the destination IP address and before sending the data packet to another host or server, the header information is rewritten.

The destination of that secondary host may be using a different IP address, a different port for that service, which means it may contain a different combination of IP and a port number. While using the VPN of a proxy server, these secondary servers are generally the servers are provided by our Internet Service Provider for masking or covering our original IP address.

How to perform port forwarding?

Are you facing problems while you wish to connect a multiplayer game or your own chat program to the internet? And your device is unable to connect to the Wi-Fi network and you can not play the multiplayer game just because of not being on the same network. So, the problem may be because of blocked port on your networking device. So, don’t worry about that, here I am telling you the method of doing port forwarding.

Router is a medium of communication between the internet and your local network or your device. On the router login page there should be an option for Port forwarding. There you can make Port Forwarding possible easily.

If you want to know more details and want to execute it practically then visit our office at “top mentor-best ethical hacking institute in pune” . We offer both online and offline ethical hacking and cyber security course in pune.

Leave a comment

Explore
Drag