- DNSサーバーを構築(bindをインストール)
# aptitude install bind9 # aptitude clean
- bindを設定
# vi /etc/bind/named.conf.options
options { directory "/var/cache/bind"; version "unknown"; // If there is a firewall between you and nameservers you want // to talk to, you may need to fix the firewall to allow multiple // ports to talk. See http://www.kb.cert.org/vuls/id/800113 // 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; // }; allow-query { localhost; localnets; }; forward first; forwarders { 192.168.0.1; }; auth-nxdomain no; # conform to RFC1035 listen-on-v6 { any; }; };# vi /etc/bind/named.conf
// 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 "." { // type hint; // file "/etc/bind/db.root"; //}; // be authoritative for the localhost forward and reverse zones, and for // broadcast zones as per RFC 1912 //zone "localhost" { // type master; // file "/etc/bind/db.local"; //}; //zone "127.in-addr.arpa" { // type master; // file "/etc/bind/db.127"; //}; //zone "0.in-addr.arpa" { // type master; // file "/etc/bind/db.0"; //}; //zone "255.in-addr.arpa" { // type master; // file "/etc/bind/db.255"; //}; include "/etc/bind/named.conf.local";# vi /etc/bind/named.conf.local
// // Do any local configuration here // // Consider adding the 1918 zones here, if they are not used in your // organization //include "/etc/bind/zones.rfc1918"; view "internal" { match-clients { localhost; localnets; }; match-destinations { localnets; }; recursion yes; zone "." { type hint; file "/etc/bind/db.root"; }; zone "localhost" { type master; file "/etc/bind/db.local"; }; zone "127.in-addr.arpa" { type master; file "/etc/bind/db.127"; }; zone "0.in-addr.arpa" { type master; file "/etc/bind/db.0"; }; zone "255.in-addr.arpa" { type master; file "/etc/bind/db.255"; }; include "/etc/bind/named.saizensen.net.zone"; }; view "external" { match-clients { any; }; match-destinations { any; }; recursion no; zone "." { type hint; file "/etc/bind/db.root"; }; include "/etc/bind/named.saizensen.net.zone.wan"; };# vi /etc/bind/named.saizensen.net.zone
zone "saizensen.net" { type master; file "/etc/bind/saizensen.net.db"; #allow-update { none; }; }; zone "0.168.192.in-addr.arpa" { type master; file "/etc/bind/0.168.192.in-addr.arpa.db"; #allow-update { none; }; };# vi /etc/bind/named.saizensen.net.zone.wan
zone "saizensen.net" { type master; file "/etc/bind/saizensen.net.db.wan"; allow-query { any; }; #allow-transfer { 123.50.202.226; 38.110.146.192; }; ← セカンダリーネームサーバーとしてマイハマネットを使う場合はコメントアウトを外す。(マイハマネットへ登録後) #notify yes; ← セカンダリーネームサーバーとしてマイハマネットを使う場合はコメントアウトを外す。(マイハマネットへ登録後) #allow-update { none; }; }; zone "239.249.122.in-addr.arpa" { type master; file "/etc/bind/239.249.122.in-addr.arpa.db"; #allow-update { none; }; };# vi /etc/bind/saizensen.net.db
$TTL 86400 @ IN SOA saizensen.net. root.saizensen.net.( 2009080401 ; Serial 3600 ; Refresh 900 ; Retry 604800 ; Expire 86400 ; Minimum ) IN NS saizensen.net. IN MX 10 saizensen.net. IN A 192.168.0.2 @ IN A 192.168.0.2 mail IN A 192.168.0.2 ns IN A 192.168.0.2 www IN A 192.168.0.2 admin IN A 192.168.0.2 test IN A 192.168.0.2 * IN A 192.168.0.2# vi /etc/bind/saizensen.net.db.wan
$TTL 86400 @ IN SOA ns.saizensen.net. root.saizensen.net.( 2009080401 ; serial 3600 ; refresh (1 hour) 900 ; retry (15 minutes) 604800 ; expire (1 week) 86400 ; negative (1 day) ) IN NS ns.saizensen.net. ; IN NS ns1.maihama-net.com. ← セカンダリーネームサーバーとしてマイハマネットを使う場合はコメントアウトを外す。(マイハマネットへ登録後) ; IN NS ns2.maihama-net.com. ← セカンダリーネームサーバーとしてマイハマネットを使う場合はコメントアウトを外す。(マイハマネットへ登録後) IN MX 10 mail.saizensen.net. ns IN A 122.249.239.71 @ IN A 122.249.239.71 www IN A 122.249.239.71 mail IN A 122.249.239.71 admin IN A 122.249.239.71 test IN A 122.249.239.71 saizensen.net. IN TXT "v=spf1 a mx ~all"# vi /etc/bind/0.168.192.in-addr.arpa.db
$TTL 86400 ; 1 day @ IN SOA ns.saizensen.net. root.saizensen.net.( 2009080401 ; serial 3600 ; refresh (1 hour) 900 ; retry (15 minutes) 604800 ; expire (1 week) 86400 ; minimum (1 day) ) IN NS ns.saizensen.net. 2 IN PTR ns.saizensen.net. 2 IN PTR www.saizensen.net. 2 IN PTR mail.saizensen.net. 2 IN PTR admin.saizensen.net. 2 IN PTR test.saizensen.net.# vi /etc/bind/239.249.122.in-addr.arpa.db
$TTL 86400 @ IN SOA ns.saizensen.net. root.saizensen.net.( 2009080401 ; serial 3600 ; refresh (1 hour) 900 ; retry (15 minutes) 604800 ; expire (1 week) 86400 ; negative (1 day) ) IN NS ns.saizensen.net. 71 IN PTR saizensen.net.# /etc/init.d/bind9 restart
- 動作確認
# dig saizensen.net # dig -x 192.168.0.2 # dig www.google.co.jp # dig -x ***.***.***.*** ← グローバルIP
- ネットワーク設定を編集
# vi /etc/network/interfaces
dns-nameservers 192.168.0.1 ← この行を消す
- システム再起動
# reboot
- ルータの設定でPort53(TCP/UDP)を開ける。
- バーチャルホスト用にドメインを設定する。(例:virtualhost.netというドメインの場合)
# vi /etc/bind/named.conf.local
// // Do any local configuration here // // Consider adding the 1918 zones here, if they are not used in your // organization //include "/etc/bind/zones.rfc1918"; view "internal" { ・・・ ・・・ include "/etc/bind/named.saizensen.net.zone"; include "/etc/bind/named.virtualhost.net.zone"; ← 追記 }; view "external" { ・・・ ・・・ include "/etc/bind/named.saizensen.net.zone.wan"; include "/etc/bind/named.virtualhost.net.zone.wan"; ← 追記 };# vi /etc/bind/named.virtualhost.net.zone
zone "virtualhost.net" { type master; file "/etc/bind/virtualhost.net.db"; #allow-update { none; }; };# vi /etc/bind/named.virtualhost.net.zone.wan
zone "virtualhost.net" { type master; file "/etc/bind/virtualhost.net.db.wan"; allow-query { any; }; #allow-transfer { 123.50.202.226; 38.110.146.192; }; ← セカンダリーネームサーバーとしてマイハマネットを使う場合はコメントアウトを外す。(マイハマネットへ登録後) #notify yes; ← セカンダリーネームサーバーとしてマイハマネットを使う場合はコメントアウトを外す。(マイハマネットへ登録後) #allow-update { none; }; };# vi /etc/bind/virtualhost.net.db
$TTL 86400 @ IN SOA virtualhost.net. root.virtualhost.net.( 2009080401 ; Serial 3600 ; Refresh 900 ; Retry 604800 ; Expire 86400 ; Minimum ) IN NS virtualhost.net. IN MX 10 virtualhost.net. IN A 192.168.0.2 @ IN A 192.168.0.2 mail IN A 192.168.0.2 ns IN A 192.168.0.2 www IN A 192.168.0.2 admin IN A 192.168.0.2 test IN A 192.168.0.2 * IN A 192.168.0.2# vi /etc/bind/virtualhost.net.db.wan
$TTL 86400 @ IN SOA ns.virtualhost.net. root.virtualhost.net.( 2009080401 ; serial 3600 ; refresh (1 hour) 900 ; retry (15 minutes) 604800 ; expire (1 week) 86400 ; negative (1 day) ) IN NS ns.virtualhost.net. ; IN NS ns1.maihama-net.com. ← セカンダリーネームサーバーとしてマイハマネットを使う場合はコメントアウトを外す。(マイハマネットへ登録後) ; IN NS ns2.maihama-net.com. ← セカンダリーネームサーバーとしてマイハマネットを使う場合はコメントアウトを外す。(マイハマネットへ登録後) IN MX 10 mail.virtualhost.net. ns IN A 122.249.239.71 @ IN A 122.249.239.71 www IN A 122.249.239.71 mail IN A 122.249.239.71 admin IN A 122.249.239.71 test IN A 122.249.239.71 virtualhost.net. IN TXT "v=spf1 a mx ~all"# /etc/init.d/bind9 restart
- Newer: [Debian]Debian lennyで1からサーバーを作ってみる – apacheをインストール
- Older: [Debian]Debian lennyで1からサーバーを作ってみる – clamavをインストール
Trackbacks:2
- Trackback URL for this entry
- http://ore.saizensen.net/archives/286/trackback
- Listed below are links to weblogs that reference
- [Debian]Debian lennyで1からサーバーを作ってみる – bindをインストール from おれ最前線ねっと
- pingback from おれ最前線ねっと - [Debian]Debian lennyで1からサーバーを作ってみる – 13. apacheへバーチャルホストを設定する 09-08-14 (金) 11:47
-
[...] DNSサーバー(bind)へvirtualhost.netを登録する。 参考:[Debian]Debian lennyで1からサーバーを作ってみる – 10. bindをインストールのページ最下部「バーチャルホスト用にドメインを設定する。」 [...]
- pingback from キャッシュ専用DNSサーバーの構築 « SkyGarden出張所 10-05-14 (金) 22:53
-
[...] bindをインストール|おれ最前線ねっと [...]




