Answer the question
In order to leave comments, you need to log in
How does a domain find the right IP by NS?
The usual picture: the hoster gives the client an address, like: "n1.site.ru", so that the client registers them in the NS servers of the domain. But the hoster gives this address to all its clients. How is the desired server IP located?
Answer the question
In order to leave comments, you need to log in
The hoster does not give the client an address for him to register. The hoster gives an A-record to those NS-servers that are registered with the registrar for this domain name. If they are with the client, he gives them to the client; if they are with the host, he writes the record himself.
The permission name > address starts in the simplest case from the root servers and goes along the chain root > .ru > .site.ru. > n1.site.ru., sequentially polling all DNS along the way. The dots in the domain name are the designation of the dns server. The full FQDN should look like this: n1.site.ru. with a dot at the end, but this is discarded in everyday use.
There are also many subtleties, but in general it looks like this.
...
The question was not about the principle of the DNS, something I did.
So, a hoster can have a lot of domains on one IP address, in fact, this is the main argument against blocking by IP, for example. When requesting from the server on a specific IP, the client sends the Host header, where the name of a specific domain is indicated, this is the HTTP 1.1 standard, without this header the request is not made at all.
It looks like this:
GET / HTTP/1.1
Host: domain.com
After that, the web server returns the required domain/site from its config.
The hoster gives the address of its DNS server so that it registers in the global databases of DNS servers (root servers). You create a site with a hoster - the hoster places it on one of the physical servers, configures a virtual host for this domain, and writes the server address in DNS records. When requesting any DNS server, it accesses the root servers and receives the address of the DNS server processing this domain, requests the address from it, and stores the address in its cache. Updating the cache of DNS addresses can take from several hours to a day.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question