Can You Port Forward the Same Port # to 2 Different Internal IP Addresses?

If I port forward port 80 UDP on my PC, can I access port 80 from my other laptop?

5

4 Answers

You're asking two different questions here.

Can You Port Forward the Same Port # to 2 Different Internal IP Addresses?

No. Think about it. If a packet arrives to your external address and UDP port 80 (assuming you have only one external IP address), how would your router know which of the two internal IP addresses it should be forwarded to?

If you want to host two different services, you'll need a separate port for each.

If I port forward port 80 UDP on my PC, can I access port 80 from my other laptop?

Yes. Port forwarding generally only affects packets which have port 80 on your side. When someone tries to connect to you, your router will see:

  • incoming packet from other computer's random port X to your port 80
  • outgoing reply from your port 80 to other's port X

But outgoing connections (when you visit a web page elsewhere) will have it reversed from your router's perspective.

  • outgoing packet from your random port X to the other computer's (web server's) port 80
  • incoming reply from the other's port 80 to your port X

So port-forwarding won't affect those at all.

(By the way, HTTP generally runs on TCP. Only Chrome's QUIC experiments use UDP.)

3

Can You Port Forward the Same Port # to 2 Different Internal IP Addresses?

Yes, you can absolutely do it with UDP and to some degree with TCP.

Since UDP is connectionless stateless protocol you can listen for a particular port and once packet arrives you can copy it and send to two different internal destinations. Since there are no handshakes or state tracking all destinations will be able to receive those packets successfully. Samplicator is one of the programs that can do it for you. Note, that this is not a pure Port Forwarding per its definition.

This is possible for TCP, but with some limitations - you can listen for particular port and once packet arrives you can forward it to a particular internal host in a pool. TCP uses connections so once you forwarded an initial packet to a particular internal host it is now necessary to forward rest of the packets in this session to the same internal host.

By using this technology you can have multiple backend servers handling requests to one external destination.

If I port forward port 80 UDP on my PC, can I access port 80 from my other laptop?

This question is little bit unclear. If you forward traffic from your external address to one of the internal hosts then this fact alone does not prevent you to access same port from internal network.

Let's say you forward port 80 from A to B. In the same time C will be able to directly access port 80 on B without any problems.

 A (external IP) | --------- | | B C
5

You can not forward the same port to multiple IP simultaneously, I have not even seen a router/managed switch that will even let you do that without sending back a config error msg. You can set it up for multiple IPs but only one of the forwarding rules can be enable at a time. So you can disable one enable other and vice versa, but that is a waste You only need to be worried about forwarding ports if you want to access specific ports/service on LAN computer via it's external IP address. Say if you wanted to run 2 webservers on 2 of your LAN PCs and be able to access both of them all of the time, the easiest way to do this is change ports of the services, have one listen on port 80, and the other on 8080 or port you want. 99% of services will allow you to host/listen on any port you want. If you do not specify a port it will fall-back to the service default. There are other more advanced ways of doing things but this is the simplest way, and the advanced methods are not considered or called "Port Forwarding" anyone who says different needs to go back to networking school.

1

You can use a proxy internally like a WAP server which can determine what server should handle the request based on the host property of http headers ... also the port fordwarding needs to point to this Proxy

You Might Also Like