Linux/CentOS7

To install BIND on CentOS 7

장성한군사 2017. 9. 18. 17:26

 CentOS 7 Version

 Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

 

 Network Interface Card

 [root@localhost ~]# ip addr show ens33
2: eno33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:a3:28:3a brd ff:ff:ff:ff:ff:ff
    inet 192.168.8.136/24 brd 192.168.8.255 scope global dynamic eno16777736
       valid_lft 1431sec preferred_lft 1431sec
    inet6 fe80::20c:29ff:fea3:283a/64 scope link
       valid_lft forever preferred_lft forever

 

 To install packages for BIND

 [root@localhost ~]# yum -y install bind bind-libs bind-utils

 

[root@localhost ~]# vi /etc/named.conf 

 options {
        listen-on port 53 { 192.168.8.136; };
//      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";
        allow-query     { any; };

        recursion yes;

 

 [root@localhost ~]# vi /etc/named.rfc1912.zones

 zone "infosec.local" IN {
        type master;
        file "infosec.local.db";
     };

 

zone "8.168.192.in-addr.arpa" IN {
        type master;
        file "infosec.local.rdb";
  };

 

 [root@localhost ~]# cd /var/named

[root@localhost named]#cp -pv named.empty infosec.local.db

[root@localhost named]#cp -pv named.loopback infosec.local.rdb

 

 [root@localhost named]# vi /var/named/infosec.local.db

 $TTL 3H
@       IN SOA  @ infosec.local. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
           NS      lux01.
lux01    A       192.168.8.136
www    CNAME   lux01.
infosec.local.

 

 [root@localhost named]# vi /var/named/infosec.local.rdb

 $TTL 1D
@       IN SOA  @ infosec.local. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
          NS      lux01.
lux01   A       192.168.8.136
136     PTR     lux01.
infosec.local.

 

 Start bind daemon

 [root@localhost named]# systemctl start named.service

 

 Auto remount

 [root@localhost named]# systemctl enable named.service
Created symlink from /etc/systemd/system/multi-user.target.wants/named.service to /usr/lib/systemd/system/named.service.

[root@localhost ~]# systemctl list-unit-files

 

 [root@localhost ~]# ps -ef | grep named
named      2958      1  0 14:08 ?        00:00:00 /usr/sbin/named -u named -c /etc/named.conf
root       3460   2431  0 14:23 pts/0    00:00:00 grep --color=auto named

 [root@localhost named]# systemctl | grep named
  named.service                                                                       loaded active running   Berkeley Internet Name Domain (DNS)

 

 

 [root@localhost named]# named-checkzone infosec.local /var/named/infosec.local.db