Domain Name System (DNS)
Introduction
DNS is a hierarchical naming system built on a distributed database for computers, services, or any resource connected to the Internet or a private network. Most importantly, it translates domain names meaningful to humans into the numerical identifiers associated with networking equipment for the purpose of locating and addressing these devices worldwide. The DNS system forms one of the largest and most active distributed databases on the planet. The DNS system is a database, and no other database on the planet gets this many requests. No other database on the planet has millions of people changing it every day, either. That is what makes the DNS system so unique. Without DNS, the Internet would shut down very quickly. Domain Name System is that it serves as the phone book for the Internet by translating human-friendly computer hostnames into IP addresses. The Domain Name System makes it possible to assign domain names to groups of Internet resources and users in a meaningful way, independent of each entity's physical location. The Domain Name System distributes the responsibility of assigning domain names and mapping those names to IP addresses by designating authoritative name servers for each domain. Authoritative name servers are assigned to be responsible for their particular domains, and in turn can assign other authoritative name servers for their sub-domains. This mechanism has made the DNS distributed and fault tolerant and has helped avoid the need for a single central register to be continually consulted and updated. When we use the Web or send an e-mail message, we use a domain name to do it. For example, the URL "http://www.facebook.com" contains the domain name facebook.com. So does the e-mail address mail@facebook.com.
Human-readable names like "facebook.com" are easy for people to remember, but they don't do machines any good. All of the machines use names called IP addresses to refer to one another. For example, the machine that humans refer to as "www.facebook.com" might have the IP address of kind 70.42.251.42. Every time we use a domain name, we use the Internet's domain name servers (DNS) to translate the human-readable domain name into the machine-readable IP address.
Working
Domain name system translates domain names to IP addresses. To keep all of the machines on the Internet straight, each machine is assigned a unique address called an IP address. IP stands for Internet protocol, and these addresses are 32-bit numbers normally expressed as four "octets" in a "dotted decimal number." A typical IP address looks like this:
70.42.251.42
Domain Names
If we had to remember the IP addresses of all of the Web sites we visit every day, it would be troublesome. We just are not that good at remembering strings of numbers. We are good at remembering words, however, and that is where domain names come in. For domain names example:
- www.facebook.com - a typical name
- www.yahoo.com - the world's best-known name
- www.mit.edu - a popular EDU name
- encarta.msn.com - a Web server that does not start with www
- www.bbc.co.uk - a name using four parts rather than three
- ftp.microsoft.com - an FTP server rather than a Web server
The COM, EDU and UK portions of these domain names are called the top-level domain or first-level domain. There are several hundred top-level domain names, including COM, EDU, GOV, MIL, NET, ORG and INT, as well as unique two-letter combinations for every country.
Within every top-level domain there is a huge list of second-level domains. For example, in the COM first-level domain, you've got:
- yahoo
- msn
- microsoft
- plus millions of others...
Every name in the COM top-level domain must be unique, but there can be duplication across domains. For example, facebook.com and facebook.org are completely different machines.
In the case of bbc.co.uk, it is a third-level domain. Up to 127 levels are possible, although more than four is rare.
The left-most word, such as www or encarta, is the host name. It specifies the name of a specific machine (with a specific IP address) in a domain. A given domain can potentially contain millions of host names as long as they are all unique within that domain. Because all of the names in a given domain need to be unique, there has to be a single entity that controls the list and makes sure no duplicates arise. For example, the COM domain cannot contain any duplicate names, and a company called Network Solutions is in charge of maintaining this list. When we register a domain name, it goes through one of several dozen registrars who work with Network Solutions to add names to the list. Network Solutions, in turn, keeps a central database known as the whois database that contains information about the owner and name servers for each domain. If we go to the whois form, we can find information about any domain currently in existence.
While it is important to have a central authority keeping track of the database of names in the COM (and other) top-level domain, we would not want to centralize the database of all of the information in the COM domain. For example, Microsoft has hundreds of thousands of IP addresses and host names. Microsoft wants to maintain its own domain name server for the microsoft.com domain. Similarly, Great Britain probably wants to administrate the uk top-level domain, and Australia probably wants to administrate the au domain, and so on. For this reason, the DNS system is a distributed database. Every domain has a domain name server somewhere that handles its requests, and there is a person maintaining the records in that DNS. This is one of the most amazing parts of the DNS system -- it is completely distributed throughout the world on millions of machines administered by millions of people, yet it behaves like a single, integrated database!
Domain Name servers do two things all day long:
- They accept requests from programs to convert domain names into IP addresses.
- They accept requests from other name servers to convert domain names into IP addresses.
When a request comes in, the name server can do one of four things with it:
- It can answer the request with an IP address because it already knows the IP address for the domain.
- It can contact another name server and try to find the IP address for the name requested. It may have to do this multiple times.
- It can say, "I don't know the IP address for the domain you requested, but here's the IP address for a name server that knows more than I do."
- It can return an error message because the requested domain name is invalid or does not exist.
When we type a URL into our browser, the browser' s first step is to convert the domain name and host name into an IP address so that the browser can go request a web page from the machine at that IP address.
When we set up our machine on the Internet, we (or the software that you installed to connect to our ISP) had to tell our machine what name server it should use for converting domain names to IP addresses. On some systems, the DNS is dynamically fed to the machine when we connect to the ISP, and on other machines it is hard-wired. Any program on our machine that needs to talk to a name server to resolve a domain name knows what name server to talk to because it can get the IP address of our machine's name server from the operating system.
The browser therefore contacts its name server and says, "I need for you to convert a domain name to an IP address for me." For example, if we type "www.facebook.com" into our browser, the browser needs to convert that URL into an IP address. The browser will hand "www.facebook.com" to its default name server and ask it to convert it.
The name server may already know the IP address for www.facebook.com. That would be the case if another request to resolve www.facebook.com came in recently (name servers cache IP addresses to speed things up). In that case, the name server can return the IP address immediately.
A name server would start its search for an IP address by contacting one of the root name servers. The root servers know the IP address for all of the name servers that handle the top-level domains. Our name server would ask the root for www.facebook.com, and the root would say (assuming no caching), "I don't know the IP address for www.facebook.com, but here's the IP address for the COM name server." Obviously, these root servers are vital to this whole process, so:
- There are many of them scattered all over the planet.
- Every name server has a list of all of the known root servers. It contacts the first root server in the list, and if that doesn't work it contacts the next one in the list, and so on.
The root server knows the IP addresses of the name servers handling the several hundred top-level domains. It returns to our name server the IP address for a name server for the COM domain. Our name server then sends a query to the COM name server asking it if it knows the IP address for www.facebook.com. The name server for the COM domain knows the IP addresses for the name servers handling the FACEBOOK.COM domain, so it returns those. Our name server then contacts the name server for FACEBOOK.COM and asks if it knows the IP address for www.facebook.com. It does, so it returns the IP address to our name server, which returns it to the browser, which can then contact the server for www.facebook.com to get a Web page.
Importance
Importances of DNS are:
· Mappings of addresses to names & vice versa (known as records) are stored in a database.
· The DNS database is distributed.
· A DNS database also stores additional records.
· DNS is the primary name registration and resolution service in Windows based servers, and provides a hierarchically distributed and scalable database.
· DNS provides name registration, name resolution and service location for Windows clients; and locates domain controllers for logon.
· Active Directory uses DNS as its domain controller location mechanism and leverages the namespace design of DNS in the design of Active Directory domain names. As a result, DNS is positioned within the discoverability and logical structure components of Active Directory technology components.
DNS Records and Messages
The DNS servers that together implement the DNS distributed database store resource records (RR), including RRs that provide hostname-to-IP address mappings. Each DNS reply message carries one or more resource records.
A resource record is a four-tuple that contains the following fields:
(Name, Value, Type, TTL)
TTL: It is the time to live of the resource record which determines when a resource should be removed from a cache.
NAME: Name of the node to which this record pertains. NAME is the fully qualified domain name of the node in the tree
TYPE: Type of RR in numeric form (e.g. 15 for MX RRs). TYPE is the record type. It indicates the format of the data and it gives a hint of its intended use
VALUE: Depends of TYPE.
The semantics of various fields in a DNS messages are:
- Header - Includes:
- Bits 0-15 are the query identifier
- Bit 16 - QR bit, The message is a query if the value is 0. The message is a response if the value is 1/
- Bits 17-20 - Opcode values - Identifies the query type. The message is a standard query if 0, The message is an inverse query if 1, The message is a server status request if 2.
- Bit 21 - AA - Authoritative answer - If set, it indicates the responding name server is an aurhority for the domain name in question.
- Bit 22 - TC - Indicates the message was truncated.
- Bit 23 - RD - Recursion Desired - Set in a query and indicates the query should be persued recursively.
- Bit 24 - RA - Recursion Available - A bit that is set or cleared in a response indicating that recursion is available.
- Bit 25-27 - Z - Future use, required to always be 0
- Bit 28-31 - RCODE - Response code - No error if 0, Format error if 1, Server failure if 2
- Word 3 - QDCOUNT - Indicates the number of DNS querise (entries in the question section)
- Word 4 - ANCOUNT - Indicates the number of answers (Resource records in the answer section)
- Word 5 - NSCOUNT - The number of name server records in the authority records section.
- Word 6 - ARCOUNT - The number of resource records in the additional records section.
- Question - Includes:
- QNAME - Domain name strings with a length byte followed by a string of the designated length.
- QTYPE - Two bytes indicating the query type
- QCLASS - Two bytes indicating the class field such as IN for internet.
- Answer - Resource Records (RRs) answering the question
- NAME - domain name
- TYPE - Two bytes with resource record type.
- CLASS - Two bytes indicating the class of the data
- TTL - A 32 bit unsigned integer indicating the time interval in seconds that the may be stored on the DNS server.
- RDLENGTH - 16 bits indicating the length of the RDATA field in bytes.
- RDATA - This may be the IP address for a domain name but the information varies depending on the type and class of the resource record.
- Authority - Resource Records (RRs) pointing to an authority - The format is the same as the Answer section.
- Additional - Resource Records (RRs) holding additional information - The format is the same as the Answer section.
- A 1 a host address
- NS 2 an authoritative name server
- MD 3 a mail destination (Obsolete - use MX)
- MF 4 a mail forwarder (Obsolete - use MX)
- CNAME 5 the canonical name for an alias
- SOA 6 marks the start of a zone of authority
- MB 7 a mailbox domain name (EXPERIMENTAL)
- MG 8 a mail group member (EXPERIMENTAL)
- MR 9 a mail rename domain name (EXPERIMENTAL)
- NULL 10 a null RR (EXPERIMENTAL)
- WKS 11 a well known service description
- PTR 12 a domain name pointer
- HINFO 13 host information
- MINFO 14 mailbox or mail list information
- MX 15 mail exchange
- TXT 16 text strings
No comments:
Post a Comment