DNS Server Lab Manual
DNS Server Lab Manual
04 LTS
( DNS SERVER )
Make a Lab group that consist of 3 (three) computers, and setup with the following
parameters :
127.0.0.1localhost
1
2
#ThefollowinglinesaredesirableforIPv6capablehosts
3
::1localhostip6localhostip6loopback
4
ff02::1ip6allnodes
5
ff02::2ip6allrouters
6
7
10.1.100.42ns2.homelab.localns2
8
4. Configure BIND to run in IPv4 mode by editing the bind9 service parameters file:
$sudovi/etc/default/bind9
1
#runresolvconf?
1
RESOLVCONF=no
2
3
#startupoptionsfortheserver
4
OPTIONS="4ubind"
5
$sudovi/etc/bind/named.conf.options
1
1 options{
2 directory"/var/cache/bind";
3
4 //Ifthereisafirewallbetweenyouandnameserversyouwant
5 //totalkto,youmayneedtofixthefirewalltoallowmultiple
6 //portstotalk.Seehttp://www.kb.cert.org/vuls/id/800113
7
//IfyourISPprovidedoneormoreIPaddressesforstable
8
//nameservers,youprobablywanttousethemasforwarders.
9
//Uncommentthefollowingblock,andinserttheaddressesreplacing
10
//theall0'splaceholder.
11
12 //forwarders{
13 //0.0.0.0;
14 //};
15
16 //========================================================================
17 //IfBINDlogserrormessagesabouttherootkeybeingexpired,
18 //youwillneedtoupdateyourkeys.Seehttps://www.isc.org/bindkeys
19 //========================================================================
20 dnssecvalidationauto;
21
22 authnxdomainno;#conformtoRFC1035
23 listenonv6{any;};
24 };
25
3. First we will define an access control list called trusted that will determine which
clients the DNS servers will allow recursive queries from. You can enter individual
client IP addresses to tightly control access but since this is a home lab we will use
subnets to permit recursive queries from the 10.1.100.0/24 network. Add the
ACL before the options block as follows:
//Labsubnetswewishtoallowrecursivequeriesfrom.
1 acl"trusted"{
2 10.1.100.0/24;#labnetwork
3 };
4
3. Add a reverse zone for the 10.1.100.0/24 subnet. The reverse mapping for
10.1.100 is entered as 100.1.10:
zone"100.1.10.inaddr.arpa"{
1
typemaster;
2 file"/etc/bind/zones/db.10.1.100";#10.1.100.0/24subnet
3 allowtransfer{10.1.100.42;};#ns2privateIPaddresssecondary
4 };
5
4. If your lab includes multiple subnets you want to provide DNS resolution for you
should add a zone and zonefile for each subnet. At this point the
/etc/bind/named.conf.local file should look like the following:
1 zone"homelab.local"{
2 typemaster;
3 file"/etc/bind/zones/db.homelab.local";#zonefilepath
4 allowtransfer{10.1.100.42;};#ns2privateIPaddresssecondary
5 };
6
zone"100.1.10.inaddr.arpa"{
7
typemaster;
8 file"/etc/bind/zones/db.10.1.100";#10.1.100.0/24subnet
9 allowtransfer{10.1.100.42;};#ns2privateIPaddresssecondary
10 };
11
2. Create the
forward zone file for homelab.local based on the
/etc/bind/db.local sample:
$cd/etc/bind/zones
1
$sudocp../db.local./db.homelab.local
2
8. Add A records for the hosts in your lab that you want to have *.homelab.local
FQDNs. For this example well create A records for ns1,ns2, and host1:
;nameserversArecords
1
ns1.homelab.local.INA10.1.100.41
2 ns2.homelab.local.INA10.1.100.42
3 ;
4 ;10.1.100.0/24Arecords
5 host1.homelab.local.INA10.1.100.90
6
1 $TTL604800
2 @INSOAns1.homelab.local.admin.homelab.local.(
3 3;Serial
604800;Refresh
4
86400;Retry
5
2419200;Expire
6
604800);NegativeCacheTTL
7
;
8 ;nameserversNSrecords
9 INNSns1.homelab.local.
10 INNSns2.homelab.local.
11 ;
12 ;nameserversArecords
13 ns1.homelab.local.INA10.1.100.41
14 ns2.homelab.local.INA10.1.100.42
15 ;
16 ;10.1.100.0/24Arecords
17 host1.homelab.local.INA10.1.100.90
18
1 ;
;BINDreversedatafileforlocalloopbackinterface
2
;
3
$TTL604800
4
@INSOAlocalhost.root.localhost.(
5
1;Serial
6 604800;Refresh
7 86400;Retry
8 2419200;Expire
9 604800);NegativeCacheTTL
10 ;
11 @INNSlocalhost.
12 1.0.0INPTRlocalhost.
13
4. As we did with the forward zone file edit the SOA record and increment the serial
value as follows:
@INSOAns1.homelab.local.admin.homelab.local.(
1 2;Serial
2
1 $TTL604800
2 @INSOAns1.homelab.local.admin.homelab.local.(
2;Serial
3
604800;Refresh
4
86400;Retry
5
2419200;Expire
6
604800);NegativeCacheTTL
7 ;
8 ;nameserversNSrecords
9 INNSns1.homelab.local.
10 INNSns2.homelab.local.
11 ;
12 ;PTRRecords
13 41INPTRns1.homelab.local.;10.1.100.41
14 42INPTRns2.homelab.local.;10.1.100.42
15 90INPTRhost1.homelab.local.;10.1.100.90
16
4. If there are no syntax errors you should see something similar to the following:
zonehomelab.local/IN:loadedserial3
1
OK
2
6. If there are no syntax errors you should see something similar to the following:
zone100.1.10.inaddr.arpa/IN:loadedserial2
1 OK
2
Restart BIND
Restart the BIND service:
$sudoservicebind9restart
1
4. Configure BIND to run in IPv4 mode by editing the bind9 service parameters file:
$sudovi/etc/default/bind9
1
3. Add an ACL to permit recursive queries from the 10.1.100.0/24 network before the
options block as follows:
//Labsubnetswewishtoallowrecursivequeriesfrom.
1 acl"trusted"{
2 10.1.100.0/24;#labnetwork
3 };
4
3. Add a reverse zone for the 10.1.100.0/24 subnet. The reverse mapping for 10.1.100
is entered as 100.1.10:
zone"100.1.10.inaddr.arpa"{
1
typeslave;
2 file"db.10.1.100";
3 masters{10.1.100.41;};#ns1privateIP
4 };
5
$sudonamedcheckconf
1
2. If the configuration files have no syntax errors you wont see any error messages.
Restart BIND
Restart the BIND service:
$sudoservicebind9restart
1
3. Look for the parameters. Remove the existing dns-nameservers and dns-search entries
and replace them with your private domain and ns1 and ns2 private IP addresses.
4. When done editing it should look like:
1 ifaceloinetloopback
autolo
2
3
#primarynetworkinterface
4
autoeth0
5
ifaceeth0inetstatic
6 address10.1.100.90
7 netmask255.255.255.0
8 network10.1.100.0
9 broadcast10.1.100.255
10 gateway10.1.100.1
11 dnssearchhomelab.local
12 dnsnameservers10.1.100.4110.1.100.42
13
When you perform a DNS query for host1 it is expanded to host1.homelab.local because of the
dns-search homelab.local that is set in the network interfaces configuration file. The command
output should be:
dadung@host1:~$nslookuphost1
1
Server:10.1.100.41
2 Address:10.1.100.41#53
3
4 Name:host1.homelab.local
5 Address:10.1.100.90
6
;<<>>DiG9.9.53ubuntu0.1Ubuntu<<>>[email protected]
1 ;;globaloptions:+cmd
2 ;;Gotanswer:
3 ;;>>HEADER<<opcode:QUERY,status:NOERROR,id:58763
4 ;;flags:qraardra;QUERY:1,ANSWER:3,AUTHORITY:0,ADDITIONAL:3
5
6 ;;OPTPSEUDOSECTION:
7 ;EDNS:version:0,flags:;udp:4096
8 ;;QUESTIONSECTION:
9 ;homelab.local.INANY
10
11 ;;ANSWERSECTION:
12 homelab.local.604800INNSns1.homelab.local.
13 homelab.local.604800INNSns2.homelab.local.
14 homelab.local.604800INSOAns1.homelab.local.admin.homelab.local.360480086400
15 2419200604800
16
17 ;;ADDITIONALSECTION:
18 ns1.homelab.local.604800INA10.1.100.41
ns2.homelab.local.604800INA10.1.100.42
19
20
;;Querytime:1msec
21
;;SERVER:10.1.100.42#53(10.1.100.42)
22
;;WHEN:FriFeb1322:32:04EST2015
23 ;;MSGSIZErcvd:152
24
If the command output from the forward and reverse lookups match the examples above it
means that your DNS servers are configured properly.
Summary
This Lab manual walks through setting up a private DNS environment with redundant DNS
servers running BIND. We also tested querying the DNS servers using a third Ubuntu
system to confirm that both work as expected.