差分

提供: fukudat.net
ナビゲーションに移動検索に移動
985 バイト追加 、 2018年8月31日 (金) 07:07
<pre>
$ cd /etc/bind
$ ls -l</pre>total 52-rw-r--r-- 1 root root 3954 Jan 16 2018 このディレクトリ /etc/bind を group "bind.keys" で書き込み可能にする。そうしないとDDNSがpermission deniedでダイナミックにならない。-rw-r--r-- 1 root root 237 Jan 16 2018 db.0<pre>-rw-r--r-- 1 root root 271 Jan 16 2018 db.127$ sudo chmod g+w /etc/bind-rw-r--r-- 1 root root 237 Jan 16 2018 db.255</pre>-rw-r--r-- 1 root root 353 Jan 16 2018 db.emptyapparmorがインストールされていたら、その設定ファイルも変更して bind が /etc/bind ディレクトリに書き込めるようにする。-rw-r--r-- 1 root root 270 Jan 16 2018 db.local<pre>-rw-r--r-- 1 root root 3171 Jan 16 2018 db$ cd /etc/apparmor.rootd/-rw-r--r-- 1 root bind 463 Jan 16 2018 named.conf-rw-r--r-- 1 root bind 490 Jan 16 2018 named$ sudo vi usr.confsbin.default-zones-rw-r--r-- 1 root bind 165 Jan 16 2018 named.conf.local-rw-r--r-- 1 root bind 890 Aug 31 02:36 named.conf.options-/etc/bind/** rw-r----- 1 bind bind , 77 Aug 31 02:36 rndc.key# <-rw-r--r-- 1 root root 1317 Jan 16 2018 zones.rfc1918を rw に書き換える:
</pre>
options {
directory "/var/cache/bind";
 
// 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 {
/etc/bind/named.conf.local を編集.
<pre>
//
// Do any local configuration here
//
 
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
 
zone "fukudat.com" {
type master;
</pre>
zone file "/etc/bind/db.fukudat.com" を以下のように作る。を以下のように作る。owner を bind.bind にする。
<pre>
$ORIGIN fukudat.com.
fitpc2i A 192.168.0.11
www A xxx.xxx.xxx.xxx
</pre>
 
zone file "db.0.168.192" を以下のように作る。owner を bind.bind にする。
<pre>
$TTL 86400 ; 1 day
@ IN SOA ns.fukudat.com. root.fukudat.com. (
2018000001 ; serial
10800 ; refresh (3 hours)
1800 ; retry (30 minutes)
4320000 ; expire (7 weeks 1 day)
86400 ; minimum (1 day)
)
IN NS ns.fukudat.com.
1 IN PTR router.fukudat.com.
11 IN PTR fitpc2i.fukudat.com.
</pre>
最後にサービスをリスタート.
<pre>
# /etc/init.d/bind9 restart
</pre>
 
== 管理 ==
 
=== コマンドでアドレスを追加する ===
nsupdateコマンドを使う.
<pre>
# nsupdate
> update delete oldhost.fukudat.com A          # oldhost.fukudat.comのAレコードを消去する
> update delete 31.0.168.192.in-addr.arpa. IN PTR # 192.168.0.31の逆引きレコードを消去する
> update add newhost.fukudat.com 86400 A 192.168.0.51 # newhost.fukudat.comのAレコードをアドレス192.168.0.51で作成する.TTLは1日(86400秒).
> update add 51.0.168.192.in-addr.arpa. 86400 IN PTR newhost.fukudat.com. # 192.168.0.51の逆引きレコードを作成する.
> send
</pre>
 
=== ゾーンファイルを手動で書き換える ===
静的なアドレスを登録するときゾーンファイル (db.fukudat.com (順引きデータ), db.0.168.192 (逆引きファイル)) を直接書き換えたくなる.そうするならば,*.jnl ファイルに動的な変更の履歴が残っているので,これをフラッシュする必要がある.
<pre>
# rndc freeze
</pre>
そのうえでゾーンファイルを書き換える。
<pre>
# /etc/init.d/bind9 stop
# vi /etc/bind/db.fukudat.com
... 書き換え ...
</pre>
動的なアップデートを再開して、bindを再起動する。
<pre>
# rndc thaw
# /etc/init.d/bind9 restart
</pre>

案内メニュー