-
본문으로 바로가기

도메인이 하나 있다면, 도메인 벤더와 관계없지 직접 서브 도메인을 관리하고 싶어질 수 있습니다.

이런 경우 우분투에서는 bind9 라는 네임서버를 설치하여 도메인을 관리할 수 있습니다.


우분투, DNS서버(bind9) 네임서버 설치하기

 

1. 기본 조건
2. bind9 설치 외
3. named.conf.local 수정
4. zone 파일 수정
5. 역방향 설정
6. bind9 서비스 재시작

 


◆ 도움이 되는 사이트

https://blog.lael.be/post/6308

버그 상태도 확인할 수 있는 방법이 적혀 있음

- 2018.11.08 

 

https://pringles.tistory.com/10

두번째 도메인 이상의 네임서버 지정하는 부분에 대한 설명을 포함하여,

설명이 아주 정확하고 자세하게 적혀 있음

- 2019.01.28

 

 

1. 기본 조건

1?5.1?1.1?7.79 아이피에 도메인 2개 ( kagok.co.kr gagok.kr ) 를 세팅하는 경우이다.

 

2. bind9 설치 외

$ sudo apt-get install bind9 '설치

$ cat /etc/hosts                  '확인

$ sudo nano /etc/bind/named.conf.options

 

options {
        directory "/var/cache/bind";

        // If there is a firewall between you and nameservers you want
        // to talk to, you may need to fix the firewall to allow multiple
        // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

        // If your ISP provided one or more IP addresses for stable
        // nameservers, you probably want to use them as forwarders.
        // Uncomment the following block, and insert the addresses replacing
        // the all-0's placeholder.

        // forwarders {
        //      0.0.0.0;
        // };

forwarders {
                168.126.63.1;
                168.126.63.2;
                8.8.8.8;
}

 

3. named.conf.local 수정

$sudo nano /etc/bind/named.conf.local

//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

zone "kagok.co.kr" IN {
        type master;
        file "/etc/bind/zones/kagok.co.kr.db";
};

zone "gagok.kr" IN {
        type master;
        file "/etc/bind/zones/gagok.kr.db";
};

zone "1?7.1?1.1?5.in-addr.arpa" {
        type master;
        file "/etc/bind/zones/rev.1?7.1?1.1?5.in-addr.arpa";
};

 

4. zone 파일 수정

$sudo mkdir /etc/bind/zones

$cd /etc/bind/zones

$sudo cp ../db.local kagok.co.kr.db

$sudo cp ../db.local gagok.kr.db

$sudo cp ../db.local rev.1?1.1?1.1?5.in-addr.arpa

 

$sudo nano kagok.co.kr.db

 

;
; BIND data file for local loopback interface
;

$ORIGIN .
$TTL 604800
kagok.co.kr. IN SOA ns.kagok.co.kr. master.kagok.co.kr. (
 10 ; Serial
 604800 ; Refresh
 86400 ; Retry
 2419200 ; Expire
 604800 ) ; Negative Cache TTL
;
kagok.co.kr. IN NS ns.kagok.co.kr.
kagok.co.kr. IN A 1?5.1?1.1?7.79

$ORIGIN kagok.co.kr.

localhost IN A 127.0.0.1

mail IN A 1?5.1?1.1?7.79
ns IN A 1?5.1?1.1?7.79
www IN A 1?5.1?1.1?7.79
mz IN A 1?5.1?1.1?7.79
a IN A 1?5.1?1.1?7.79
z IN A 1?5.1?1.1?7.79
zz IN A 1?5.1?1.1?7.79
zzz IN A 1?5.1?1.1?7.79

 

$sudo nano gagok.kr.db

;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA gagok.kr. root.gagok.kr. (
      2 ; Serial
604800 ; Refresh
  86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS gagok.kr.
@ IN A 1?5.1?1.1?7.79
@ IN AAAA ::1
IN A 1?5.1?1.1?7.79
g IN A 1?5.1?1.1?7.79
www IN A 1?5.1?1.1?7.79

 

5. 역방향 설정

$sudo nano rev.1?1.1?1.1?5.in-addr.arpa

;
; BIND reverse data file for broadcast zone
;
$TTL 604800
@ IN SOA ns.kagok.co.kr. master.kagok.co.kr. (
 14 ; Serial
 604800 ; Refresh
 86400 ; Retry
 2419200 ; Expire
 604800 ) ; Negative Cache TTL
;
@ IN NS ns.kagok.co.kr.
79 IN PTR www.kagok.co.kr.
79 IN PTR mz.kagok.co.kr.
79 IN PTR a.kagok.co.kr.
79 IN PTR mail.kagok.co.kr.
79 IN PTR z.kagok.co.kr.
79 IN PTR zz.kagok.co.kr.
79 IN PTR zzz.kagok.co.kr.
79 IN PTR gagok.kr.
79 IN PTR www.gagok.kr.
79 IN PTR g.gagok.kr.

6. bind9 서비스 재시작

$sudo service bind9 restart

 

 

참고 사이트:

 http://html5around.com/wordpress/tutorials/ubuntu-bind9-local-dns-setup/

 http://zzaps.tistory.com/243?category=582309

 http://zzaps.tistory.com/244?category=582309



 


이상입니다.

퍼가기 하실때는 출처 꼭 같이 남겨주시면 감사하겠습니다.


출처: 코키티비, http://cocatv.tistory.com/131

반응형