IA/System Admin

Minimal DNS Server 구현

kiostory 2011. 2. 27. 10:53

현재의 resolv 상태를 보기 위해 아래 명령어 수행

#dig leanonme.pe.kr

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_5.3 <<>> leanonme.pe.kr
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33819
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0

;; QUESTION SECTION:
;leanonme.pe.kr.                        IN      A

;; ANSWER SECTION:
leanonme.pe.kr.         3183    IN      A       211.189.69.98

;; AUTHORITY SECTION:
leanonme.pe.kr.         3183    IN      NS      ns1.mireene.com.
leanonme.pe.kr.         3183    IN      NS      ns2.mireene.com.

;; Query time: 37 msec
;; SERVER: 168.126.63.1#53(168.126.63.1)
;; WHEN: Sun Feb 27 10:27:35 2011
;; MSG SIZE  rcvd: 95

 

 

1. caching-nameserver와 bind-chroot를 설치

  # yum -y isntall bind-chroot caching-nameserver

 

2. cp -p /etc/named.caching-nameserver.conf /etc/named.conf

 

3. named.conf의 options 라인 하단에 아래라인 추가

  forwarders { 168.126.63.1; };

  forward only;

 

4. named.conf 구문 오류여부 확인

  #named-checkconf /etc/named.conf

 

5. BIND를 위한 chroot 환경을 enable시킴

   #bind-chroot-admin -e

 

6. named를 재시작하고, 부팅시에도 on되도록 설정

  #service named restart; chkconfig named on

 

7. /etc/resolv.conf의 nameserver를 127.0.0.1로 변경

 

8. 완료되었으므로 확인

[root@localhost etc]# dig leanonme.pe.kr

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_5.3 <<>> leanonme.pe.kr
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 30385
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0

;; QUESTION SECTION:
;leanonme.pe.kr.                        IN      A

;; ANSWER SECTION:
leanonme.pe.kr.         1666    IN      A       211.189.69.98

;; AUTHORITY SECTION:
leanonme.pe.kr.         1666    IN      NS      ns2.mireene.com.
leanonme.pe.kr.         1666    IN      NS      ns1.mireene.com.

;; Query time: 26 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Feb 27 10:52:52 2011
;; MSG SIZE  rcvd: 95