DNS


The Domain Name System (DNS) is a distributed phone book that maps friendly easy-to-remember domain names such as example.com to IP addresses. When, for example, a user navigates to a website, they enter the DNS hostname as part of the URL. The web browser then sends the DNS name to whichever DNS resolver has been configured. That DNS resolver will in turn find out the address that correlates to the domain. The resolver then replies with that address and the web browser tries to reach the web server at that IP address.

The resolvers that Linux uses to look up DNS data are configured in the /etc/resolv.conf configuration file:

$ cat /etc/resolv.conf
search lpi nameserver 192.168.0.1

To perform a lookup in the DNS, use the command host:

$ host learning.lpi.org 
learning.lpi.org has address 208.94.166.198

Another important command to interface with NDS is dig:


DNS lookup utility

Syntax

dig [@server] [-b address] [-c class] [-f filename] [-k filename] [-m] [-p port#] [-q name] [-t type] [-x addr] [-y [hmac:]name:key] [-4] [-6] [name] [type] [class] [queryopt...]

dig (domain information groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. Most DNS administrators use dig to troubleshoot DNS problems because of its flexibility, ease of use and clarity of output. Other lookup tools tend to have less functionality than dig.