User Tools

Site Tools


linux:dns

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

linux:dns [2019/01/21 11:24] (current)
seanburns created
Line 1: Line 1:
 +<​markdown>​
 +# DNS
 +## 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:
 +
 +```bash
 +$ sudo su
 +# nano /etc/hosts
 +10.163.36.69 sised
 +```
 +
 +After adding that line, save the file and exit. Now test whether 10.163.36.69
 +resolves to the domain name **sised**. We can do that with the *w3m* text mode
 +browser:
 +
 +```bash
 +# 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:
 +
 +FQDN: www.google.com.
 +
 +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: https://​web.archive.org/​web/​20081121061730/​http://​www.smtpnic.org/​
 +* opennic: https://​www.opennicproject.org/​
 +* alternic: https://​en.wikipedia.org/​wiki/​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:
 +
 +```bash
 +$ wget http://​data.iana.org/​TLD/​tlds-alpha-by-domain.txt
 +$ 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 redhat.com and debian in debian.org. The book refers to this
 +part of the FQDN as that which makes up the "​organizational boundary of the
 +namespace"​ ([Soyinka, 2016][1], p. 425). 
 +
 +## Third-level domain names / hostnames / subdomains
 +
 +When you've purchased (leased) a top and second level domain like
 +getfedora.org,​ you, as an admin, can choose whether you employ third level
 +domains. For example: www is a third level domain. If you owned
 +``example.org``,​ you could also have ``www.example.org`` resolve to a different
 +location. Or, ``www.example.org`` could resolve to the second-level domain
 +itself. That is:
 +
 +* www.debian.org points to debian.org
 +
 +This is the conventional use, especially with hostnmames that are not ``www``.
 +For exmample:
 +
 +* google.com resolves to www.google.com
 +* google.com does not resolve to drive.google.com or maps.google.com or
 +  mail.google.com
 +
 +## 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:
 +
 +https://​www.iana.org/​domains/​root/​files
 +
 +## 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 google.com
 +    google.com. ​    ​IN ​     A       ​216.58.192.142
 +
 +- 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 www.example.org,​ but no
 +  subdomain is set up for www, then the CNAME can point to example.org.
 +
 +## DNS Toolbox
 +
 +**host**: resolve hostnames to IP Address; or IP addresses to hostnames
 +
 +```bash
 +$ man -f host
 +host (1) - DNS lookup utility
 +$ host uky.edu
 +$ host 128.163.111.50
 +```
 +
 +**dig**: domain information gopher -- get info on DNS servers
 +
 +```bash
 +$ man -f dig
 +dig (1) - DNS lookup utility
 +$ dig uky.edu
 +$ dig uky.edu MX
 +$ dig www.uky.edu CNAME
 +```
 +
 +**nslookup**:​ query internet name servers
 +
 +```bash
 +$ man -f nslookup
 +nslookup (1) - query Internet name servers interactively
 +$ nslookup ​
 +> uky.edu
 +> yahoo.com
 +> exit
 +```
 +
 +**whois**: determine ownership of a domain
 +
 +```bash
 +$ man -f whois
 +whois (1) - client for the whois directory services
 +$ whois uky.edu | less
 +$ whois -h whois.arin.net "n 128.163.111.50"​
 +$ whois -h whois.arin.net "o facebook" ​     ​
 +```
 +
 +See https://​arin.net/​resources/​services/​whois_guide.html
 +
 +**resolve.conf**:​ local resolver info; what's your DNS info
 +
 +```bash
 +$ man -f  resolv.conf
 +resolv.conf (5) - resolver configuration file
 +$ cat /​etc/​resolv.conf
 +```
 +
 +[1]: https://​www.amazon.com/​Linux-Administration-Beginners-Guide-Seventh/​dp/​0071845364
 +</​markdown>​
linux/dns.txt ยท Last modified: 2019/01/21 11:24 by seanburns