Configure DNS Server ( Quick Dirty Notes)

Configure DNS Server ( Quick Dirty Notes)

by -
0 1166

Dirty Notes for Configure DNS Server ( QuicK Notes)

for Domain

abc.local  > 192.168.1.254
xyz.local > 192.168.1.254

# yum install caching-nameserver*

Need to modify two files

named.caching-nameserver.conf
named.rfc1912.zones

# vi /etc/named/ named.caching-nameserver.conf

//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE – use system-config-bind or an editor
// to create named.conf – edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
listen-on port 53 { 127.0.0.1;192.168.1.254;};     <–modify here
listen-on-v6 port 53 { ::1; };
directory “/var/named”;
dump-file “/var/named/data/cache_dump.db”;
statistics-file “/var/named/data/named_stats.txt”;
memstatistics-file “/var/named/data/named_mem_stats.txt”;

// Those options should be used carefully because they disable port
// randomization
// query-source port 53;
// query-source-v6 port 53;

allow-query { any; };   <–modify here
allow-query-cache { any; }; <–modify here
};
logging {
channel default_debug {
file “data/named.run”;
severity dynamic;
};
};
view localhost_resolver {
match-clients { any; }; <–modify here
match-destinations { any; }; <–modify here
recursion yes;
include “/etc/named.rfc1912.zones”;
};

——————————————————————————————————————————

Now edit file  /etc/named.rfc1912.zones

# vi /etc/named.rfc1912.zones

// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone “.” IN {
type hint;
file “named.ca”;
};

zone “localdomain” IN {            <– copy bold lines and paste them in the bottom and modify accordingly
        type master;
        file “localdomain.zone”;
        allow-update { none; };
};

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; };
};

zone “0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa” IN {
type master;
file “named.ip6.local”;
allow-update { none; };
};

zone “255.in-addr.arpa” IN {
type master;
file “named.broadcast”;
allow-update { none; };
};
zone “0.in-addr.arpa” IN {
type master;
file “named.zero”;
allow-update { none; };
};
zone “abc.local” IN {
        type master;
        file “abc.zone”;
        allow-update { none; };
};

zone “xyz.local” IN {
        type master;
        file “xyz.zone”;
        allow-update { none; };
};

save the file, now go to DNS data Directory /var/named/

——————————————————————————————————————————

#cd /var/named

# ls -l
total 23
drwxr-x— 6 root  named 4096 May 16 18:48 chroot
drwxrwx— 2 named named 4096 Dec 12 08:21 data
lrwxrwxrwx 1 root  named   44 May 16 18:45 localdomain.zone -> /var/named/chroot/var/named/localdomain.zone
lrwxrwxrwx 1 root  named   42 May 16 18:45 localhost.zone -> /var/named/chroot/var/named/localhost.zone
lrwxrwxrwx 1 root  named   43 May 16 18:45 named.broadcast -> /var/named/chroot/var/named/named.broadcast
lrwxrwxrwx 1 root  named   36 May 16 18:45 named.ca -> /var/named/chroot/var/named/named.ca
lrwxrwxrwx 1 root  named   43 May 16 18:45 named.ip6.local -> /var/named/chroot/var/named/named.ip6.local
lrwxrwxrwx 1 root  named   39 May 16 18:45 named.local -> /var/named/chroot/var/named/named.local
lrwxrwxrwx 1 root  named   38 May 16 18:45 named.zero -> /var/named/chroot/var/named/named.zero
drwxrwx— 2 named named 4096 Dec 12 08:21 slaves

now copy localdomain.zone file as abc.zone and xyz.zone and  modify accordingly

# cp localdomain.zone xyz.zone

——————————————————————————————————————————

#vi xyz.zone

$TTL    86400
@               IN SOA  localhost root (
42              ; serial (d. adams)
3H              ; refresh
15M             ; retry
1W              ; expiry
1D )            ; minimum
IN NS           localhost
localhost       IN A            127.0.0.1

——————————————————————————————————————————

after modfication >> should look like this

$TTL    86400
@               IN SOA  xyz.local. root (
42              ; serial (d. adams)
3H              ; refresh
15M             ; retry
1W              ; expiry
1D )            ; minimum
IN NS           xyz.local.
xyz.local.      IN A            192.168.1.254

Do similar task for abc.local, to link setting or chrooting give command

——————————————————————————————————————————

# bind-chroot-admin -e

# service named restart
Stopping named:                                            [  OK  ]
Starting named:                                              [  OK  ]

Set DNS Server Entry in /etc/resolv.conf

#vi /etc/resolv.conf
nameserver 192.168.1.254

Now test DNS, for up and running

————————————————–

# nslookup abc.local
Server:         192.168.1.254
Address:        192.168.1.254#53

Name:   abc.local
Address: 192.168.1.254

————————————————-

# nslookup xyz.local
Server:         192.168.1.254
Address:        192.168.1.254#53

Name:   xyz.local
Address: 192.168.1.254

————————————————-

 

CEO, KV IT-Solutions Pvt. Ltd. | vikas@kvit.in | 9810028374|
Linux Professional and an Industrial Trainer | 20 + years Experience in IT Industry

” We are born free, No Gate and Windows can snatch our freedom “

Download PDF

SIMILAR ARTICLES

0 1123

0 789