Installing DNS on Linux

Posted by peter on October 13, 2011

yum install the following:

bind

bind-utils

bind-libs

Edit the /etc/resolv.conf file as follows, and add your proxy server's own ip address as a server.

-----------------------example-------------------------------------------------

#for DNS master server - put in it's own IP

nameserver 127.0.0.1

-----------------------example end-------------------------------------------

Edit the /var/named/chroot/etc/named.conf file as follows: (Added or changed text in bold)

NB some installations might not be “chrooted” so check the location as you install and adjust according. The named.conf file could be in the “/etc” directory.

The ref to the "reverse lookup" can be your IP address in reverse order. Forwarders will be when the DNS server will direct requests if it can't reslove it it's self

----------------------example--------------------------------

// Default named.conf generated by install of bind-9.2.4-16.EL4

options {

directory "/var/named";

dump-file "/var/named/data/cache_dump.db";

statistics-file "/var/named/data/named_stats.txt";

forwarders { 168.210.2.2; 196.14.239.2; };

}; 

zone "yourdomainname.com" {

type master;

notify no;

allow-query {any; };

file "yourdomainname.zone";

};

zone "0.20.10.in-addr.arpa" {

type master;

notify no;

file "10-20-0.zone";

};

include "/etc/rndc.key";

-----------------Example end-----------------------------------

In the above example, you could limit those allowed to resolve the domain name to your local network by changing “any” in the allow query section to “<ipaddressrange>/24”

Create the “root.hint” and the 127.0.0.zone files from backup or the server, into the /var/named/ folder

Create the zone files in the /var/named/ directory. Note the file name in the named.conf file and create a forward and reverse lookup file for each. Example follows:

-------------------------Example forward lookup-------------------------------------

$TTL 3D

@ IN SOA yourdomain.com. admin.mail.yourdomain.com. (

2010070231 ;serial

4H ;refresh

1H ;retry

1W ;expiry

1D ) ;Minumum

 

NS www ;address of nameserver

yourdomain.com. MX 10 mail ;mail server

 

mail A 192.168.166.1

server CNAME mail

-----------------------------Example end---------------------------------

NB Make sure that you have put a “.” after the domain name in the zone file. Also the address of the administrator (admin.mail.yourdomain.com.) has a “.” instead of an “@”, and there is also a “.” at the end of the address.

------------------------------Example of reverse lookup--------------

$TTL 3D

 

@ IN SOA www.yourdomain.com. admin.mail.yourdomain.com. (

2010007231 ;serial

8H ;refesh

2H ;retry

4W ;expire

1D ) ;minimum

 

NS www ;Nameserver address

3 PTR mail.yourdomain.com.

-------------------------Example end--------------------------------

Please note that if you make any additional changes to the above documents you must increment the "serial number" (use the date)

Start the named service with the command “service named start”, while checking in the “/var/log/messages” for errors - There should be no errors, and you should see your zone files load/

Test by pinging from a client that is set to use your DNS server

NB type the following at the command prompt to start DNS at boot

chkconfig named on

Start the DNS server with the following command:

service named start

Comments:

Leave a Reply



(Your email will not be publicly displayed.)

Please type the letters and numbers shown in the image.Captcha CodeClick the image to see another captcha.