2009. 8. 11. 10:24

해당 홈페이지에 방문하기 위해서는 아이피 주소를 알고 있어야 하는데 사람이 숫자를 기억하기 보다는 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 서버를 만들어봅시다.

환경 : Ubuntu

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

# apt-get install bind9

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 "ns.2dic.com" IN {
        type master;
        file "/etc/bind/db-2dic";
};
zone "2dic.com" IN {
        type master;
        file "/etc/bind/db-2dic";
};
zone "167.41.116.in-addr.arpa" {
        type master;
        file "/etc/bind/ip-2dic";
};
zone "0.0.127.in-addr.arpa" {
        type master;
        file "/etc/bind/loopback-2dic";
};
// 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-2dic 파일을 하나 만들어서 아래와 같이 입력합니다.
(www.2dic.com 처럼 들어가도록 2차 도메인을 만들려면 아래 처럼 계속 추가해주시면 됩니다.)

; Zone file
$TTL          604800
@       IN      SOA     ns.2dic.com root.2dic.com (
                              2009052723  ; Serial
                              604800         ; Refresh
                              86400           ; Retry
                              2419200       ; Expire
                              604800 )       ; Negative Cache TTL
;
@       IN       NS       ns.2dic.com
          A                   116.41.167.x
www   A                   116.41.167.x

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

; Revers zone file
$TTL          604800
@       IN      SOA     ns.2dic.com root.2dic.com (
                              2009052723  ; Serial
                              604800         ; Refresh
                              86400           ; Retry
                              2419200       ; Expire
                              604800 )       ; Negative Cache TTL
;
@       IN       NS       ns.2dic.com
5       PTR                 2dic.com
5       PTR                 www.2dic.com


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

; Loopback zone file
$TTL          604800
@       IN      SOA     ns.2dic.com root.2dic.com (
                              2009052723  ; Serial
                              604800         ; Refresh
                              86400           ; Retry
                              2419200       ; Expire
                              604800 )       ; Negative Cache TTL
;
@       IN       NS       ns.2dic.com
1       PTR                 localhost.

6. BIND9 다시시작

 #  /etc/init.d/bind9 restart
 * Stopping domain name service... bind              [ OK ]
 * Starting domain name service... bind                [ OK ]

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

 # nslookup www.2dic.com
 Server:         168.126.63.1
 Address:       168.126.63.1#53

 Non-authoritative answer:
 Name:   www.2dic.com
 Address: 116.41.167.x

출처 : 영북 블로그 yongbok.com

'IT/보안 관련 정보 > 우분투 서버' 카테고리의 다른 글

zebra 사용법  (0) 2009.08.19
리눅스 명령어  (0) 2009.08.13
리눅스 기본명령어  (0) 2009.08.10
samba 설정 예제 파일  (0) 2009.08.10
우분투 ftp서버, SSH서버, SAMBA서버 설치  (0) 2009.08.07
Posted by 알 수 없는 사용자