Practical Exercises


Objective: configure your node computer as a DNS server and your desktop as a client to the server. Try configurations of master, slave and caching servers.

Gethostbyname function

Download perl script gethostbyname.pl. Make it executable and run it to resolve the IP addresses for following hosts: localhost, unisys02, and eden.rutgers.edu.

BIND installation on Debian

apt-get install bind9
apt-get install bind9-host
apt-get install dnsutils

Generate files rndc.conf and rndc.key:
cd /etc/bind
rndc-confgen -r /dev/urandom > rndc.conf
rndc-confgen -r /dev/urandom -a
Copy the secret hash from rndc.key to that in rndc.conf. Change "default-port 953" for "default-port 955" so it wouldn't try binding to the TCP port used by rpc.statd. Besides commented out lines, your rndc.conf and rndc.key should look something like below:
# Start of rndc.conf
key "rndc-key" {
        algorithm hmac-md5;
        secret "ylnZwDNmLo7xwJDNzIW0zg==";
};

options {
        default-key "rndc-key";
        default-server 127.0.0.1;
        default-port 955;
};
# End of rndc.conf

# Start of rndc.key
key "rndc-key" {
        algorithm hmac-md5;
        secret "ylnZwDNmLo7xwJDNzIW0zg==";
};
# End of rndc.key
If named was running, reload named:
pkill -HUP named

Caching only DNS

Download local zone files localhost.zone, 0.0.127.in-addr.arpa.zone into /etc/bind. Download named.conf for the case of caching DNS only: named.conf-caching and copy it to /etc/bind/named.conf then start bind:
cp named.conf-caching  /etc/bind/named.conf
/etc/init.d/bind9  start
Check the status of the server:
rndc status

If it gives you error rndc: connect failed: connection refused, kill the named
pkill -9 named
and verify that both rndc.conf and rndc.key contain the same secret hash; start bind9.

Quiry the server for MX record of host engsoft.rutgers.edu
dig MX @127.0.0.1 engsoft.rutgers.edu.
If the DNS is working properly, it should give you an output with the answer section as follows:
;; ANSWER SECTION:
engsoft.rutgers.edu.    86400   IN      MX      0 soemail.rutgers.edu.

Stop running dhclient on your desktop and the node machine so it won't overwirte /etc/resolv.conf then run ifconfig to set static IPs.
pkill -9 dhclient3
ifconfig lo 127.0.0.1 netmask 255.0.0.0
ifconfig eth0 192.168.5.18  netmask 255.255.255.0  #use your machine IP here

In /etc/resolv.conf on the node make the only entry:
search rutgers.edu 
nameserver 127.0.0.1
On the desktop, instead 127.0.0.1, use the node IP address, accordingly.
Try to query your DNS server from the desktop
dig engsoft.rutgers.edu.
Make sure it shows your SERVER: on the bottom of the output.

Slave DNS

Download named.conf for the case of slave Rutgers DNS, named.conf-slave, and copy it into /etc/bind/named.conf
Update the list or root name servers:
dig @a.root-servers.net . ns > /etc/bind/db.root

Issue command
rndc reload
Check for appearing of new zone files in /var/cache/bind
Query the DNS:
dig engsoft.rutgers.edu.

Master DNS

Download named.conf for the case of master DNS, named.conf-master, and copy it to /etc/bind/named.conf. Download the master zone files, linux.class, 192.168.5, create directory /var/cache/bind/pdm and copy them into the directory:
mkdir /var/cache/bind/pdm
cp linux.class /var/cache/bind/pdm
cp  192.168.5  /var/cache/bind/pdm
Reload the server:
rndc reload

In /etc/resolv.conf, replace search rutgers.edu with search linux.class
Query thye server
dig unisys18.linux.class.

Modify the zone files in /var/cache/bind/pdm by including your host entries there. Reload the server after modifications are done:
rndc reload



Previous Pageprevious First Pagetop