Skip to content


How to DNS server in Linux….

Under RHEL5, these are the packages that are mendatory to setup DNS sever :-

bind-9.3.3-9.0.1.el5

system-config-bind-4.0.3-2.el5

bind-libs-9.3.3-9.0.1.el5

bind-chroot-9.3.3-9.0.1.el5

bind-utils-9.3.3-9.0.1.el5

You can use the chkconfig command to get BIND configured to start at boot:-

[root@p-root]# chkconfig –levels 2345 named on

To start, stop, and restart BIND after booting, use:-

[root@p-root]# /etc/init.d/named start

[root@p-root]# /etc/init.d/named stop

[root@p-root]# /etc/init.d/named restart

When you installed named that directory is /var/named/chroot is actually the root or / directory. Therefore, named files normally found in the /etc directory are found in /var/named/chroot/etc directory instead, and those you’d expect to find in /var/named are actually located in /var/named/chroot/var/named.

You can define named how to run in the configuration file /etc/named.conf, and you also put the information about which zones it will be authoritative for. An example named.conf:

Code:

options {

directory “/var/named”;

dump-file “/var/named/data/cache_dump.db”;

statistics-file “/var/named/data/named_stats.txt”;

recursion no;

/*

* If there is a firewall between you and nameservers you want

* to talk to, you might need to uncomment the query-source

* directive below. Previous versions of BIND always asked

* questions using port 53, but BIND 8.1 uses an unprivileged

* port by default.

*/

// query-source address * port 53;

};

//

// a caching only nameserver config

//

controls {

inet 127.0.0.1 allow { localhost; } keys { rndckey; };

};

zone “.” IN {

type hint;

file “named.ca”;

};

include “/etc/rndc.key”;

};

zone “11.168.192.in-addr.arpa” IN {

type master;

file “/var/named/zones/192.168.11.zone”;

allow-update { none; };

};

zone “unixsurgeon.com” IN {

type master;

file “/var/named/zones/unixsurgeon.com.zone”;

allow-update { none; };

};

And then, at /var/named/zones/unixsurgeon.com.zone, you have the zone file,look like this:

; Zone File for mydomain.com

$TTL 14400

@ 14440 IN SOA ns1.unixsurgeon.com. info@unixsurgeon.com. ( 2006102400

14400

7200

3600000

86400

)

unixsurgeon.com. 14400 IN NS ns1.unixsurgeon.com.

unixsurgeon.com. 14400 IN NS ns2.unixsurgeon.com.

unixsurgeon.com. 14400 IN A 192.168.11.1

unixsurgeon.com. 14400 IN MX 0 mail.unixsurgeon.com.

localhost 14400 IN A 127.0.0.1

mail 14400 IN A 192.168.11.1

www 14400 IN CNAME unixsurgeon.com.

unixsurgeon.com. 14400 IN MX 5 unixsurgeon.com.

And then, at /var/named/zones/11.168.192.zone, look like this:

;

; Filename: 192-168-11.zone

;

; Zone file for 192.168.11.x

;

$TTL 3D

@ IN SOA www.unixsurgeon.com. hostmaster.unixsurgeon.com. (

200303301 ; serial number

8H ; refresh, seconds

2H ; retry, seconds

4W ; expire, seconds

1D ) ; minimum, seconds

NS www ; Nameserver Address

11 PTR unixsurgeon.com.

12 PTR blog.unixsurgeon.com.

Now Save your configurations file and restart your dns service.

To start, stop, and restart BIND after booting, use:-

[root@p-root]# /etc/init.d/named start

[root@p-root]# /etc/init.d/named stop

[root@p-root]# /etc/init.d/named restart

The /etc/resolv.conf File

DNS clients (servers not running BIND) use the /etc/resolv.conf file to determine both the location of their DNS server and the domains to which they belong. The file generally has two columns; the first contains a keyword, and the second contains the desired values separated by commas.Like this :-

search unixsurgeon.com

nameserver 192.168.11.1

nameserver 192.168.11.2

The host command accepts arguments that are either the fully qualified domain name or the IP address of the server when providing results. To perform a forward lookup, use the syntax:

[root@p-root]# host www.unixsurgeon.com

www.unixsurgeon.com point to 192.168.11.1

[root@p-root]#

To check a reverse lookup or RDNS

[root@p-root]# host 192.168.11.1

1.11.168.192.in-addr.arpa domain name pointer 192-168-11-1.mycomisp.in.

[root@p-root]#

The nslookup command on Windows PCs. To check forward lookup

C:\> nslookup www.unixsurgeon.com

Server: 192-168-11-20.my-server.com

Address: 192.168.11.20

Non-authoritative answer:

Name: www.unixsurgeon.com

Address: 192.168.11.1

C:\>

To check a reverse lookup

C:\> nslookup 192.168.11.1

Server: 192-168-11-20.my-server.com

Address: 192.168.11.20

Name: 192-168-11-1.my-comisp.in

Address: 192.168.11.1

Take a look at the end of your /var/log/messages file to make sure there are no errors.

Enjoy Linux !!! :)

Posted in DNS Server, Linux tutorials.

Tagged with , , , , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.