Javatpoint Logo
Javatpoint Logo

Port Forwarding

Port forwarding is the back-end process of the cut-off data traffic headed for a computer's IP/ port combination and redirects those traffic to a different IP and port. An application running on the client's computer usually causes the redirection, but sometimes it can be an intermediate hardware component, such as Router, proxy server, or firewall. It is also called tunneling because anyone sending data to a server isn't aware of what's happening. The request made will still get to its ultimate destination.

The port forwarding has been started with the packets created when we transfer and data requests over the Internet. The header of the IP packet will be sent to a linked and appropriate interface after it gets examined by the network router, which transfers the data to the destination information available in the header.

The intercepting application reads the packet header, notes the destination in port forwarding and then the header information will be rewritten and sends it to another PC.

How the Requests will be handled, and ports will be used on our Router

Given the image below is a map of a simple home network. The greater Internet is represented by the cloud icon and our public, or forward-facing, Internet Protocol address. The address written in red is the address of the Router of our network.

Port Forwarding

Let's understand how the information from the Internet gets to the right device inside the network. It can be done using NAT (Network Address Translation). It occurs at the router level, where it acts like a traffic cop, which directs the flow through the Router of network traffic so that a single public IP can be shared among all the devices behind the Router.

Role of ports: Ports have a specific application, which is standards throughout the computing industry. When we go to the web page, it uses port 80. The receiver computer's applications know that port 80 is used for serving http documents, so it is listening on port 80 and responds accordingly. If we send an http request to a different port, the web server won't recognize it because it's not listing there.

Why do we need port forwarding

The tunneling is an excellent way to conserve public IP. It will protect the server and client from unwanted access, limit access to and from a network, and hide the services and servers available on a network. It is transparent to the end-user and adds an extra layer of security to networks. In other words, it is used to keep unwanted traffic off networks. It is useful for the home network users that run a gaming server or Web server on one network. The diagram below shows a simple premises network. We are on our laptop somewhere globally, and we want to connect to our home network to access some data.

Port Forwarding

the image above, when we are out and about to use our pc, we use different ports to make our request. When we access our home network's IP address using port 22. Our Router at home knows that it should belong to inside the network.

Port Forwarding

We can also use port forwarding to change existing services of port numbers for clarity and convenience. E.g., we have two servers running on our home network, and we want one to be ready and accessible, and the other web server is for a personal project. We can redirect the port of the Router to be reconfigured to use a different port for the second computer. But still, we can manage traffic effectively.

Port Forwarding
Next TopicDefine CentOS

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA