# Data Networking/Fall 2014/Shalini/DNS
## DNS

DNS is the overhead application layer protocol, which performs domain name service for the devices that are connected to the network. Domain name system translates the logical ip address of the device and converts it to a format suitable for human understanding and vice versa. An often-used analogy to explain the Domain Name System is that it serves as the phone book for the Internet. The Domain Name System distributes the responsibility of assigning domain names and mapping those names to IP addresses. DNS is a distributed database implemented in a hierarchy of different levels of name servers.

### Behaviour of the Protocol

DNS is a Client-Server application layer protocol which uses the services of UDP (Transport layer Protocol) at port number 53 (RFC 1035). DNS client will request for mapping of a host with a DNS request packet and the DNS server will fetch the associated record, encapsulates it in a reply packet and sends it via UDP.

### DNS SERVER

The authoritative name server of a company holds the records for its web servers, mail servers and canonical names of the servers. The records of these authoritative name servers are uploaded into the DNS by the registrars who are certified by Internet Corporation For Assigned Names And Numbers (ICANN).

### SIGNALING:

1. The client will generate a DNS query and will pass it to the LOCAL DNS.
2. The LOCAL DNS will forward this query to the ROOT Name Server and a reply will be sent to the LOCAL DNS. This reply will contain the NS and A records of corresponding TLD server.
3. The LOCAL DNS will query the TLD Name Server s and a reply will be sent to the ROOT DNS containing the NS and A records of corresponding AUTHORITATIVE Name Server.
4. The ROOT server will query the AUTHORITATIVE Name Server and a reply will be sent to the LOCAL DNS containing the mapping of query sent by client.

### CONFIGURATION OF DNS

IP addressing: The DNS server is in the private network for which a DHCP server assigns a temporary IP addresses. But the server needs to have a permanent single IP address for the clients to access. So, the server can be assigned a static IP address, by going to network settings/edit connections/select the network/IPv4 settings/ method: manual and save the settings. However, we have configured DHCP server to assign a permanent address to the server, given the mac address of the server and hence no need to assign static IP addressing.
The configuration of DNS can be done using various softwares:
1. BIND
2. POSADIS
3. POWER DNS
We have used BIND( Berkely Internet Name Domain) version 9 for configuring DNS because it can be used on majority of name serving machines on the internet and provide a robust architecture on which the DNS of a organization can be designed. Also we decided to use BIND because of its some important features like DNS security, DNS protocol enhancements and Multiprocessor support.

### STEPS TO CONFIGURE DNS

Assign permanent IP through DHCP Server to the DNS server:
IP assigned to the DNS is 192.168.3.52
Install Bind:
Use the following command to install bind9-
Edit the options file:
It is done to configure the primary DNS. The command used is-
Edit the host file:
Edit the file as follows:
Configure the local file:
Use the command shown below to access the file.
Once the file opens, configure the forward and reverse lookup zones.
Create zone directory and forward and reverse files:
To create the zone directory, use the command-
The forward lookup zone does hostname > IP address translation and reverse lookup zone does IP address > hostname translation.
Our forward lookup zone file is db.fabfour.com.
Edit the forward lookup zone file by a command specifying the path
Our reverse lookup zone filename is db.192.168.3
Edit the reverse lookup zone file by a command specifying the path
Restart bind:
Finally, restart bind to load the server. Use the command-

### Testing

Checking of the forward and reverse zone files
Use the following commands-
* for forward lookup zone
* for reverse lookup zone
If an error is not there in any of the files then the serial is shown at the output. It is as follows:
* for forward lookup zone
* for reverse lookup zone
Checking forward lookup zone:
Use the command-
This shows the hostname for the IP address as vivek.fabfour.com which is the name server of Fabfour.
Checking reverse lookup zone:
Use the command-
This shows the IP address of the host as 192.168.3.60 which is the IP address of the webserver.