自分で書いた記事を見ながら設定。読みにくくてわかりにくいなぁ。
しかも間違っていたことがわかりましたので訂正していきます・・・。
改めて色々と見直し、結論として以下の様な設定をした。
ここから広告
広告ここまで
以降の表記にはこのような意味を持たせいる。
そして、赤文字は今回のbind9設定で追加したり変えたりしたところ。
| 表記 | 内容 |
|---|---|
| hogeserver | 今回設定しているサーバーの名前 |
| hogeddns.jp | 使わせていただいている無料DynamicDNSサービス |
| hogeserver.hogeddns.jp | うちのネットワークのFQDN(Full Qualified Domain Name) |
| 172.16.nnn.nnn | 今回設定しているサーバーのIPアドレス |
| 172.16.nnn.1 | うちのルーター |
■/etc/bind/named.conf.options
IPv6を無効にする。
options {
directory "/var/cache/bind";
//========================================================================
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See https://www.isc.org/bind-keys
//========================================================================
dnssec-validation auto;
auth-nxdomain no; # conform to RFC1035
//listen-on-v6 { any; };
};
■/etc/bind/named.conf.local
他のファイルに書いた設定を読み込むようにする。
// My configuration.
include "/etc/bind/zones.hogeserver";
■/etc/bind/zones.hogeserver
ゾーンファイルを指定する。太字部分は2013/06/26追記(動作確認をしたらもうちょっと直すかも)。
include "/etc/bind/rndc.key";
//正引き
zone "hogeserver.hogeddns.jp" {
type master;
file "/var/cache/bind/db.hogeserver.zone";
allow-update {
// 172.16.nnn.nnn;
key "rndc-key";
};
};
//逆引き
zone "16.172.in-addr.arpa" {
type master;
file "/var/cache/bind/db.hogeserver.revz";
allow-update {
// 172.16.nnn.nnn;
key "rndc-key";
};
};
■/var/cache/bind/db.hogeserver.zone
ゾーンファイルを作る。
;
; ローカルネットワークの設定
;
$TTL 86400
@ IN SOA dns.hogeserver.hogeddns.jp. root.hogeserver.hogeddns.jp. (
2013052611 ; Serial Number
3600 ; Refresh 60分
600 ; Retry 10分
259200 ; Expire 3日
86400 ) ; Negative Cache TTL 1日
;
;; Name Server
;
IN NS 172.16.nnn.nnn. ; DNSである自分自身
IN NS 172.16.nnn.1. ; ISPが用意するDNS
;
;; Mail eXchange
;
IN MX 10 smtp.hogeserver.hogeddns.jp.
;
;; Address
;
@ IN A 172.16.nnn.nnn
hogeserver IN A 172.16.nnn.nnn
dns IN CNAME hogeserver
www IN CNAME hogeserver
smtp IN CNAME hogeserver 2013/06/22 RFC違反のため修正
imap IN CNAME hogeserver
smtp IN A 172.16.nnn.nnn
router IN A 172.16.nnn.1
※このファイルはbind9によって書き換えられる。DynamicDNS設定をしているから。
■/var/cache/bind/db.hogeserver.revz
逆引きゾーンファイルを作成する。
;
; ローカルネットワークの設定(逆引き)
;
$TTL 86400
@ IN SOA dns.hogeserver.hogeddns.jp. root.hogeserver.hogeddns.jp. (
2013052611 ; Serial Number
3600 ; Refresh 60分
600 ; Retry 10分
259200 ; Expire 3日
86400 ) ; Negative Cache TTL 1日
;
;; Name Server
;
IN NS dns.hogeserver.hogeddns.jp. ; DNSである自分自身
IN NS router.hogeserver.hogeddns.jp. ; ISPが用意するDNS
;
;; PoinTeR
;
IN PTR hogeserver.hogeddns.jp. ; 扱うドメインの名前
IN A 255.255.0.0 ; ネットマスク
;
;; Tables
;
nnn IN PTR hogeserver.hogeghoge.hogeddns.jp.
nnn IN PTR dns.hogeghoge.hogeddns.jp.
nnn IN PTR www.hogeghoge.hogeddns.jp.
nnn IN PTR smtp.hogeghoge.hogeddns.jp.
nnn IN PTR imap.hogeghoge.hogeddns.jp.
1 IN PTR router.hogeghoge.hogeddns.jp.
※このファイルはbind9によって書き換えられる。DynamicDNS設定をしているから。
■/etc/default/bind9
IPv4のみ有効にする。
# run resolvconf?
RESOLVCONF=no
# startup options for the server
#OPTIONS="-u bind"
OPTIONS="-u bind -4"
■/etc/dhcp/dhcpd.conf
DynamicDNS対応部分を追記する。太字部分は2013/06/26追記。
#
# Sample configuration file for ISC dhcpd for Debian
#
# Attention: If /etc/ltsp/dhcpd.conf exists, that will be used as
# configuration file instead of this file.
#
#
# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style interim;
update-static-leases on;
# option definitions common to all supported networks...
option domain-name "hogeserver.hogeddns.jp";
option domain-name-servers 172.16.nnn.nnn, 172.16.nnn.1;
default-lease-time 600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
#-----------------------------------------
# This is a my network subnet declaration.
#-----------------------------------------
subnet 172.16.0.0 netmask 255.255.0.0 {
# --- default gateway
option routers 172.16.nnn.1;
# --- WINS server
option netbios-name-servers 172.16.nnn.nnn;
# --- NTP server
option ntp-servers 172.16.nnn.nnn;
option time-offset -18000; # Eastern Standard Time
# --- Lease range setting
range 172.16.nnn.st 172.16.nnn.ed;
# --- Fixed address
host hogeclient {
hardware ethernet nn:nn:nn:nn:nn:nn;
fixed-address 172.16.nnn.nn1;
}
host hogeprinter {
hardware ethernet nn:nn:nn:nn:nn:nn;
fixed-address 172.16.nnn.nn2;
}
host iphone_hogeuser {
hardware ethernet nn:nn:nn:nn:nn:nn;
fixed-address 172.16.nnn.nn3;
}
host ipad_hogeuser {
hardware ethernet nn:nn:nn:nn:nn:nn;
fixed-address 172.16.nnn.nn4;
}
}
#-----------------------------------------
# Dynamic DNS settings.
#-----------------------------------------
# /etc/bind/rndc.key の内容を書く。
key "rndc-key" {
algorithm hmac-md5;
secret "xxxxxxxxxxxxxxxxxxxxxxxx";
};
zone hogeserver.hogeddns.jp. {
primary 172.16.nnn.nnn;
key "rndc-key";
}
zone 16.172.in-addr.arpa. {
primary 172.16.nnn.nnn;
key "rndc-key";
}
設定を反映させて動作確認。
$ sudo service bind9 restart $ sudo service isc-dhcp-server restart
まず、/var/log/syslogでエラーが発生していないか確認。
その後、/var/cache/bindでゾーンファイル、逆引きゾーンファイルが書き換えられていくことを確認。


コメントはこちらから お気軽にどうぞ ~ 投稿に関するご意見・感想・他