E
E
ericcartman2018-10-05 08:19:08
Domain Name System
ericcartman, 2018-10-05 08:19:08

How does DNS distinguish sites on the 1st IP address, virtual machine? How does subdomain differ from a domain?

A little less than everywhere on the question in Google, how the DNS service works, we see something like the following:

How does DNS work?
DNS operates in question/answer mode.
Let's say you entered "test.ru" in your browser line.
Consider the work of DNS step by step:
Your browser does not know anything about the test.ru IP address, and with a request for an IP address through a special program - resolver, it accesses the local name server. The local DNS server is the name server of your local network or the DNS server of your ISP. "How does the browser know this local DNS exists?" - you ask. Everything is extremely simple. When setting up a network connection, you specify the IP addresses of the DNS servers (preferred and / or alternative), one of which will respond to requests sent by your browser through the resolver - this is the local or local server on your network. You can always look up the IP address of your local DNS server. To do this, just look at the properties of the network connection used on your computer.
The request for the test.ru IP address reaches the local name server. This server knows nothing about this IP address and sends a request to one of the root servers "." (root).
The root server gives the local server the IP address of the server that supports the .RU zone.
Further, using the received address, the local name server accesses the DNS server that supports .RU.
This DNS server, in turn, on the received request, gives the IP address of the server that supports the test.ru zone.
The local DNS server queries the test.ru IP address to the DNS server of the test.ru zone.
The local name server receives the test.ru IP address from the test.ru zone DNS server.
Having received the test.ru address, the local DNS server reports it to your browser.

All this is true, but life has gone far ahead, and now a bunch of virtual machines with a bunch of sites on each are spinning on one IP. I would like to understand how everything works after the step
Having received the test.ru address, the local DNS server reports it to your browser
?
because there is a lot of everything on this IP address, including sub.test.ru subdomains and so on. And most likely all this on virtual machines. Why is sub.test.ru not returned to the test.ru request, although everything is the same for them?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dimonchik, 2018-10-05
@dimonchik2013

sub.test.ru is not issued for test.ru request

issued if Google's host
header is misconfigured :

S
Sergey, 2018-10-05
@feanor7

As you have already been answered, DNS does not differentiate, it simply answers the client's request, what is the IP of the host like this.
Apparently you have a scheme of interaction is not lined up in your head.
You are a client (browser) making a request to sub1.test.ru dns gave you the ip of the host on which this domain is located. In addition to sub1.test.ru, this host can host a great many sites, aaa.ru bbb.ru and the frontend of this site, when receiving a request from your client, already decides what exactly to give you (which directory), you asked sub1.test.ru then he will give you, or rather the client.

S
ShamblerR, 2018-10-05
@ShamblerR

This is a crutch on all web servers, it parses the site not by IP:PORT but also through the http referee.
Essentially reading the header and substituting the config for it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question