Server & OS

하나의 서버에 2개이상의 도메인 설정하기

페이지 정보

본문

이전 강의에서는 하나의 서버에 하나의 도메인 서비스를 위한 설정을 알아보았습니다.
마찬가지로 하나의 서버에 둘 이상의 도메인 서비스를 위한 서버 설정을 할 수 있습니다.

기본 설정 파일인 /etc/named.conf 파일에 해당되는 도메인에 대한 Forward Zone 파일을 지정하고, 지정한 Forward Zone 파일을 /var/named에서 생성하시면 됩니다.

그럼, 자세한 설정내용을 살펴 보겠습니다.

아래는 hancom.com 도메인에 대한 /etc/named.conf 파일의 설정입니다.
새롭게 test.com 이라는 도메인을 신청하여 부여받았다고 생각하고 /etc/named.conf 에 설정을 추가합니다.
기본적인 설정파일에서 굵게 표시된 부분만, 신청한 도메인에 맞게 추가를 합니다.

[root@ns root]# cat /etc/named.conf
// generated by named-bootconf.pl

options {
directory "/var/named";
/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// query-source address * port 53;
};

//
// a caching only nameserver config
//
zone "." IN {
type hint;
file "named.ca";
};

zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};

zone "hancom.com" IN {
type master;
file "hancom.zone";
allow-update { none; };
};

zone "test.com" IN {
type master;
file "test.zone";
allow-update { none; };
};


zone "0.168.192.in-addr.arpa" IN {
type master;
file "hancom.rev";
allow-update { none; };
};
[root@ns root]#

추가한 test.com 도메인에 대한 Forward Zone 파일을 /var/named/test.zone 파일로 생성합니다.
이전에 만들어 놓은 hancom.com 의 Forward Zone 파일인 hancom.zone 파일을 복사하면 쉽게 할 수 있습니다.

[root@ns root]# cd /var/named
[root@ns named]# ls
localhost.zone named.ca named.local hancom.zone hancom.rev
[root@ns named]# cp hancom.zone test.zone

복사가 이루어 졌으면 test.zone 파일을 test.com 의 도메인에 맞게 이전 설정을 수정하시면 됩니다.

[root@ns named]# vi /var/named/test.zone
$TTL    86400
@ IN SOA ns.test.com. root.ns.test.com. (
2003022500 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS ns.test.com.
IN MX 10 mail.test.com.

ns IN A 192.168.0.2
test.com. IN A 192.168.0.2
mail IN A 192.168.0.2
www IN A 192.168.0.2
ftp IN A 192.168.0.2


변경이 완료 되었다면, 데몬을 재 실행합니다.

[root@ns root]# /etc/rc.d/init.d/named stop
named 를 정지함: [ 확인 ]
[root@ns root]# /etc/rc.d/init.d/named start
named (을)를 시작합니다: [ 확인 ]
[root@ns root]#



이제 모든 설정이 끝났습니다.
nslookup으로 제대로 설정이 이루어 졌는지 한 번 확인해 보겠습니다.

[root@ns root]# nslookup
Note: nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead. Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.
>
> test.com
Server: 192.168.0.2
Address: 192.168.0.2#53

Name: test.com
Address: 192.168.0.2
>


만일 다른 도메인이 또 있다면 이와 같은 방법으로 추가하시면 2개이상의 도메인 서비스를 쉽게 할 수 있습니다.

관련자료

등록된 댓글이 없습니다.
Today's proverb
사람들에게 말하는 것이 적으면 적을수록 기쁨은 더욱 많아진다.