0% found this document useful (0 votes)
175 views6 pages

DNS Server Installation

The document discusses setting up a DNS server using BIND on a server. It describes installing BIND, configuring it to cache requests and forward unresolved queries to public DNS servers. Zone files are created for the local domain and reverse lookups. The DNS server is tested by resolving external and internal hostnames.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
175 views6 pages

DNS Server Installation

The document discusses setting up a DNS server using BIND on a server. It describes installing BIND, configuring it to cache requests and forward unresolved queries to public DNS servers. Zone files are created for the local domain and reverse lookups. The DNS server is tested by resolving external and internal hostnames.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

The software we are going to use for the DNS server is ISC BIND (version 9), we can

install this simply from the terminal of your server like so:-
apt-get install bind9
Now that BIND is installed we are going to edit /etc/bind/[Link] options and
configure BIND to cache requests and forward unresolved queries.
nano /etc/bind/[Link]
Ensure that the file is updated (remove the comments from the forwarders section and
add your external DNS servers), in the below example Im using Googles public DNS
servers ([Link] and [Link]):
forwarders {
[Link];
[Link];
};
On your server (I assume you have configured a static IP address)
edit/etc/network/interfaces and well add these three settings:-
dns-nameservers [Link]
dns-search [Link]
dns-domain [Link]
This will ensure that your server now queries itself first before checking the external
DNS servers ([Link] and [Link]) and by using dns-search and dns-domain options
this means that instead of typing say [Link] in a browser or when
using ping etc you can actually just type server1 and this will resolve automatically
also!
Now we for the changes to take effect we need to restart the network interface, so to do
this run the following command:-
nohup sh -c "ifdown eth0 && ifup eth0"
So now the next thing that we need to do is to create the actual zone file for our local
domain (of which in this example is [Link]), well do so like so:-
nano /etc/bind/[Link]
Add a zone for our local domain like so:-
zone "[Link]" IN {
type master;
file "/etc/bind/zones/[Link]";
};
and so we can also do reverse lookups too, well also add a reverse lookup zone too:-
zone "[Link]" {
type master;
file "/etc/bind/zones/[Link]";
}
Now we create the actual the zone database file for our [Link] local domain, well
do this like so:-
mkdir /etc/bind/zones
nano /etc/bind/zones/[Link]
Now add the following content into the file (obviously replace the hostnames/IP address
with your own personal setup etc.):-
; Use semicolons to add comments.
; Host-to-IP Address DNS Pointers for [Link]
; Note: The extra "." at the end of the domain names are important.
; The following parameters set when DNS records will expire, etc.
; Importantly, the serial number must always be iterated upward to prevent
; undesirable consequences. A good format to use is YYYYMMDDII where
; the II index is in case you make more that one change in the same day.
$ORIGIN .
$TTL 86400 ; 1 day
[Link]. IN SOA [Link]. [Link]. (
2013091901 ; serial
8H ; refresh
4H ; retry
4W ; expire
1D ; minimum
)

; NS indicates that 'server1' is a/the nameserver on [Link]
; MX indicates that 'mail-server' is the mail server on [Link]
[Link]. IN NS [Link].
[Link]. IN MX 10 [Link].

$ORIGIN [Link].

; Set the address for [Link]
localhost IN A [Link]

; Set the hostnames in alphabetical order
print-srv IN A [Link]
router IN A [Link]
server2 IN A [Link]
server1 IN A [Link]
xbox IN A [Link]
mail-server IN A [Link]
Great, now save the file and we will now create the reverse DNS zone file (IP-Host
name resolution), so now well create a new file like so:-
nano /etc/bind/zones/[Link]
and now add the following content, again, replace IP addresses and host names with
your own!
; IP Address-to-Host DNS Pointers for the 192.168.0 subnet
@ IN SOA [Link]. [Link]. (
2013091901 ; serial
8H ; refresh
4H ; retry
4W ; expire
1D ; minimum
)
; define the authoritative name server
IN NS [Link].
; our hosts, in numeric order
1 IN PTR [Link].
2 IN PTR [Link].
3 IN PTR [Link].
5 IN PTR [Link].
9 IN PTR [Link].
11 IN PTR [Link].
Fantastic! were nearly there, now we simply need to restart the BIND daemon for the
changes to take effect, we do this like so:
service bind9 restart
Great, our server should now be able to resolve both external (forwarded DNS) queries
and our new local DNS records, so lets do some testing:-
host [Link]
The response received should look as follows:-
[Link] has address [Link]
[Link] has IPv6 address [Link]
Thats great, now lets do a reverse lookup on all our internal machines like so:-
host -l [Link]
You should now see a full list of the hosts (A records) that we had previously set-
up and so one final test lets test out a reverse lookup, lets execute:-
host [Link]
The response should have been:
[Link].[Link] domain name pointer [Link].
Super stuff!! Thats it, there you have your own internal DNS server which supports
query caching and forward lookups enjoy!
A few things to be aware of/concious about:-
Always remember to increment the serial when updating the zone files.
Ideally you should ensure that your router/firewall is not allowing public access to your
DNS server (TCP port 53) on your internal DNS server as otherwise you DNS server
will be available to everyone on the internet which obviously isnt ideal/a security risk in
this instance seems as its been set-up for local network DNS queries.
In this set-up we configured the server to use itself for DNS lookup, this also needs to
be set-up on the other clients on your network, If you have a DHCP server you should
specify your DNS servers IP in its settings, as well as the search domain. If you dont
have a DHCP server in your network you should configure these manually for the
network card/interface.

You might also like