User Tools

Site Tools



Mon Oct 29 2018

In order to resolve IP address to domain names, we need some kind of system that will map these two identifiers to each other.

/etc/hosts: The Hosts File

Locate in /etc/hosts, let's modify this so that our SISED IP address is mapped to the name sised. To do that, let's add the following line just after the two localhost lines:

$ sudo su
# nano /etc/hosts sised

After adding that line, save the file and exit. Now test whether resolves to the domain name sised. We can do that with the w3m text mode browser:

# w3m sised

Our book illustrates that this is one way to create a kind of intranet that uses actual names instead of just IP addresses. Say that you have a home network and three computers on your network are funning web servers. If you assign statis IPs to these three computers using the software on your home router, and then modify the /etc/hosts files on each of those three computers to point those static IPs to domain names, then you have, basically, an internet.

FQDN: The Fully Qualified Domain Name

The structure of the domain name system is just like the structure of the UNIX/Linux file hierarchy. The book refers to it as an inverted tree.

The fully qualified domain name includes a period at the end of the top-level domain. Your browser is able to supply that dot since we often don't use it when typing website addresses.

Thus, for Google's main page, the FQDN is:


And the parts include:

.           root domain
com         top-level domain
google.     second-level domain
www.        third-level domain

Root domain

The root domain is managed by root name servers. These servers are managed by ICANN, the Internet Corporation for Assigned Names and Numbers

Alternative DNS root systems

It's possible to have alternate internets by using outside root name servers. Read about a few of them here:

  • sdf:
  • opennic:
  • alternic:

Top level domain (TLD)

Some example of top level domains include:

  • examples include: .org, .com, .net, .mil, .gov, etc.
  • country code: .us, .uk, .ca

We can download a list of those top level names from ICANN and count how many there are now (the book, at the time it was published, highlighted that there were 810 top-level domains:

$ wget
$ wc -l tlds-alpha-by-domain.txt
1536 tlds-alpha-by-domain.txt

The first line in that file is a title, and so there are 1535 top level domains currently in existence.

Second-level domain names

In the Google example, the second level domain is google. Other examples include: redhat in and debian in The book refers to this part of the FQDN as that which makes up the "organizational boundary of the namespace" (Soyinka, 2016, p. 425).

Third-level domain names / hostnames / subdomains

When you've purchased (leased) a top and second level domain like, you, as an admin, can choose whether you employ third level domains. For example: www is a third level domain. If you owned, you could also have resolve to a different location. Or, could resolve to the second-level domain itself. That is:

  • points to

This is the conventional use, especially with hostnmames that are not www. For exmample:

  • resolves to
  • does not resolve to or or

Forward and reverse resolution

Domain names are resolved by going from right to left

IP addresses are resolved by going from left to right

DNS servers

Root name servers -- contains the root zone file, and also point to the primary dns servers:

DNS Record types

  • SOA: Start of Authority: describes the site's DNS entries
    • IN: Internet Record
  • NS: Name Server: state which name server provides DNS resolution
  • A: Address records: provides mapping hostname to IP address

    $ dig IN A

  • PTR: Pointer Record: provides mapping form IP Address to Hostname

  • MX: Mail exchanger: the MX record maps your email server.
  • CNAME: Canonical name: used so that a domain name may act as an alias for another domain name. Thus, say someone visits, but no subdomain is set up for www, then the CNAME can point to

DNS Toolbox

host: resolve hostnames to IP Address; or IP addresses to hostnames

$ man -f host
host (1) - DNS lookup utility
$ host
$ host

dig: domain information gopher -- get info on DNS servers

$ man -f dig
dig (1) - DNS lookup utility
$ dig
$ dig MX
$ dig CNAME

nslookup: query internet name servers

$ man -f nslookup
nslookup (1) - query Internet name servers interactively
$ nslookup 
> exit

whois: determine ownership of a domain

$ man -f whois
whois (1) - client for the whois directory services
$ whois | less
$ whois -h "n"
$ whois -h "o facebook"      


resolve.conf: local resolver info; what's your DNS info

$ man -f  resolv.conf
resolv.conf (5) - resolver configuration file
$ cat /etc/resolv.conf
linux/dns.txt · Last modified: 2019/01/21 11:24 by seanburns