cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1459
Views
0
Helpful
2
Replies

usage of port forwarding

techguy
Enthusiast
Enthusiast

Hi peeps,

 

Can anyone tell me the exact usage of port forwarding (when, why, where & how)? 

 

 

Thanks.

1 Accepted Solution

Accepted Solutions

Joseph Nelson
Beginner
Beginner

Hi,

Port forwarding is just PAT ( port address translation), a form of NAT. Suppose you have a web server sitting behind a firewall or router, the web server has IP 1.1.1.1/24 and listens on port 8080. Your routers outside interface is 2.2.2.2/24.

Assume no NAT is being performed, users on the internet can access 1.1.1.1 directly. User fires up a browser and browses to 1.1.1.1-- it whats to talk to your web server on port 80. But your server is listening on port 8080. Your router needs to forward request for 1.1.1.1:80 to 1.1.1.1:8080. That is port forwarding. Generically its a form of PAT ( port address translation).

Another example is where you have webserver1 and webserver2. Both are listening on port 80 but are addressed with private IPs. Assume you use static NAT to translate the two webserver private IPs to a single public IP. How does the router know which server to send the traffic to if a request comes in for port 80? The answer is port forwarding. In this case, you could forward port 8081 to webserver1 and port 8082 to webserver2. Now when a user fires up a browser they can type http:1.1.1.1:8081 to hit webserver1. Likewise, they type http://1.1.1.1:8082 to hit webserver2.

 

HTH

Joe


Rate if helpful

 

View solution in original post

2 Replies 2

Joseph Nelson
Beginner
Beginner

Hi,

Port forwarding is just PAT ( port address translation), a form of NAT. Suppose you have a web server sitting behind a firewall or router, the web server has IP 1.1.1.1/24 and listens on port 8080. Your routers outside interface is 2.2.2.2/24.

Assume no NAT is being performed, users on the internet can access 1.1.1.1 directly. User fires up a browser and browses to 1.1.1.1-- it whats to talk to your web server on port 80. But your server is listening on port 8080. Your router needs to forward request for 1.1.1.1:80 to 1.1.1.1:8080. That is port forwarding. Generically its a form of PAT ( port address translation).

Another example is where you have webserver1 and webserver2. Both are listening on port 80 but are addressed with private IPs. Assume you use static NAT to translate the two webserver private IPs to a single public IP. How does the router know which server to send the traffic to if a request comes in for port 80? The answer is port forwarding. In this case, you could forward port 8081 to webserver1 and port 8082 to webserver2. Now when a user fires up a browser they can type http:1.1.1.1:8081 to hit webserver1. Likewise, they type http://1.1.1.1:8082 to hit webserver2.

 

HTH

Joe


Rate if helpful

 

thank you very much...

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers