[카테고리:] bind

  • bind-9.3.6 설치와 설정하기 named 구축

    bind-9.3.6-4.P1.el5_4.2 설치

    yum -y install bind\* 하시면 bind에 대한건 다 설치합니다.

      또는

    # yum -y install bind bind-libs ypbind yp-tools bind-utils bind-chroot bind-devel

    하세요.

    yum -y install caching-nameserver 설치하면 설정 파일이 생성됩니다.

    2개 명령으로 설치 완료 입니다^^

    외부 포트허용

    # iptables -A INPUT -p tcp -m tcp –sport 53 -j ACCEPT

    # iptables -A INPUT -p tcp -m udp –sport 53 -j ACCEPT

    vi /etc/named.caching-nameserver.conf 화일을 열어서 몇가지 수정해주면 됩니다.

    options {
            listen-on port 53 { 127.0.0.1; };  >> listen-on port 53 { any; };
            listen-on-v6 port 53 { ::1; };
            directory       “/var/named”;
            dump-file       “/var/named/data/cache_dump.db”;
            statistics-file “/var/named/data/named_stats.txt”;
            memstatistics-file “/var/named/data/named_mem_stats.txt”;

            // Those options should be used carefully because they disable port
            // randomization
            // query-source    port 53; << 주석 없애기 query-source    port 53;
            // query-source-v6 port 53; << 주석 없애기 query-source-v6 port 53;
            allow-query     { localhost; }; >> allow-query     { any; };
            allow-query-cache { localhost; };
    };

    // 로그파일 쌓이는것이 필요없으신분은 logging 부분 전부를 주석처리하면됩니다.
    logging {  
            channel default_debug {
                    file “data/named.run”;
                    severity dynamic;
            };
    };
    view localhost_resolver {
            match-clients      { localhost; }; >> match-clients      { any; };
            match-destinations { localhost; }; >> match-destinations { any; };
            recursion yes; >> recursion no;
            include “/etc/named.rfc1912.zones”;
    };

    저장하고 vi /etc/named.rfc1912.zones 열어서 설정합니다.

    설정되어 있는 값들은 건들지 마시고 맨 아래줄에 추가합니다.

    여기서 자신의 IP를 반대로 적으면됩니다.

    112.175.232.xxx 였다면 아래와 같이 적으면됩니다. file명을 알아서.rev로 만드세요.

    zone “232.175.112.in-addr.arpa” IN { type master; file “xxkr.com.rev”; allow-update { none; }; };

    호스트네임으로 사용하는 도메인을 잴 먼저 적습니다.

    in이 들어가 있는것이 다름니다.

    zone “xxkr.com” IN { type master; file “196.zone”; allow-update { none; }; };

    다음줄부터는 사용할 도메인을 쭉~ 적어 넣으면됩니다.

    ah.to도메인을 설정할때 아래와 같이 합니다.

    zone “ah.to”{ type master; file “xx2.zone”; allow-update { none; }; };

    이제 cd /var/named/chroot/var/named 로 이동해서 위에적었던 파일을 생성해 주면 끝나요.

    vi xxkr.com.rev 안에 내용에 아래와 같이 적으면됩니다.

    앞에 숫자는 위에서 IP 꺼꾸로 적고 맨마지막건 안적었는데 여기에 넣으면됩니다.

    165             IN      PTR     xx.xxkr.com. 이렇게요.

    == 카피할 부분 ==

    $TTL    86400
    @               IN      SOA     xx2.xxkr.com.       root.xxkr.com. (
                            31 ; serial
                            3H     ; refresh
                            15M       ; retry
                            1W    ; expire
                            1D      ; Minimun
                            )
                    IN      NS      xx.xxkr.com
                    IN      NS      xx2.xxkr.com.
                    IN      NS      ns.ssanhost.com.
                    IN      NS      ns1.ssanhost.com.

    localhost       IN      A       127.0.0.1
    165             IN      PTR     xx.xxkr.com.
    167             IN      PTR     xx2.xxkr.com.
    165             IN      PTR     ns.ssanhost.com.
    167             IN      PTR     ns1.ssanhost.com.

    저장하고 나와서 위에 file 에 적인 vi xx2.zone 해서 아래와 같이 만듭니다.

    $TTL    14400
    @               IN      SOA     xx2.xxkr.com.        root.xxkr.com. (
                            23 ; serial
                            3H     ; refresh
                            15M       ; retry
                            1W    ; expire
                            1D      ; Minimun
                            )
                    IN      NS      xx.xxkr.com.
                    IN      NS      xx2.xxkr.com.
                    IN      MX  10  mail
    ;
    @               IN      A       114.108.132.211
    xx              IN      A       112.175.232.165
    xx2             IN      A       114.108.132.211
    www             IN      A       114.108.132.211
    *               IN      A       114.108.132.211

    저장하고

    chown root:named *  꼭해주세요.

    /etc/init.d/named restart 엔터하면 설치가 끝났습니다.

    dig 로 작동여부 확인

    # dig 도메인

    버전확인

    # dig @ns.rain.iss txt version.bind

  • 2차네임서버 구축실무

    1. /etc/named.conf

    options {
            directory “/var/named”;
    };


    controls {
             inet 127.0.0.1 port 953  allow { localhost; } keys { rndckey; };
    };

    zone “.” {
            type hint;
            file “named.ca”;
    };

    zone “0.0.127.in-addr-arpa” {
            type master;
            file “named.local”;
    };
    zone “webhost.co.kr” {
            type slave;
            file “webhost.zone”;
            masters {
                    110.45.100.2; //마스터 ip address
            };
    };

    include “/etc/rndc.key”;


    2. named.local 과 named.ca 준비

    /var/named
    named.local
    named.ca


    3. 1차네임서버에서 2차서버 ip 허용

    vi named.conf

    controls {
             inet 127.0.0.1 port 953  allow { localhost; 110.45.100.3; } keys { rndckey; };
            };

    110.45.100.3 은 2차네임서버이다.



    4. 2차네임서버 구동후 존파일생성 확인

  • bind9 네임서버 소스로 설치하기

    bind 소스받기


    https://www.isc.org/

    상단첫번째 DOWNLOADS > BIND 에서 최신버전 tar.gz 다운로드



    1. 파일 다운로드 받고 컴파일 하기  

    # gzip  -dc   bind-9.3.0.tar.gz  |  tar  xvf   –
    # cd  bind-9.3.0
    # ./configure  
    # make
    # make install



    2. /etc/rndc.key 생성하기

    solaris10[/bind/bin/rndc] # ./rndc-confgen -a -k rndckey
    solaris10[/bind/bin/rndc] #  cat /etc/rndc.key
    # Start of rndc.conf
    key “rndckey” {
             algorithm hmac-md5;
             secret “Y9iC3cahZ7I3+3NrtlG6nQ==”;
    };
    생성 끝.



    3. /etc/named.conf 구성하기
    ======================================================


    vi /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;
    };


            controls {
             inet 127.0.0.1 port 953  allow { localhost; } keys { rndckey; };
            };

           
    zone “.” {
            type hint;
            file “named.ca”;
    };


    zone “domain.co.kr” {
            type master;
            file “primary/domain.zone”;
            allow-update { none; };
    };

    (중략) 같은 도메인들 리스트추가


    include “/etc/rndc.key”;






    4. bind 구동
    /usr/local/sbin/named

    에러가날경우

    cd /usr/local/sbin
    ./named-checkconf 로 확인할것






    5.rndc 구동하기

    /bind/bin/rndc/#rndc reload  

    를 수행하여 rndc를 구동할 수 있다. 이 때 named는 반드시 구동되어 있어야 한다.




    6. 장애 처리 하기

    #tail -f /var/adm/messages



    이상 소스로 bind설치끝