1

For past few weeks I'm trying to learn how multiple web servers could be setup under one static IP. I understand that web hosting companies may have a lot of Static IPs but using one IP for one server does not sound efficient.

I read lots of articles, posts and watched videos referring some of them below.

I setup 3 web servers and one windows server to resolve DNS, I forwarded port 53 to Windows Server to listen requests for DNS. But later I came to know that when web request is initialed first DNS Server resolves IP in this scenario it reaches to my public static IP then HTTP request is sent to this IP, at this point I do not understand what approach could be adopted to forward received HTTP request to related web server.

Please note that I understand port forwarding and I was able to achieve it, I also know about reverse proxy, but they do not look like a professional approach, what I'm looking for here is to learn how hosting companies achieve it.

Here are some related post I found

https://serverfault.com/questions/965353/external-requests-to-internal-dns-server https://serverfault.com/questions/435791/internal-dns-server-provide-response-to-external-requests How does DNS work when it comes to addresses after slash?

Here is architecture of my setup I'm sharing here so that you can reference to explain:

Architecture

If you think more information needed or there is room for improving my question please ask me in comments so that I know what is missing or how can I improve my question.

Tauha
  • 15

1 Answers1

1

Yes, hosting companies will often avoid this problem by having enough IP addresses for their servers – each web server would indeed have its own dedicated IP address. All domains hosted on server A will use address A, domains on server B have IP address B, and so on.

Sharing IP addresses has its own inefficiencies – your router needs to support NAT (where normally it doesn't need to), it becomes easier to run out of ephemeral port numbers as you have more connections per IP, etc. So if you have the IP addresses it's more efficient to use them than hoard them.

But other than that, "reverse proxy" remains the answer. (It's pretty much the definition – anything that will "forward received HTTP request to related web server" would be called a reverse proxy.). It is an extremely common method – reverse proxies are used with regular webservers, or with the proxy as a load-balancer (e.g. HAproxy), or with the proxy as a frontend to containers (e.g. Traefik), and so on.

grawity
  • 501,077