DNS
Introduction
DNS (English Domain Name System, «the domain name system») — a computer distributed system for obtaining information about domains.
It is most often used to obtain
the IP address
by host name (of a computer or device), to obtain information about mail routing and/or service nodes for protocols in the domain (SRV record).
The distributed DNS database is maintained by means of a hierarchy of DNS servers interacting according to a specific protocol.
The basis of DNS is the idea of the hierarchical structure of a name and of zones. Every server responsible for a name can hand over responsibility for the further part of the domain to another server (from the administrative point of view — to another organisation or person), which makes it possible to place responsibility for the currency of information on the servers of various organisations (people) responsible only for «their own» part of the domain name.
Since 2010, means of checking the integrity of transmitted data, called DNS Security Extensions (DNSSEC), have been introduced into the DNS system. The transmitted data are not encrypted, but their authenticity is verified by cryptographic means. The DANE standard being introduced provides for the transmission by DNS means of reliable cryptographic information (certificates) used to establish secure and protected connections of the transport and application layers.
Key Characteristics of DNS
DNS has the following characteristics:
- Distributed administration. Responsibility for different parts of the hierarchical structure is borne by different people or organisations.
- Distributed storage of information. Every network node must necessarily store only the data that fall within its zone of responsibility, and (possibly) the addresses of the root DNS servers.
- Caching of information. A node may store a certain amount of data that is not from its own zone of responsibility in order to reduce the load on the network.
- A hierarchical structure in which all nodes are united into a tree, and every node can either determine the operation of the lower nodes itself or delegate (hand over) them to other nodes.
- Redundancy. The storage and maintenance of its nodes (zones) is handled by (usually) several servers, separated both physically and logically, which ensures the safety of data and the continuation of operation even in the event of a failure of one of the nodes.
DNS is important for the operation of the Internet, since to connect to a node information about its IP address is needed, and for people it is easier to remember letter (usually meaningful) addresses than a sequence of digits of an IP address. In some cases this allows virtual servers, for example HTTP servers, to be used, distinguishing them by the request name. Initially the conversion between domain and IP addresses was performed using a special text file hosts, which was compiled centrally and automatically distributed to each of the machines in its local network. With the growth of the networks the need arose for an efficient, automated mechanism, and that is what DNS became.
DNS was developed by Paul Mockapetris in 1983; the original description of the mechanisms of operation is contained in RFC 882 and RFC 883. In 1987 the publication of RFC 1034 and RFC 1035 changed the DNS specification and cancelled RFC 882, RFC 883 and RFC 973 as obsolete.
Additional Features
- support for dynamic updates
- protection of data (DNSSEC) and of transactions (TSIG)
- support for various types of information
Terminology and Principles of Operation
The key concepts of DNS are:
-
Domain (English domain, «area») — a node in the name tree, together with all the nodes subordinate to it (if any), that is, a named branch or subtree in the name tree
The structure of a domain name reflects the order of the nodes in the hierarchy; a domain name is read from left to right from the lower domains to the top-level domains (in order of increasing importance):
- at the top is the root domain (having the identifier «.»(dot))
- below are the domains of the first level (domain zones)
- then the domains of the second level, third and so on.
For example, for the address
ru.wikipedia.org.
the first-level domain is org
the second is wikipedia
the third is ru
DNS allows the dot of the root domain to be omitted. -
Subdomain (English subdomain) — a subordinate domain (for example, wikipedia.org is a subdomain of the domain org, and ru.wikipedia.org of the domain wikipedia.org).
Theoretically such division can reach a depth of 127 levels, and each label can contain up to 63 characters, as long as the total length together with the dots does not reach 254 characters.
But in practice domain name registrars use stricter limits.
For example, if you have a domain of the form mydomain.ru, you can create various subdomains of the form mysite1.mydomain.ru, mysite2.mydomain.ru and so on for it. -
Resource record — a unit of storage and transmission of information in DNS.
Every resource record has a name (that is, it is bound to a certain domain name, a node in the name tree), a type and a data field, the format and content of which depend on the type. -
Zone — part of the domain name tree (including resource records), hosted as a single whole on some domain
name server (DNS server, see below), and more often — simultaneously on several servers (see below).
The purpose of separating part of the tree into a separate zone is to hand over responsibility (see below) for the corresponding domain to another person or organisation.
This is called delegation (see below). As a connected part of the tree, a zone is itself also a tree inside. If the DNS namespace is regarded as a structure of zones rather than of separate nodes/names, a tree is again obtained; it is justified to speak of parent and child zones, of senior and subordinate ones.
In practice most zones of the 0th and 1st level (, ru, com, …) consist of a single node to which the child zones are directly subordinate. In large corporate domains (of the 2nd and higher levels) additional subordinate levels are sometimes formed without being separated into child zones. - Delegation — the operation of handing over responsibility for part of the domain name tree to another person or organisation. It is through delegation that DNS ensures distributed administration and storage. Technically delegation is expressed in separating this part of the tree into a separate zone and placing this zone on a DNS server (see below) managed by this person or organisation. In this case the parent zone includes «glue» resource records (NS and A) containing pointers to the DNS servers of the child zone, and all the other information relating to the child zone is stored on the DNS servers of the child zone.
- DNS server — specialised software for servicing DNS, as well as the computer on which this software runs. A DNS server may be responsible for some zones and/or may forward requests to higher-level servers.
- DNS client — a specialised library (or program) for working with DNS. In a number of cases a DNS server acts as a DNS client.
- DNS query (English DNS query) — a request from a client (or server) to a server. The request can be recursive or non-recursive (see Recursion).
The DNS system contains a hierarchy of DNS servers corresponding to the hierarchy of zones. Each zone is maintained by at least one authoritative DNS server (from English authoritative), on which the information about the domain is located.
A name and an IP address are not identical — one IP address can have many names, which allows many websites to be maintained on one computer (this is called virtual hosting). The reverse is also true — one name can be mapped to many IP addresses: this allows load balancing to be created.
To increase the resilience of the system, many servers containing identical information are used, and the protocol has means allowing the information located on different servers to be kept in sync. There are 13 root servers; their addresses practically do not change.
The DNS protocol uses TCP or UDP port 53 to answer queries. Traditionally queries and responses are sent as a single UDP datagram. TCP is used when the size of the response data exceeds 512 bytes, and for AXFR queries.
Recursion
In DNS the term recursion denotes the algorithm of a DNS server's behaviour:
«to perform, on behalf of the client, a complete search for the required information in the whole DNS system, if necessary by querying other DNS servers»
A DNS query can be recursive — requiring a complete search — and non-recursive (or iterative) — not requiring a complete search.
Similarly, a DNS server can be recursive (able to perform a complete search) and non-recursive
(not able to perform a complete search).
Some DNS server programs, for example BIND, can be configured so that the requests of some
clients are performed recursively, and the requests of others — non-recursively.
When answering a non-recursive query, as well as when unable or forbidden to perform recursive queries,
a DNS server either returns data about the zone for which it is responsible, or returns an error.
The settings of a non-recursive server, when the response gives the addresses of servers that possess a larger
amount of information about the requested zone than the answering server (most often the addresses of the root servers),
are incorrect, and such a server can be used to organise
DoS attacks
.
In the case of a recursive query, the DNS server queries the servers (in order of decreasing level of the zones in the name) until it finds the answer or discovers that the domain does not exist (in practice the search begins with the DNS servers closest to the one sought; if the information about them is in the cache and is not stale, the server may not query other DNS servers).
Let us consider the operation of the whole system using an example.
Suppose we have typed the address in the browser
ru.wikipedia.org.
The browser looks for a match of this address to an IP address in the hosts file. If the file does not contain a match, then the browser asks the DNS server:
«what is the IP address of ru.wikipedia.org»?
However, the DNS server may know nothing not only about the requested name, but even about the whole domain wikipedia.org.
In this case the server turns to the root server — for example, 198.41.0.4. This server reports —
«I have no information about this address, but I know that 204.74.112.1 is responsible for the zone org.»
Then the DNS server sends its query to 204.74.112.1, but that one answers
«I have no information about this server, but I know that 207.142.131.234 is responsible for the zone wikipedia.org.»
Finally the same query is sent to a third DNS server and receives an answer — the IP address, which is passed on to the client — the browser.
In this case, when resolving the name, that is, in the process of looking up the IP by name:
- the browser sent a recursive query to the DNS server known to it — in response to this type of query the server is obliged to return a «ready result», that is, the IP address, or an empty answer and the NXDOMAIN error code;
- the DNS server that received the query from the browser sent non-recursive queries in succession, to which it received answers from other DNS servers, until it received an answer from the server responsible for the requested zone;
- the remaining DNS servers mentioned processed the queries non-recursively (and most likely would not have processed recursive queries even if such a requirement had been set in the query).
Sometimes it is allowed for the queried server to pass the recursive query to a «higher-level» DNS server and wait for a ready answer.
With recursive processing of queries all the answers pass through the DNS server, and it gets the opportunity to cache them. A repeated query for the same names usually does not go beyond the server's cache; no access to other servers occurs at all. The permissible time for storing answers in the cache comes together with the answers (the TTL field of the resource record).
Recursive queries require more resources from the server (and create more traffic), so they are usually accepted from nodes «known» to the owner of the server (for example, a provider allows only its own clients to make recursive queries; in a corporate network recursive queries are accepted only from the local segment). Non-recursive queries are usually accepted from all nodes of the network (and a substantive answer is given only to queries about the zone hosted on the node; to a DNS query about other zones the addresses of other servers are usually returned).
Reverse DNS Lookup
Reverse DNS lookup (English reverse DNS lookup) — an access to a special domain zone in order to determine the name of a node by its IP address with the help of a PTR record.
To perform the query the address of the node is converted into reverse notation; the way of conversion depends on the IP version:
the IPv4 address 192.168.0.1 turns into 1.0.168.192.in-addr.arpa.;
the IPv6 address 2001:db8::567:89ab — into b.a.9.8.7.6.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
Thanks to the hierarchical model of name management, it becomes possible to delegate the management of the zone to the owner of the IP address range. For this, the records of the authoritative DNS server indicate that a separate server is responsible for the zone CCC.BBB.AAA.in-addr.arpa (that is, for the network AAA.BBB.CCC.000/24).
The number of PTR records describing different names for one address is not limited by the specifications, but may be limited by the size of the UDP packet, since the DNS server encapsulates its answer in UDP. In most cases only one PTR record is created for one IP address, but it also happens that many are created — for example, when the IP address is used for several virtual servers with different names.
Performing a Reverse Query
On query the «PTR» record is read, containing the domain name sought. If the record is absent or the corresponding subdomain is not delegated, then the IP address is considered to have no reverse DNS record.
PTR records do not require any special processing; these are simple records, similar to CNAME, which define aliases.
in-addr.arpa
The DNS record in-addr.arpa looks like this:
56.34.12.10.in-addr.arpa. IN PTR host1.example.net.
This will mean that the IP address 10.12.34.56 corresponds to the node name host1.example.net.
The DNS record ip6.arpa looks like this:
5.4.3.2.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa. IN PTR host1.example.net.
This will mean that the IPv6 address 2001:0db8::1:2345 corresponds to the node name host1.example.net.
When classless addressing is used, a problem arises with delegating individual subnets whose size does not coincide with the class (that is, with a subdomain of the next level).
To solve this problem RFC 2317 was created, describing the delegation of in-addr.arpa subdomains in classless addressing.
To delegate IPv6 address ranges, the domain zone ip6.arpa is used.
Related Articles:
Article author: Andrei Olegovich
| Articles from Other Sites | |
| Domain Delegation | |
| Domain Registration | |
| Domain Renewal | |
| Domains. General Questions and Definitions |