1

Lets say we have a network A with two webservers inside it, S1 and S2, both hosting a website on port 80. When a client from a different network is addressing A:80, which host inside network A, will receive the message?

12
  • The destination address is on the IP packet, and the host with that address will receive the packet. – Ron Maupin May 27 at 16:14
  • But the destination address is A, it doesn't mention any host inside A like S1 or S2 – tonik May 27 at 16:16
  • 1
    The destination address is the IP address of the destination host, not a network address. – Ron Maupin May 27 at 16:17
  • 2
    You mean NAPT, and you can only forward port 80 to one of those hosts, which is a big problem for NAPT, which is why companies with multiple servers using the same port but public IPv4 addresses. NAPT really has nothing to do with routing, except that a router is often a convenient place to do it. – Ron Maupin May 27 at 18:02
  • 2
    With NAPT (public to private), the address is the NAPT device. – Ron Maupin May 27 at 19:05
2

Reading between the lines, you are asking about two servers on a private network using the same protocol port number and being contacted from the public network. That requires the NAPT (Network Address Port Translation) variant of NAT (Network Address Translation).

A limitation of NAPT is that you can only forward traffic for a particular protocol port to a single inside host, or use a round-robin method, but that will not let someone from the outside to choose the server.

Your example would require one of the inside servers to use a different protocol port. That is why businesses with multiple servers using the same protocol port get (buy) multiple public addresses.

2
  • Awesome this answers my question, thank you very much! – tonik May 27 at 19:32
  • 1
    An alternative could be a reverse proxy that forwards requests based on the HTTP host header. Proxies and protocols above the transport layer are off-topic here, however. – Zac67 May 27 at 20:45
1

This is possible, all you need is a Linux host running an open-source load-balancer running on it, eg. HAproxy/Ngnix, etc.

You can enable traffic to accept connections over port 80 on your Linux LB and share/load-balance traffic onto your internal server's ports can be 80 or any of your custom app ports.

1
  • Unfortunately, hosts/servers are off-topic here, as are protocols above OSI lare-4, e.g. HTTP. It is not possible to distinguish the servers using IP and TCP, so you can only havr one from the perspective of what is on-topic here when using NAPT. – Ron Maupin May 30 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.