2015-02-11

bind(name server) installation

How to install the bind daemon on CentOS 7.0
1. install bind daemon by yum
yum install bind bind-chroot bind-libs bind-utils
or
yum install bind*

2. You can find configuration directory as below.
named configuration directory
[root@localhost etc]# pwd
/etc
[root@localhost etc]# ls -al named*
-rw-r-----. 1 root named 1736 Feb 11 11:06 named.conf
-rw-r--r--. 1 root named 2389 Dec 12 19:53 named.iscdlv.key
-rw-r-----. 1 root named  931 Jun 21  2007 named.rfc1912.zones
-rw-r--r--. 1 root named  487 Jul 19  2010 named.root.key
zone configuration directory
[root@localhost etc]# cd /var/named/
[root@localhost named]# pwd
/var/named
[root@localhost named]# ls -al
total 28
drwxr-x---.  8 root  named 4096 Feb 11 11:02 .
drwxr-xr-x. 24 root  root  4096 Feb 11 09:50 ..
drwxr-x---.  7 root  named   56 Dec 12 19:53 chroot
drwxr-x---.  7 root  named   56 Dec 12 19:53 chroot_sdb
drwxrwx---.  2 named named 4096 Feb  9 11:41 data
drwxrwx---.  2 named named   30 Feb 11 12:14 dynamic
-rw-r-----.  1 root  named 2076 Jan 28  2013 named.ca
-rw-r-----.  1 root  named  152 Dec 15  2009 named.empty
-rw-r-----.  1 root  named  152 Jun 21  2007 named.localhost
-rw-r-----.  1 root  named  168 Dec 15  2009 named.loopback
drwxr-xr-x.  2 root  root    29 Feb 11 12:27 pri
drwxrwx---.  2 named named    6 Dec 12 19:53 slaves

example>
/etc/named.conf configuration
options {
listen-on port 53 { 127.0.0.1; };
listen-on port 53 { 172.16.11.200; };
......
allow-query     { any; };
......
zone "open-ims.test" IN {
type master;
file "pri/open-ims.dnszone";
notify no;
};
-> if you want to remote access, You add the listen ip and port with local ip address
    e.g. listen-on port 53 { 172.16.11.200; };
-> allow anonymous ip address
    e.g. allow-query { any; };

zone configuration
mkdir /var/pri
touch /var/named/pri/open-ims.dnszone
chmod 644 /var/named/pri/open-ims.dnszone
/var/named/pri/open-ims.dnszone configuration
$ORIGIN open-ims.test.
$TTL 1W
@                       1D IN SOA       localhost. root.localhost. (
                                        2006101001      ; serial
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                        1D IN NS        ns
ns                      1D IN A         127.0.0.1

test                   1D IN A         127.0.0.1
_sip._udp.test         1D SRV 1 0 4060 test1
_sip._udp.test         1D SRV 2 0 4060 test2
test1 IN A 172.16.11.200
test2 IN A 172.16.11.201

open-ims.test.          1D IN A         127.0.0.1
open-ims.test.          1D IN NAPTR 10 50 "s" "SIP+D2U" "" _sip._udp
open-ims.test.          1D IN NAPTR 20 50 "s" "SIP+D2T" "" _sip._tcp

systemctl stop named
systemctl start named
systemctl status named    // named status check

SRV query result on AcmePacket SBC
AcmePacket# show dns cache-entry sip-access SRV:_sip._udp.test.open-ims.test
Query-->
Q:SRV _sip._udp.test.open-ims.test ttl=86257
Answers-->
         prio=1 wgt=0 test1.open-ims.test:4060/UDP
         prio=2 wgt=0 test2.open-ims.test:4060/UDP
-> network-interface->dns-ip-primary 172.16.11.200, dns-domain open-ims.test
-> session-agent->hostname test.open-ims.test, port 0

wireshark capture file: ECZ720_dns_srv.pcap

Reference site: http://jkt0620.blog.me/100209190599