こんにちは。ちゃぼP(@chabo0429)です。
ReadyNASでは、DHCPサーバとDNSサーバが動くようになっていない。ただし、当然ながらインストールすれば動かすことは出来る。
今回は、それにチャレンジ、
DHCPサーバをインストール
# apt-get -y install dhcp3-server # vi /etc/dhcp/dhcpd.conf
13行目
option domain-name "yourdomain.jp"; option domain-name-servers 192.168.100.10;
最終行に追記
subnet 192.168.100.0 netmask 255.255.255.0 {
option routers 192.168.100.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.100.100 192.168.100.200;
}
# /etc/init.d/isc-dhcp-server restart
DNSをインストール
続いてDNSサーバ。BINDを用いるが、元々アドオンがReadyNASのアプリからダウンロードが可能。ところがモジュールが古いのか、まともに動かない。
なので、こちらも手動での設定となった。
# 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";
include "/etc/bind/named.conf.local";
#include "/etc/bind/named.conf.default-zones";
view "local" {
match-clients { localnet; };
allow-query { localnet; };
zone "yourdomain.jp" {
type master;
file "/etc/bind/yourdomain.zone";
}
zone "100.168.192.in-addr.arpa" {
type master;
file "/etc/bind/yourdomain.rev";
};
zone "." in {
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";
};
};
# vi /etc/bind/named_conf_options
acl localnet {
192.168.100.0/24;
127.0.0.1;
};
options {
directory "/var/cache/bind";
allow-query { localnet; };
allow-transfer { none; };
forwarders { 208.67.222.222;208.67.220.220;8.8.8.8; 8.8.4.4; };
forward only;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { none; }; # IPv6
};
#options {
#directory "/apps/bindr6/tmp";
# Hide version string for security
#version "not currently available";
#listen-on port 53 { any; };
# listen-on-v6 { ::1; };
# Do not query from the specified source port range
# (Adjust depending your firewall configuration)
#avoid-v4-udp-ports { range 1 32767; };
#avoid-v6-udp-ports { range 1 32767; };
# Forward all DNS queries to the Google Public DNS.
#forwarders { 208.67.222.222;208.67.220.220;8.8.8.8; 8.8.4.4; };
#forward only;
# Expire negative answer ASAP.
# i.e. Do not cache DNS query failure.
#max-ncache-ttl 3; # 3 seconds
# Disable non-relevant operations
#allow-transfer { none; };
#allow-update-forwarding { none; };
#allow-notify { none; };
#dnssec-validation no;
#auth-nxdomain no; # conform to RFC1035
#listen-on-v6 { any; };
#};
# vi /etc/bind/yourdomain.zone $TTL 86400 @ IN SOA nas.yourdomain.jp. postmaster.yourdomain.jp. ( 2015051601 ; Serial (YYYYMMDDNN) 3600 ; Refresh (s) 900 ; Retry (s) 604800 ; Expire (s) 86400 ; Minimum (s) ) IN NS nas.yourdomain.jp. ; ns IN MX 10 nas.yourdomain.jp. ; mx nas IN A 192.168.100.10 www IN CNAME nas mail IN CNAME nas</blockquote> <blockquote># vi /etc/bind/yourdomain.rev $TTL 86400 ; 1 day @ IN 86400 SOA nas.yourdomain.jp. postmaster.yourdomain.jp. ( 2015050701 ; serial number 3600 ; refresh 900 ; retry 604800 ; expire 86400 ) ; minimum TTL IN NS nas.yourdomain.jp. 10 IN PTR nas.omoide-soko.jp. # /etc/init.d/bind9 restart
これで、DHCPとDNSが動くようになった。
当然ながら、LAN内にルータなどのDHCPサーバがある場合は、サーバを無効化して、同じサブネット内にDHCPが重複しないようにしないと、NASへの名前の解決がうまくいかなくなるので注意。