Chapter 15. Setting up DNS Part 3: A recursive resolver for isp.sam

Finally, we will set up the resolver on the isp.sam side, so the customer VM can do a single query against the resolver, which will in turn do a recursive query through all of the servers and come back with an answer.

First, clone ns1-projreality-sam.vdi to dns1-isp-sam.vdi, and create a VM called "dns1.isp.sam" using the cloned hard drive. Set Adapter 1 to the Internal Network "isp customers", and start up the VM.

Set the hostname to "dns1.isp.sam", set the eth0 to "dhcp" (delete all references to eth1), and disable the default gateway setting by putting a ! in front of "gateway". The DHCP server will take care of the this stuff.

Before we forget, let's go to gateway.isp.sam and set up a fixed address for dns1.isp.sam . Edit /etc/dhcpd.conf on that VM, and in the subnet section, add

	host static-client {
		hardware ethernet 08:00:27:1D:BC:B5;
		fixed-address 172.16.152.10;
	}

Note - the ethernet address of your VM will probably we different. On the dns1.isp.sam VM, issue ifconfig eth0 and look for "HWaddr".

After you have made the changes to /etc/dhcpd.conf, kill the dhcpd process and restart it with sudo dhcpd.

Back to dns1.isp.sam - BIND needs to know the IP addresses of the root servers are. A default list is shipped with BIND, and is located at /var/named/root.hint. This contains the root servers for the Internet. However, since we have configured our own root server, we will need to change this file. First, rename the existing file:

sudo mv -i /var/named/root.hint /var/named/root.hint.orig

Next, create /var/named/root.hint

.	3600000	IN	NS	rns.
rns.	3600000	IN	A	172.16.50.100

Finally, edit /etc/named.conf. Have the server listen on the correct IP address:

	listen-on { 172.16.152.10; };

and add a section for the root hint:

zone "." IN {
	type hint;
	file "root.hint";
};

Now reboot the VM, and issue a dig www.projreality.sam from the customer VM. It should come back with the answer. Notice we didn't use @server-ip, since 172.16.152.10 is configured as the default nameserver in /etc/resolv.conf (which came from the DHCP server).

And now for the grand finale:

Start up backbone1, gateway.isp.sam, dns1.isp.sam, customer, gateway.isp2.sam, router1.projreality.sam, firewall.projreality.sam, ns1.projreality.sam, www.projreality.sam

Go to the customer VM, start up X, and start up Firefox. Go to the address http://www.projreality.sam, and the Hello world front page should show up.