Domain Name System (DNS) makes the Internet as we know it, work.
DNS is responsible for converting human readable Domain Names like www.newcars.com into computer readable IP addresses.
You can think of DNS as a distributed phone-book-directory which allows users to look up server locations by name instead of number.
When a user enters a Domain Name into a browser, their computers OS hands off the look up request to its configured nameserver resolvers.
A record An A record takes a hostname like www or quote and relates it to an IP address:
.. code-block:: text
www.newcars.com. 86400 IN A 74.119.98.216
CNAME record A CNAME record or alias is a name that refers to another name:
.. code-block:: text
stage.newcars.com. 86400 IN CNAME www.newcars.com.
PTR record A PTR record or reverse record takes an IP address and returns a name
dig domain information groper is a network administration command-line tool for querying Domain Name System (DNS) name servers.
Use dig to lookup the IP address of www record from newcars.com domain
.. code-block:: text
dig www.newcars.com +short 74.119.98.216
Use dig to lookup the IP address of stage record from newcars.com domain
.. code-block:: text
dig stage.newcars.com +short www.newcars.com. 74.119.98.216
As you can see, stage.newcars.com is an alias to www.newcars.com. They are both pointing at the same IP address, and end up on the same server.
Now pretend we were given an IP address and we wanted to determine what name was related. The dash -x flag tells dig that we want to reverse lookup, IP to name.
.. code-block:: text
dig -x 74.119.98.216 +short www.newcars.com.
Note about +short The +short flag turns down the outputs verbosity.
Why is DNS distributed? DNS is distributed to prevent outages. No one failure of a domain should take down the whole Internet. Authorative DNS servers maintain records for their hosts.