Answer the question
In order to leave comments, you need to log in
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.
Having received the test.ru address, the local DNS server reports it to your browser?
Answer the question
In order to leave comments, you need to log in
sub.test.ru is not issued for test.ru request
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question