본문 바로가기
카테고리 없음

DNS (Bind) 서버 설치

by linix 2010. 2. 27.

리눅스 기계에 DNS 설치하는 법
cent os 5.4 버젼에서는 yum 설치로 하는 것이 제일로 편하다.


# yum -y install bind*
# yum -y install caching-name*

→ 네임서버 데몬과 예제 설정들 화일을 설치 한다. 아래 chaching-name을 설치하면 훨씬 편한 설정을 할수 있다.

# vi /var/named/chroot/etc/named.conf

→ 위 화일을 편집하면 되는데, 붉은색 부분은 나중에 다시 설명 할 것이다. 모르면 지워도 된다.

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

# Use with the following in named.conf, adjusting the allow list as needed:
 key "sooki-key" {
  algorithm hmac-md5;
  secret "qmUStKPk0fBsg6RiwAsbqQ==";
 };
 
 controls {
  inet 127.0.0.1 port 953
   allow { 127.0.0.1; } keys { "sooki-key"; };
 };
# End of named.conf

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view localhost_resolver {
 match-clients     { any; };
 match-destinations { any; };
 recursion yes;
 include "/etc/named.rfc1912.zones";   // 이파일에서 추가 할 것이다.
};


→ 다음은 named.rfc1912.zones 화일을 편집 해야 한다.

# vi /var/named/chroot/etc/named.rfc1912.zones

→ 다음은 sooki.kr을 예로 든 것이다. 맨 아래 색칠 부분만 추가해 주면 된다.

// 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 {
 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 "sooki.kr" IN {
        type master;
        file "sooki.zone";
        allow-update { none; };
};

zone "20.217.112.in-addr.arpa" IN {
        type master;
        file "sooki.rev";
        allow-update { none; };
};




# vi /var/named/chroot/var/named/sooki.zone


$TTL 86400
@  IN SOA sooki.kr. root (
     42  ; serial (d. adams)
     3H  ; refresh
     15M  ; retry
     1W  ; expiry
     1D )  ; minimum
                IN NS         sooki.kr.
                IN  MX 10 sooki.kr.
      IN  A               112.217.20.164
www         IN  A               112.217.20.164
ftp             IN  A               112.217.20.164
blog            IN  A               112.217.20.164
webmail         IN      A               112.217.20.164
cacti  IN A  112.217.20.164
mysql  IN A  112.217.20.164
mail  IN A  112.217.20.164

# vi /var/named/chroot/var/named/sooki.rev

$TTL 86400
@  IN SOA sooki.kr. root (
     42  ; serial (d. adams)
     3H  ; refresh
     15M  ; retry
     1W  ; expiry
     1D )  ; minimum
                IN  NS  sooki.kr.
164             IN  PTR  www.sooki.kr.
164  IN PTR  sooki.kr.
164  IN PTR  ftp.sooki.kr.
164  IN PTR  blog.sooki.kr.
164  IN      PTR             webmail.sooki.kr.
164  IN PTR  mysql.sooki.kr.
164  IN PTR  cacti.sooki.kr.
164  IN PTR  mail.sooki.kr.



# chkconfig --add named


# vi /var/named/chroot/var/named/sooki.rev