ローカル用DNSの設定(2003.2.4) フレッツADSLで動的IPで常時接続環境までこぎ着け独自ドメインも何とか ゲットしてさてサーバ公開だ!っていうときにふと外部からは見えるけどロー カル側からグローバルアドレスや独自ドメイン指定で見えない!?ってこと、 ありますよね。 当方もAppleのAirMacBasestationで無線LANを構築したのですが、いきなり ローカルから見えないという仕様に遭遇したのでした。 まあ、niftyなどではプロキシサーバを使えるのでブラウザにプロキシ設定 すれば何とか見ることは可能です。しかし当方の場合は別の問題がありました。 自宅サーバ内のメールサーバにLANからアクセスできないのです。(逆に考え るとルータさえ対応していればLANにDNSは不要とも言えますね。) これを解決するには、OS9までのMacやLinux,WindowsではHostsというファイ ルを作ってその中に独自ドメインとローカルアドレスの対応を記述してあげれ ばよいはずなのです。 つまり、1台か2台くらいの端末ならそのマシン毎に「独自ドメイン−> 自宅サーバのローカルアドレス」の名前解決手段があればいいのです。 ところが、MacOSXはこの指定が少しややこしい。そして当方の稼働端末はサ ーバを除いて現在4台。この台数ですらいちいち全部の設定を微調整するのは 面倒。世の中にはもっとたくさんのPCを所有している方はいらっしゃるでし ょう。そこでいろいろ考えた末、今更ながらWebサーバにローカル専用のDNSを 立ち上げることにしました。今回選んだのはBIND for NT(4.9.7)。Linuxユー ザならBINDは特に入手に困らないでしょう。) 以下、その設定内容です。(違ってたらメールでそっと指摘してください。) (ネットワーク:10.0.1.0、サブネットマスク:255.255.255.0, webサーバ(=DNSサーバ)アドレス:10.0.1.201、ルータアドレス:10.0.1.1、 ドメイン名:example.com、プロバイダのDNS:xxx.xxx.xxx.xxxのとき) あとはルータのPPPoE設定の辺りにDNSサーバの入力箇所があるのでそこにロー カルのDNSサーバアドレス(例では10.0.1.201)を設定しておけば良いでしょう。 ---------------------------------------------------------------------- ; File: RESOLV.CONF ; NOTE: you may not want the domain line... I don't use it on my server... ; it adds extra work to the server by appending your domain name to failed queries if ; they don't end in a dot. The only benefit is to allow you to resolve incompletely ; specified names (i.e. www). domain example.com search example.com nameserver 10.0.1.201 nameserver xxx.xxx.xxx.xxx ; ---------------------------------------------------------------------- ; File: named.boot ; Purpose: give the DNS its startup parameters and ; list of startup files. Directory c:\\var\\named ; ;check-names primary fail ;check-names secondary warn ;check-names response ignore ; ; establish a loopback entry for this machine, and tell ; it to load its identity from db.127.0.0 primary 0.0.127.IN-ADDR.ARPA db.127.0.0 ; XFRNETS parameter limits the transfer of zone information ; to machines matching the subnet wildcard/mask entries listed. ; WARNING: I have also added myself so that I can help test out ; peoples configs that are having problems. ; ;XFRNETS 127.0.0.0 10.0.1.0 ; set ourselves as primary server for the zone primary example.com db.zoneinfo ; provide reverse address-to-host mapping primary 1.0.10.in-addr.arpa db.10.0.1.0 ; ; prime the DNS with root server 'hint' information cache . db.cache ; ---------------------------------------------------------------------- ; File: db.127.0.0 file ; Purpose: This file establishes the identity of this DNS. ; SOA stands for 'start of authority' and sets the ; default parameters for information this DNS is ; authoritative for: ; @ IN SOA example.com. postmaster.example.com. ( 2003012610 ; serial [yyyyMMddNN] 21600 ; refresh [6h] 3600 ; retry [1h] 691200 ; expire [8d] 86400) ; minimum [1d] ; IN NS example.com. 1 IN PTR localhost.example.com. ; ---------------------------------------------------------------------- ; File: db.10.0.1.0 (=db.inaddr) ; Purpose: This file establishes the address-to-name lookup ; information for this zone. You will have to ; fill out the actual address information for your ; specific zone in the format shown in the comments ; @ IN SOA example.com. postmaster.example.com. ( 2003012610 ; serial [yyyyMMddNN] 21600 ; refresh [6h] 3600 ; retry [1h] 691200 ; expire [8d] 86400) ; minimum [1d] ; IN NS example.com. 201 IN PTR example.com. ; ---------------------------------------------------------------------- ; File: db.zoneinfo ; Purpose: This file establishes the name/address information ; for this zone. You will have to fill out the actual ; information for your specific zone in the format shown ; in the comments. ; @ IN SOA example.com. postmaster.example.com. ( 2003012610 ; serial [yyyyMMddNN] 21600 ; refresh [6h] 3600 ; retry [1h] 691200 ; expire [8d] 86400) ; minimum [1d] IN NS example.com. IN A 10.0.1.201 IN MX 10 example.com. ; CNames www IN CNAME example.com. xxx IN CNAME example.com. yyy IN CNAME example.com. ; ---------------------------------------------------------------------- ホームへ このサイトの内容については各自の責任で行って下さい。 当方では何があっても一切責任を持てません。 ご意見・ご要望等お待ち申し上げます。 E-mail:webmaster@raibo.com Copyright (c) 2003 a-k, All rights reserved.