본문 바로가기
넷칼리지

Linux master DNS slave DNS

by 북한산산적 2009. 5. 25.
실습 과제 
Linux Bind DNS 서버를 이용하여.. server A 와 server B 로 
master DNS 와 slave DNS 를 구성하여라.
server A에 3개의 도메인 test.com test1.com test2.com
server B에 3개의 도메인 xxx.com xxx1.com xxx2.com

Server A(master DNS) 설정
#vi /etc/named.conf


zone "1.168.192.in-addr.arpa" IN {
        type master;
        file "zonefile/192.168.1.zone";
        allow-update { 192.168.1.25; };
};


맨아래 
include "/etc/rndc.key"; 밑에 

include "conf/web1.conf";
include "conf/web2.conf";
추가해 준다

추가
#vi test.com.zone

www             IN A            192.168.1.35

추가 
#vi test1.com.zone 

www             IN A            192.168.1.35

추가

#vi test2.com.zone

www             IN A            192.168.1.35

추가해준다..

 /var/named/chroot/var/named에 
#mkdir conf
#mkdir zonefile 

conf 디렉토리에
web1.conf
web2.conf
를 만든다

Slave server 설정

------------------web1.conf-------------------
zone "test.com" IN {
        type slave;
        file "zonefile/web1.zone";
#       allow-update { 192.168.1.35; };
        masters { 192.168.1.25; };
};

zone "test1.com" IN {
        type slave;
        file "zonefile/web1.zone";
#       allow-update { 192.168.1.35; };
        masters { 192.168.1.25; };
};


zone "test2.com" IN {
        type slave;
        file "zonefile/web1.zone";
#       allow-update { 192.168.1.35; };
        masters { 192.168.1.25; };
};

------------------------------------------------

-----------------web2.conf---------------------

zone "taengu.co.kr" IN {
        type master;
        file "zonefile/web2.zone";
        allow-update { 192.168.1.25; };
};

zone "taeyeon.co.kr" IN {
        type master;
        file "zonefile/web2.zone";
        allow-update { 192.168.1.25; };
};

zone "sosi.co.kr" IN {
        type master;
        file "zonefile/web2.zone";
        allow-update { 192.168.1.25; };
};

--------------------------------------------------
/var/named/chroot/var/named/zonefile
#vi web1.zone
www             IN A            192.168.1.35
를 추가 하여 zone파일 작성

#vi web2.zone

www             IN A            192.168.1.25
를 추가하여 zone 파일 작성 

[root@ocb03 /var/named/chroot/var/named]# chown named.named zonefile/ -R
[root@ocb03 /var/named/chroot/var/named]# chown named.named conf/ -R

디렉토리 권한 변경 

#service named start|restart|stop


master Server 설정

-

------------------------------named.conf-------------------

zone "1.168.192.in-addr.arpa"   IN {
        type master;
#       슬레이브시 type slave;
        file "zonefile/192.168.1.35";
        allow-update { 192.168.1.35; };
#       masters { 192.168.1.25 };슬레이브서버
};

------------------------------------------------------------
 /var/named/chroot/var/named에 
#mkdir conf
#mkdir zonefile 

--------------------------web1.conf---------------------
zone "taengu.co.kr" IN {
        type master;
        file "zonfile/web1.zone";
        allow-update { 192.168.1.35; };
};

zone "taeyeon.co.kr" IN {
        type master;
        file "zonefile/web1.zone";
        allow-update { 192.168.1.35; };
};

zone "sosi.co.kr" IN {
        type master;
        file "zonefile/web1.zone";
        allow-update { 192.168.1.35; };
};

------------------------------------------------------------

---------------------------web2.conf-----------------------
zone "test.com" IN {
        type master;
        file "zonfile/web2.zone";
        allow-update { 192.168.1.35; };
};

zone "test1.com" IN {
        type master;
        file "zonefile/web2.zone";
        allow-update { 192.168.1.35; };
};

zone "test2.com" IN {
        type master;
        file "zonefile/web2.zone";
        allow-update { 192.168.1.35; };
};
------------------------------------------------------------

#mkdir zonefile 
web1.zone
www                IN A            192.168.1.25
web2.zone
www               IN A            192.168.1.25

추가해 준다

[root@ocb03 /var/named/chroot/var/named]# chown named.named zonefile/ -R
[root@ocb03 /var/named/chroot/var/named]# chown named.named conf/ -R

디렉토리 권한 변경 

#service named start|restart|stop

[/var/named/chroot/var/named/zonefile]# vi 192.168.1.zone

추가

35              IN PTR          www.test.com
35              IN PTR          www.test1.com
35              IN PTR          www.test2.com
25              IN PTR          www.sosi.co.kr
25              IN PTR          www.taengu.co.kr
25              IN PTR          www.taeyeon.co.kr

[root@ocb03 /var/named/chroot/var/named/zonefile]# nslookup
> 192.168.1.35
Server:         192.168.1.35
Address:        192.168.1.35#53

35.1.168.192.in-addr.arpa       name = www.test1.com.1.168.192.in-addr.arpa.
35.1.168.192.in-addr.arpa       name = www.test2.com.1.168.192.in-addr.arpa.
35.1.168.192.in-addr.arpa       name = www.test.com.1.168.192.in-addr.arpa.
> 192.168.1.25
Server:         192.168.1.35
Address:        192.168.1.35#53

25.1.168.192.in-addr.arpa       name = www.taengu.co.kr.1.168.192.in-addr.arpa.
25.1.168.192.in-addr.arpa       name = www.taeyeon.co.kr.1.168.192.in-addr.arpa.
25.1.168.192.in-addr.arpa       name = www.sosi.co.kr.1.168.192.in-addr.arpa.
> exit