The underlying addressing scheme for the Internet is the dotted decimal form (like 83.166.169.231). Humans prefer to use words instead of numbers, so resources on the Internet are identified with strings of words called URLs or domain names. For example, www.packtpub.com is a domain name and it corresponds to an IP address. The site can be identified by the numeric or the string name.
This technique of mapping IP addresses to symbolic names is called Domain Name Service (DNS). When we enter www.google.com, our computer uses the DNS servers to resolve the domain name into the corresponding IP address. While on a local network, we set up the local DNS to name local machines with symbolic names.
Name servers are defined in /etc/resolv.conf:
$ cat /etc/resolv.conf # Local nameserver nameserver 192.168.1.1 # External nameserver nameserver 8.8.8.8
We can add name servers manually by editing that file or with a one-liner:
# sudo echo nameserver IP_ADDRESS >> /etc/resolv.conf
The easiest method to obtain an IP address is to use the ping command to access the domain name. The reply includes the IP address:
$ ping google.com PING google.com (64.233.181.106) 56(84) bytes of data.
The number 64.233.181.106 is the IP address of a google.com server.
A domain name may map to multiple IP addresses. In that case, ping shows one address from the list of IP addresses. To obtain all the addresses assigned to the domain name, we should use a DNS lookup utility.