How to Configure the Linux Bind DNS Server

The BIND DNS Server, named, is used on the vast majority of name serving machines on the intranet or Internet. On this tutorial i will setup the intranet dns configuration that can help you to understand the basic of linux bind dns configuration.

Prerequisite : How to install Bind DNS server on CentOS and RHEL

[root@server ~]# cd /var/named/chroot/etc
[root@server etc]# vi named.conf
options {
        directory "/etc";
        pid-file "/var/run/named/named.pid";
	forwarders {
		202.188.0.133;
		202.188.1.5;
		};
        };

zone "myintranet.local" {
        type master;
        file "/var/named/myintranet.local.hosts";
        };
zone "2.168.192.in-addr.arpa" {
        type master;
        notify no;
        file "/var/named/db.192";
};
[root@server ~]# cd /var/named/chroot/var/named
[root@server named]# vi myintranet.local.hosts
$ttl 38400
myintranet.local.	IN	SOA	ns.myintranet.local. root.myintranet.local. (
			1298557357
			10800
			3600
			604800
			38400 )
myintranet.local.       IN      NS      ns.myintranet.local.

ns.myintranet.local.	IN	A	192.168.2.5
www.myintranet.local.	IN	A	192.168.2.5
[root@server ~]# cd /var/named/chroot/var/named
[root@server named]# vi db.192
$ttl 38400
2.168.192.in-addr.arpa.	IN	SOA	ns.myintranet.local. root.myintranet.local. (
			1298557341
			10800
			3600
			604800
			38400 )
@     IN      NS      ns.myintranet.local.
5.2.168.192.in-addr.arpa.	IN	PTR	ns.myintranet.local.
[root@server /]# /etc/rc.d/init.d/named start
Starting named:                                            [  OK  ]
[root@server /]# chkconfig named on

Run nslookup to test the DNS server working or not, please make sure that you have configured the DNS to 192.168.2.5.
Example TCP/IP configuration and successful nslookup result

IP Address. . . . . . . . . . . . : 192.168.2.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.2.1
DNS Servers . . . . . . . . . . . : 192.168.2.5

C:\>nslookup
Default Server:  ns.myintranet.local
Address:  192.168.2.5

> myintranet.local
Server:  ns.myintranet.local
Address:  192.168.2.5

Name:    myintranet.local

> www.myintranet.local
Server:  ns.myintranet.local
Address:  192.168.2.5

Name:    www.myintranet.local
Address:  192.168.2.5

> ns.myintranet.local
Server:  ns.myintranet.local
Address:  192.168.2.5

Name:    ns.myintranet.local
Address:  192.168.2.5

> exit

Leave a Reply

Your email address will not be published. Required fields are marked *