Misc/内部用DNSサーバー構築 vm-sigel のバックアップソース(No.1)

#contents

初期設定はUbuntuサーバーインストール時にある程度設定済み

*設定ファイルの作成 [#s8c00929]

**/etc/bind/db.root [#i523696c]

デフォルトのものを利用

**/etc/bind/named.conf [#y83cc5ab]

 // This is the primary configuration file for the BIND DNS server named.
 //
 // Please read /usr/share/doc/bind9/README.Debian.gz for information on the
 // structure of BIND configuration files in Debian, *BEFORE* you customize
 // this configuration file.
 //
 // If you are just adding zones, please do that in /etc/bind/named.conf.local
 
 include "/etc/bind/named.conf.options";
 
 // prime the server with knowledge of the root servers
 zone "." {
         // ルート DNS の情報
         type hint;
         // ファイル名
         file "/etc/bind/db.root";
 };
 
 // be authoritative for the localhost forward and reverse zones, and for
 // broadcast zones as per RFC 1912
 
 // localhost の正引きの設定
 zone "localhost" {
         // Master DNS Serverであることを示す
         type master;
         // ファイル名
         file "/etc/bind/db.localhost";
 };
 
 // localhost の逆引きの設定
 zone "0.0.127.in-addr.arpa" {
         // Master DNS Serverであることを明示
         type master;
         // ファイル名
         file "/etc/bind/db.0.0.127";
 };
 
 // xx.xxx の正引きの設定(内部用ドメイン)
 zone "xx.xxx" {
         // Master DNS Serverであることを明示
         // 内部から *.xx.xxx を引いたときにきちんと見えるよう設定
         type master;
         // ファイル名
         file "/etc/bind/db.xx.xxx";
         allow-update{
                 192.168.1.50;
                 127.0.0.1;
         };
 };
 
 // 192.168.1.* の逆引きの設定
 zone "1.168.192.in-addr.arpa" {
         // Master DNS Serverであることを明示
         type master;
         // ファイル名
         file "db.1.168.192";
         allow-update{
                 192.168.1.50;
                 127.0.0.1;
         };
 };
 
 // yyy.yy の正引きの設定(DDNSドメイン)
 zone "yyy.yy" {
         // Master DNS Serverであることを明示
         // 内部から tldsjp.yyy.yy を引いたときにきちんと見えるよう設定
         type master;
         // ファイル名
         file "db.yyy.yy";
 };
 
 include "/etc/bind/named.conf.local";

**/etc/bind/named.conf.options [#t56fe0ea]

 options {
         // zone ファイルの格納場所
         directory "/var/cache/bind";
 
         // 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 and later use an unprivileged
         // port by default.
 
         // query-source address * port 53;
 
         // BIND の利用を許す範囲を指定
         allow-query {
                 // 自分自身( localhost )
                 127.0.0.1;
                 // 192.168.1.* ( Subnet 255.255.255.0 )
                 192.168.1.0/24;
         };
 
         // スレーブ DNS のアドレスを記述。内向き DNS の場合は必要ないが一応記載。
         allow-transfer {
                 // 自分自身( localhost )
                 127.0.0.1;
                 // 192.168.1.* ( Subnet 255.255.255.0 )
                 192.168.1.0/24;
         };
 
         // If your ISP provided one or more IP addresses for stable
         // nameservers, you probably want to use them as forwarders.
         // Uncomment the following block, and insert the addresses replacing
         // the all-0's placeholder.
 
         // forwarders {
         //      0.0.0.0;
         // };
         // 自前で名前解決できないとき、まずはプロバイダの DNS へ聞きに行く様にする。
         forwarders {
                 aaa.bbb.ccc.ddd;  // プロバイダのプライマリ DNS の IP アドレス
                 aaa.bbb.ccc.eee;  // プロバイダのセカンダリ DNS の IP アドレス
         };
 
         auth-nxdomain no;    # conform to RFC1035
         listen-on-v6 { any; };
 };

**/etc/bind/named.conf.local [#cd7543c6]

 //
 // Do any local configuration here
 //
 
 // Consider adding the 1918 zones here, if they are not used in your
 // organization
 //include "/etc/bind/zones.rfc1918";

コメントだけですが…

**localhost.zone [#gb2ba7bb]

 $TTL 1D
 
 @  IN  SOA  xxxxx.xx.net.  root.xxxxx.xx.net. (
        2006090300 ; シリアル番号
        3H
        1H
        1W
        1D )
 
            IN NS xxxxx.xx.net.
 localhost. IN A  127.0.0.1

**0.0.127.in-addr.arpa [#d7676046]

 $TTL  1D
 
 @  IN  SOA  xxxxx.xx.net.  root.xxxxx.xx.net. (
        2006090300
        3H
        1H
        1W
        1D )
 
        IN  NS  xxxxx.xx.net.
 1      IN  PTR localhost.

**xx.net(内部用設定ファイル) [#za68b233]

 $TTL  1D
 
 @  IN  SOA  xxxxx.xx.net.  root.xxxxx.xx.net. (
        2006090300
        3H
        1H
        1W
        1D )
 
             IN  NS      xxxxx.xx.net.
             IN  MX  10  xxxxx.xx.net. ; メールサーバのホスト名を指定
                                       ; 10 は優先順位。
 
 router      IN  A       192.168.1.1
 xxxxx       IN  A       192.168.1.10
 xx.net      IN  A       192.168.1.10
 chrono      IN  A       192.168.1.3
 
 dns         IN  CNAME   sigel
 www         IN  CNAME   sigel
 smtp        IN  CNAME   sigel
 pop         IN  CNAME   sigel

**1.168.192.in-addr.arpa [#x5e20b49]
 $TTL  1D
 
 @     IN  SOA  xxxxx.xx.net.  root.xxxxx.xx.net. (
       2006090300
       3H
       1H
       1W
       1D )
 
       IN  NS  xxxxx.xx.net.
 
            IN  PTR   xx.net.       ; 解決するドメイン
            IN  A     255.255.255.0 ; サブネットマスク
 
 1          IN  PTR   router.xx.net.
 10         IN  PTR   sigel.xx.net.
 2          IN  PTR   chrono.xx.net.

**yyy.yy(DDNSドメイン設定ファイル) [#m10449a6]

 $TTL  1D
 
 @  IN  SOA  yyyyy.yyy.yy.  root.yyyyyy.yyy.yy. (
        2006090300
        3H
        1H
        1W
        1D )
 
           IN  NS      yyyyyy.yyy.yy.
 yyyyyy    IN  A       192.168.1.10

*named.pidを作成可能にする [#b56829ba]

 $ su
 # chmod 777 /var/run

他のデーモン等が作成する pid ファイルは他ユーザーが書き込みできなくなっているようなのでこれで対応

*自動起動設定 [#da794afd]

もともと入っていたパッケージ版bindの起動スクリプトを流用~
起動スクリプトへのリンクは既にできているのでそのまま使う%%細かいことは気にしない(ぉ%%

-/etc/init.d/named

 #!/bin/bash
 #
 # named           This shell script takes care of starting and stopping
 #                 named (BIND DNS server).
 #
 # chkconfig: - 55 45
 # description: named (BIND) is a Domain Name Server (DNS) \
 # that is used to resolve host names to IP addresses.
 # probe: true
 
 # Source function library.
 . /etc/rc.d/init.d/functions
 
 # Source networking configuration.
 [ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
 
 # Check that networking is up.
 [ "${NETWORKING}" = "no" ] && exit 0
 
 # Source bind configuration
 [ -r /etc/sysconfig/named ] && . /etc/sysconfig/named
 
 [ -f /usr/local/sbin/named ] || exit 0
 [ -r /etc/named.conf ] || exit 0
 
 RETVAL=0
 prog="named"
 
 start() {
         # Start daemons.
         echo -n $"Starting $prog: "
         daemon /usr/local/sbin/named -u named ${OPTIONS}
    RETVAL=$?
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/named
    echo
    return $RETVAL
 }
 stop() {
         # Stop daemons.
         echo -n $"Shutting down $prog: "
 #  /usr/sbin/rndc stop
         killproc named
    RETVAL=$?
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/named
         echo
    return $RETVAL
 }
 restart() {
    stop
    sleep 2
    start
 }  
 
 # See how we were called.
 case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        restart
        ;;
    condrestart)
        [ -f /var/lock/subsys/named ] && restart || :
        ;;
    *)
            echo "Usage: named {start|stop|restart|condrestart}"
        exit 1
 esac
 
 exit $?

*その他のファイルの設定 [#s037e918]

**/etc/hosts [#be57c23a]
DNS サーバの情報と hosts の情報が不整合を起こさない為に localhost 以外はコメントアウト

**/etc/resolv.conf [#l9c2adc3]
 search          xx.net
 nameserver      127.0.0.1
 nameserver      プロバイダのDNSサーバー

**/etc/nsswitch.conf [#d3d778de]

hostsの行にdnsが含まれていること

 hosts:      files nisplus nis dns

**/etc/host.conf [#hf618683]

 order hosts,bind

*DDNSセットアップ [#x48106f9]

[[DDNSセットアップ>Misc/DDNSセットアップ]]

*参考サイト [#ne008048]
-[[内部向け DNS サーバの構築 - Linux で自宅サーバ [ Home Server Technical. ]:http://www.miloweb.net/bind.html]]
-[[dns.html:http://www.geocities.co.jp/SiliconValley-Bay/9678/dns.html]]
-[[@IT:すべての基礎、マスター・ゾーンサーバの設定(1/3):http://www.atmarkit.co.jp/flinux/rensai/bind902/bind902a.html]]
-[[@IT:すべての基礎、マスター・ゾーンサーバの設定(2/3):http://www.atmarkit.co.jp/flinux/rensai/bind902/bind902b.html]]
-[[@IT:すべての基礎、マスター・ゾーンサーバの設定(3/3):http://www.atmarkit.co.jp/flinux/rensai/bind902/bind902c.html]]

-[[ISC BIND:http://www.isc.org/sw/bind/]]

-[[conf ファイル 1 (BIND8,9):http://www.wakhok.ac.jp/~kanayama/summer/02/site/node67.html]]
-[[[vine-users:067180] Re: bind9停止時のエラーについて:http://search.luky.org/vine-users.6/msg07180.html]]

注意)このバージョンのsafariではjavascriptがうまく動作しないので、recaptchaはページ切り替え版を利用しています。
トップ 一覧 検索 最終更新 バックアップ   ヘルプ   最終更新のRSS