wilson's story

2차 도메인 생성하기 본문

Linux

2차 도메인 생성하기

wilson 2007. 11. 22. 15:27
반응형
mybestone.com이라는 도메인으로 서버가 한 대 운영중이다. linux.mybestone.com
이라는 서브도메인(2차도메인) 을 부여하여 이 서버가 독자적인 IP를 가지고 있고, 웹서버
및 메일서버도 독자적으로 운영하려고 한다. 또한 이 서버의 서브도메인(3차도메인)도
가능하게 세팅하려고 한다. 설정하도록 한다.


(조건)
1. mybestone.com (주 도메인)
   IP 주소         : 192.168.0.3
   zone 파일       : mybestone.zone
   Reverse zone파일: mybestone.rev
2. linux.mybestone.com (서브 도메인)
   IP 주소         : 192.168.0.4

(설정)
(1) 주 네임서버(ns.mybestone.com)의 설정
  1) /var/named 디렉토리에 존재하는 mybestone.zone파일의 설정 추가
    linux            IN      NS      ns.linux
    ns.linux         IN      A       192.168.0.4
      => 첫번째줄의 설정을 풀어쓰면 다음과 같다.
        linux.mybestone.com.         IN       NS      ns.linux.mybestone.com.
        즉 linux.mybestone.com이라는 도메인의 네임서버를 ns.linux.mybestone.com이라는 것으로
       정한다는 뜻이다.
        두번째줄의 설정을 풀어쓰면 다음과 같다.
        ns.linux.mybestone.com.      IN       A      192.168.0.4
       즉, ns.linux.mybestone.com의 IP주소는 192.168.0.4라는 뜻이 된다.
   (참고) 단순히 2차 도메인 사용만 지정하려면
         linux             IN      A      192.168.0.4
         라고 한줄만 지정해도 된다.
  2) /var/named 디렉토리에 존재하는 mybestone.rev파일의 설정 추가
    linux            IN      NS      ns.linux.mybestone.com.
    4                IN      NS      ns.linux.mybestone.com.
(2) 서브 네임서버(ns.linux.mybestone.com)의 설정
  1) /etc/named.conf파일의 설정
    zone "linux.mybestone.com" {        // 위임받은 2차도메인 설정
          type master;
          file "linux.mybestone.zone";
    };

    zone "linux.0.168.192.in-addr.arpa" { // 위임받은 2차도메인의 역존 설정법
            type master;
            file "linux.mybestone.rev";
     };
  2) linux.mybestone.zone파일의 설정
    @       IN      SOA     ns.linux.mybestone.com. root.linux.mybestone.com.  (
                                     2001071500 ; Serial
                                     28800      ; Refresh
                                     14400      ; Retry
                                     3600000    ; Expire
                                     86400 )    ; Minimum
               IN      NS      ns.linux.mybestone.com.
    linux.mybestone.com.           IN      A       192.168.0.4
                 IN      MX      10      linux.mybestone.com.
    www.linux.mybestone.com.       IN      A       192.168.0.4
   3) linux.mybestone.rev 파일의 설정
     @       IN      SOA     ns.linux.mybestone.com. root.linux.mybestone.com.  (
                                           2001020201 ; Serial
                                           28800      ; Refresh
                                           14400      ; Retry
                                           3600000    ; Expire
                                           86400 )    ; Minimum
                   IN      NS      ns.linux.mybestone.com.
     4             IN      PTR     ns.linux.mybestone.com.
(3) httpd.conf파일에 설정한다.
   <VirtualHost 192.168.0.4>
       ServerAdmin root@linux.mybestone.com
       ServerName linux.mybesone.com.com
       DocumentRoot /usr/local/apache/html
       ErrorLog logs/linux.mybestone.com-error_log
       CustomLog logs/linux.mybestone.com-access_log common
   </VirtualHost>
반응형