BLOG main image
All (22)
Operating System (17)
Networking (1)
Security (2)
Photo (0)
ETC (2)
«   2008/11   »
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30            
63404 Visitors up to today!
Today 40 hit, Yesterday 47 hit
'BIND9'에 해당되는 글 1건
[ruo91, 2008/08/15 21:51, Operating System/Linux]

해당 홈페이지에 방문하기 위해서는 아이피 주소를 알고 있어야 하는데 사람이 숫자를 기억하기 보다는 www.naver.com 처럼 문자로 표현된 주소를 더 쉽게 기억할수 있기 때문에 이 네임서버(DNS)를 사용하는 것입니다.
DNS 서버란 쉽게 192.168.10.1 아이피 주소를 문자로 반환하여 사람이 기억하기 쉽게 문자로 변환 해주는 서비스 입니다.

그리고 네임서버들은 트리구조를 갖는 데이터베이스(whois database)입니다.

상하위 개념이 있고, 최상위에는 ROOT 네임서버가 존재합니다.

최상위에 있는 ROOT 네임서버는 13개가 있으며 각 독립된 기관에서 운영하고 있습니다.

이 트리 구조를 관리하는 기관이 있습니다. 네임서버를 사용하려면 해당 네임서버의 이름이 네임서버트리구조(디렉토리)를 관리하는 기관(internic)에 등록이 되어야 합니다.

아래 주소는 internic으로부터 공인받은 기관들 목록이고 우리나라 기관들도 있습니다.

http://www.internic.net/alpha.html

Linux로 BIND를 설치해서 네임서버를 설치할 경우 네임서버에는 반드시 네임서버의 이름이 있어야 하고 그 이름은 공인받은 기관에 등록이 되어 있어야 정상적인 동작을 할 수 있습니다.

이제부터 BIND9 버전으로 DNS 서버를 만들어봅시다. (Example Download)

환경 : Ubuntu

1. BIND9를 설치 하기 위해서 터미널이나 SSH에 apt-get install bind9 를 입력하여 설치를 합니다.

root@ruo91:~# apt-get install bind9
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  bind9-doc
The following NEW packages will be installed:
  bind9
0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
Need to get 255kB of archives.
After unpacking 799kB of additional disk space will be used.
Get:1
http://kr.archive.ubuntu.com gutsy-updates/main bind9 1:9.4.1-P1-3ubuntu1 [255kB]
Fetched 255kB in 1s (209kB/s)
Selecting previously deselected package bind9.
(Reading database ... 102198 files and directories currently installed.)
Unpacking bind9 (from .../bind9_1%3a9.4.1-P1-3ubuntu1_i386.deb) ...
Setting up bind9 (1:9.4.1-P1-3ubuntu1) ...
Adding group `bind' (GID 121) ...
Done.
Adding system user `bind' (UID 112) ...
Adding new user `bind' (UID 112) with group `bind' ...
Not creating home directory `/var/cache/bind'.
wrote key file "/etc/bind/rndc.key"
 * Starting domain name service... bind                                                                                   [ OK ]

 root@ruo91:~#

2. BIND9가 /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 "ns1.yongbok.com" IN {
        type master;
        file "/etc/bind/db-yongbok";
};

zone "yongbok.com" IN {
        type master;
        file "/etc/bind/db-yongbok";
};
zone "167.41.116.in-addr.arpa" {
        type master;
        file "/etc/bind/ip-yongbok";
};
zone "0.0.127.in-addr.arpa" {
        type master;
        file "/etc/bind/loopback-yongbok";
};
// 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";

3. db-yongbok 파일을 하나 만들어서 아래와 같이 입력합니다.
(file.yongbok.com 처럼 들어가도록 만들려면 아래 처럼 계속 추가해주시면 됩니다.)

;; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns1.yongbok.com. root.yongbok.com. (
                              2008051612         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      ns1.yongbok.com.

       A       116.41.167.x
www       A       116.41.167.x
file       A       116.41.167.x

4. ip-yongbok 파일 생성 후 아래와 같이 입력 해줍니다.

;; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns1.yongbok.com. root.yongbok.com. (
                             
2008051612         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      ns1.yongbok.com.
5       PTR       yongbok.com
5       PTR       www.yongbok.com
5       PTR       file.yongbok.com


5. loopback-yongbok 파일 생성 후 아래와 같이 입력 해줍니다. 

 ;; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns1.yongbok.com. root.yongbok.com. (
                             
2008051612         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      ns1.yongbok.com.
1       PTR     localhost.


6. BIND9 다시시작 /etc/init.d/bind9 restart

 root@ruo91:~#  /etc/init.d/bind9 restart
 * Stopping domain name service... bind                                                                                   [ OK ]
 * Starting domain name service... bind                                                                                   [ OK ]
 
root@ruo91:~#

6. nslookup 도메인명으로 DNS 서버 변경이 되었는지 확인 합니다.
(1분안에 도메인 캐쉬 업데이트 시간을 줄이고 싶다면 $TTL 값을 1M 으로 수정)

 root@ruo91:~# nslookup www.yongbok.com
 Server:         168.126.63.1
 Address:        168.126.63.1#53

 Non-authoritative answer:

 Name:  
www.yongbok.com
 Address: 116.41.167.x

크리에이티브 커먼즈 라이센스
Creative Commons License
2008/08/15 21:51 2008/08/15 21:51
*1