somoly.tistory.com

DNS 서비스를 위한 수동 설치를 해 보겠습니다.

1. 우선은 DNS 서비스를 위해 bind9 를 설치해야 합니다.

windpyj@ubuntu:~$ sudo apt-get install bind9


2. 설치가 끝나면 자동으로 DNS 데몬이 실행이 됩니다.
DNS 설정 파일들은 /etc/bind 디렉토리에 저장이 됩니다. 주요 설정 파일은 /etc/bind/named.conf 입니다.
우선 기본으로 생성된 named.conf 파일을 보겠습니다.
// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local
include "/etc/bind/named.conf.options";
// prime the server with knowledge of the root servers
zone "." {
        type hint;
        file "/etc/bind/db.root";
};
// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912
zone "localhost" {
        type master;
        file "/etc/bind/db.local";
};
zone "127.in-addr.arpa" {
        type master;
        file "/etc/bind/db.127";
};
zone "0.in-addr.arpa" {
        type master;
        file "/etc/bind/db.0";
};
zone "255.in-addr.arpa" {
        type master;
        file "/etc/bind/db.255";
};
// zone "com" { type delegation-only; };
// zone "net" { type delegation-only; };
// From the release notes:
//  Because many of our users are uncomfortable receiving undelegated answers
//  from root or top level domains, other than a few for whom that behaviour
//  has been trusted and expected for quite some length of time, we have now
//  introduced the "root-delegations-only" feature which applies delegation-only
//  logic to all top level domains, and to the root domain.  An exception list
//  should be specified, including "MUSEUM" and "DE", and any other top level
//  domains from whom undelegated responses are expected and trusted.
// root-delegation-only exclude { "DE"; "MUSEUM"; };
include "/etc/bind/named.conf.local";

(보조설명)
include 줄은 DNS 선택 사항을 가지는 파일 이름을 지정 합니다. 그 선택 사항 파일 내의 directory 줄은 파일을 어디서 볼 수 있는지 DNS에 알려 줍니다. BIND의 모든 파일은 이 디렉토리를 상대 경로로 사용 합니다.

/etc/bind/db.root 파일은 세상의 루트 네임 서버들을 기술 합니다. 그 서버들은 시간이 지남에 따라 변경되고 반드시 지금이나 나중에 관리유지 되어야 합니다.

zone
영역은 마스터 서버를 지정하고, 언급된 파일 태그로 파일에 저장 됩니다. 모든 zone 파일은 세 가지 자원 자료(RRs): SOA RR, NS RR과 PTR RR을 포함 합니다. SOA는 Start of Authority의 축약어 입니다. "@" 는 발생점을 의미하는 특별한 이름 표기 입니다. NS는 네임 서버 자원 자료 입니다. PTR은 도메인 네임 포인터 입니다.

3. 실제 DNS 구축 응용 실습
1차 DNS를 구성하였고
도메인은 servermaster.pe.kr
ip는 10.10.10.1
웹서버는 10.10.10.5
라고 가정하였습니다.

/etc/bind/named.conf 파일
// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local
include "/etc/bind/named.conf.options";
// prime the server with knowledge of the root servers
zone "." {
        type hint;
        file "/etc/bind/db.root";
};
// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912
zone "servermaster.pe.kr" {
        type master;
        file "/etc/bind/db-servermaster";
};
zone "1.10.10.in-addr.arpa" {
        type master;
        file "/etc/bind/ip-servermaster";
};
zone "0.0.127.in-addr.arpa" {
        type master;
        file "/etc/bind/loopback-servermaster";
};
// zone "com" { type delegation-only; };
// zone "net" { type delegation-only; };
// From the release notes:
//  Because many of our users are uncomfortable receiving undelegated answers
//  from root or top level domains, other than a few for whom that behaviour
//  has been trusted and expected for quite some length of time, we have now
//  introduced the "root-delegations-only" feature which applies delegation-only
//  logic to all top level domains, and to the root domain.  An exception list
//  should be specified, including "MUSEUM" and "DE", and any other top level
//  domains from whom undelegated responses are expected and trusted.
// root-delegation-only exclude { "DE"; "MUSEUM"; };
include "/etc/bind/named.conf.local";


/etc/bind/db-servermaster
;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     servermaster.pe.kr. root.servermaster.pe.kr. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      servermaster.pe.kr.
www       A       10.10.10.5


/etc/bind/ip-servermaster
;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     servermaster.pe.kr. root.servermaster.pe.kr. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      servermaster.pe.kr.
5       PTR       www.servermaster.pe.kr


/etc/bind/loopback-servermaster
;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     servermaster.pe.kr. root.servermaster.pe.kr. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      servermaster.pe.kr.
1       PTR     localhost.


4. 세팅을 변경하고 난 후에 데몬을 재시작을 해 주어야 합니다.
windpyj@ubuntu:~$ sudo /etc/init.d/bind9 restart
profile

somoly.tistory.com

@RxCats

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!