Howto DNS server on Linux | RHEL5 ==============================================
Under RHEL5, these are the packages that I have.
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.el5You can use the chkconfig command to get BIND configured to start at boot:-
[root@map007]# chkconfig –levels 2345 named on
To start, stop, and restart BIND after booting, use:-
[root@map007]# /etc/init.d/named start
[root@map007]# /etc/init.d/named stop
[root@map007]# /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 “linuxsurgeon.org” IN {
type master;
file “/var/named/zones/linuxsurgeon.org.zone”;
allow-update { none; };
};
And then, at /var/named/zones/linuxsurgeon.org.zone, you have the zone file,look like this:
; Zone File for mydomain.com
$TTL 14400
@ 14440 IN SOA ns1.linuxsurgeon.org. info.linuxsurgeon.org. ( 2006102400
14400
7200
3600000
86400
)linuxsurgeon.org. 14400 IN NS ns1.linuxsurgeon.org.
linuxsurgeon.org. 14400 IN NS ns2.linuxsurgeon.org.linuxsurgeon.org. 14400 IN A 192.168.11.1
linuxsurgeon.org. 14400 IN MX 0 mail.linuxsurgeon.org.
localhost 14400 IN A 127.0.0.1
mail 14400 IN A 192.168.11.1
www 14400 IN CNAME linuxsurgeon.org.
linuxsurgeon.org. 14400 IN MX 5 linuxsurgeon.org.ns1.linuxsurgeon.org. 14400 IN A 192.168.11.1
ns2.linuxsurgeon.org. 14400 IN A 192.168.11.1
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.linuxsurgeon.org. info.linuxsurgeon.org. (
200303301 ; serial number
8H ; refresh, seconds
2H ; retry, seconds
4W ; expire, seconds
1D ) ; minimum, secondslinuxsurgeon.org. IN NS ns1.linuxsurgeon.org. ; Nameserver Address
11 IN PTR linuxsurgeon.org.
12 IN PTR blog.linuxsurgeon.org.
Now Save your configurations file and restart your dns service.
To start, stop, and restart BIND after booting, use:-
[root@map007]# /etc/init.d/named start
[root@map007]# /etc/init.d/named stop
[root@map007]# /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 linuxsurgeon.org
nameserver 192.168.11.1
nameserver 192.168.11.2The 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@map007]# host www.linuxsurgeon.org
www.linuxsurgeon.org point to 192.168.11.1
[root@map007]#
To check a reverse lookup or RDNS
[root@map007]# host 192.168.11.1
1.11.168.192.in-addr.arpa domain name pointer 192-168-11-1.mycomisp.in.
[root@map007]#
The nslookup command on Windows PCs. To check forward lookup
C:\> nslookup www.linuxsurgeon.org
Server: 192-168-11-20.my-server.com
Address: 192.168.11.20Non-authoritative answer:
Name: www.linuxsurgeon.org
Address: 192.168.11.1C:\>
To check a reverse lookup
C:\> nslookup 192.168.11.1
Server: 192-168-11-20.my-server.com
Address: 192.168.11.20Name: 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 !!!
HOW TO CREATE DNS SERVER IN RHEL5
Nov-8th-2009













Comments
Thanks very much for writing all of the great info! Looking forward to seeintg more posts!
Simply briliant!…
Just love your writing style….
Someone to lean on…
I regularly check in for your posts, well done!…