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?


Solution 1:

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.)

Solution 2:

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