Monday, November 14, 2011

Fedora Core DNS Server using BIND



Setting and configure BIND as and Domain Name Sever (DNS) on Fedora Core Linux machine.

1. DNS (domain name system)
Correspondence of IP address and hostname
The  /etc/hosts file example

# IP Address Hostname Alias
127.0.0.1 localhost
192.168.42.1 apple www
192.168.42.2 desk desk.domain.cxm

Installation of BIND


BIND (Berkeley Internet Name Domain)

[root@tenouk ~]# mount /mnt/cdrom
[root@tenouk ~]# cd /mnt/cdrom/RedHat/RPMS
[root@tenouk ~]# rpm –Uhv bind-9.2.0-8.i386.rpm
[root@tenouk ~]# rpm –Uhv caching-nameserver-7.2.1.noarch.rpm
[root@tenouk ~]# cd /
[root@tenouk ~]# umount /dev/cdrom


Setting of client and server


edit the resolf.conf file to enable the client or server to find the DSN server.

[root@tenouk ~]# vi /etc/resolv.conf
search kimura.com
nameserver 10.10.0.235

Definition of IP address of DNS server which client uses

Setting the DNS server.


[root@tenouk ~]# vi /etc/named.conf
// generated by named-bootconf.pl
options {
directory "/var/named";
/*
* 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";
};

zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
// The following code is added
zone "kimura.com" IN {
type master;
file "named.kimura.com";
allow-update { none; };
};

zone "0.10.10.in-addr.arpa" IN {
type master;
file "named.10.10.0";
allow-update { none; };
};

include "/etc/rndc.key";


[root@tenouk ~]# cp /var/named/named.local /var/named/named.10.10.0
[root@tenouk ~]# vi /var/named/named.10.10.0

$TTL 86400
@ IN SOA jmtist20.kimura.com. root.jmtist20.kimura.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS jmtist20.kimura.com.

235 IN PTR jmtist20.kimura.com.
236 IN PTR compaq.kimura.com.


[root@tenouk ~]# cp /var/named/named.local /var/named/named.kimura.com
[root@tenouk ~]# vi /var/named/named.kimura.com

$TTL 86400
@ IN SOA jmtist20.kimura.com. root.jmtist20.kimura.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS jmtist20.kimura.com

IN MX 10 jmtist20.kimura.com

jmtist20 IN A 10.10.0.235
compaq IN A 10.10.0.236

Start BIND service


Start, stop and restart the named service.

[root@tenouk ~]# /etc/rc.d/init.d/named start
[root@tenouk ~]# /etc/rc.d/init.d/named stop
[root@tenouk ~]# /etc/rc.d/init.d/named restart

or

[root@tenouk ~]# /sbin/service named start
[root@tenouk ~]# /sbin/service named stop
[root@tenouk ~]# /sbin/service named restart

Setting automatic start for named on runlavel 3 and runlevel 5..

[root@tenouk ~]# /sbin/chkconfig --level 35 named on

Confirmation of automatic start.

[root@tenouk ~]# /sbin/chkconfig --list named

Confirmation of bind.


Use the command example below to test your DNS server functionality.

[root@tenouk ~]# ping 10.10.0.235
[root@tenouk ~]# ping 10.10.0.236
[root@tenouk ~]# ping jmtist20
[root@tenouk ~]# ping compaq
[root@tenouk ~]# ping jmtist20.kimura.com
[root@tenouk ~]# ping compaq.kimura.com
[root@tenouk ~]# nslookup jmtist20.kimura.com
[root@tenouk ~]# nslookup compaq.kimura.com
[root@tenouk ~]# nslookup 10.10.0.235
[root@tenouk ~]# nslookup 10.10.0.236

Note:
SOA - Start of authority
NS - Name server
A - Address record
PTR - Pointer record
MX - Mail exchanger