MENU

DNSSEC検証 準備・DNS構築編

目次

はじめに

何をしたいか

DNSSECの信頼の連鎖を実際に構築し、DNS応答がどのように署名・検証されるのかを確認する。また、DNSSECに関する設定や署名を意図的に破壊し、検証失敗時にフルリゾルバやクライアントからどのように見えるのかを確認する。本記事では検証前の準備を記載。

準備・DNS構築編 本記事
DNSSEC構築編 https://cybermemo.blog/dnssec-lab-configuration
破壊・検証編 https://cybermemo.blog/dnssec-lab-testing

本記事で構築する構成

下記の通り、本記事ではDNSSECを使わず、普通のDNS名前解決を成立させることを目的とする。

              ┌─────────────┐
              │ Parent DNS  │ 192.168.56.10/24
              │    BIND9    │ 権威ゾーン: lab.test
              └──────┬──────┘
                     │
            child.lab.test を委任
                     │
                     ▼
              ┌─────────────┐ 192.168.56.20/24
              │  Child DNS  │ 権威ゾーン: child.lab.test
              │    BIND9    │       └─ www.child.lab.test → 192.168.56.100
              └─────────────┘
                     ▲
                     │ DNS問い合わせ
                     │
              ┌─────────────┐
              │  Resolver   │ 192.168.56.30/24
              │   Unbound   │
              └──────┬──────┘
                     ▲
                     │ DNS問い合わせ
              ┌─────────────┐
              │   Client    │ 192.168.56.40/24
              └─────────────┘

検証環境

仮想化ソフトウェア:Oracle VirtualBox
ゲストOS:Ubuntu Server 26.04.1 LTS(amd64)
権威DNS:BIND 9.20.24
フルリゾルバ:Unbound 1.24.2
DNS確認ツール:DiG 9.20.24
内部ネットワーク:192.168.56.0/24
検証ドメイン:lab.test / child.lab.test

構築

IP設定とシステムインストール

共通設定

IP設定

# IP情報確認(一部結果を抜粋)
$ ip addr

3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

#設定ファイルの確認
$ sudo cat /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    enp0s3:
      dhcp4: true
      dhcp6: true
      match:
        macaddress: mac
      set-name: enp0s3
  version: 2

#バックアップ
$ sudo cp /etc/netplan/00-installer-config.yaml \
/etc/netplan/00-installer-config.yaml.bak

#編集
$ sudo vim /etc/netplan/00-installer-config.yaml

# This is the network config written by 'subiquity'
network:
  ethernets:
    enp0s3:
      dhcp4: true
      dhcp6: true
      match:
        macaddress: mac
      set-name: enp0s3

    enp0s8:
      dhcp4: false
      addresses:
        - 192.168.56.10(20,30,40)/24

  version: 2

#構文チェック
$ sudo netplan generate

#接続チェック
$ sudo netplan try
Do you want to keep these settings?


Press ENTER before the timeout to accept the new configuration


Changes will revert in  xxx seconds
Configuration accepted.

#IP確認(一部結果を抜粋)
$ ip route
192.168.56.0/24 dev enp0s8 proto kernel scope link src 192.168.56.10

BIND(Parent DNS/Child DNS)のインストール

BINDと関連ツールのインストール

# システムのパッケージリストを更新
$ sudo apt update

# システムのインストール
$ sudo apt install bind9 bind9-utils dnsutils

# BINDのバージョンを確認
$ named -v
BIND 9.20.24-1ubuntu0.3-Ubuntu (Stable Release) <id:>

# サービスの状態を確認
$ systemctl status bind9
● named.service - BIND Domain Name Server
     Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; preset: enabled)
     Active: active (running) since Wed 2026-09-02 13:32:41 UTC; 10min ago

bind9 → DNSサーバー本体(named)
bind9-utils → BIND/DNSSEC管理用ツール
dnsutils → digなどのDNS調査ツール

Unbound(Resolver)のインストール

フルリゾルバーのインストール

# システムのパッケージリストを更新
$ sudo apt update
# システムのインストール
$ sudo apt install unbound dnsutils
# サービスの状態を確認
$ systemctl status unbound
● unbound.service - Unbound DNS server
     Loaded: loaded (/usr/lib/systemd/system/unbound.service; enabled; preset: enabled)
     Active: active (running) since Fri 2026-09-04 12:07:41 UTC; 1min 19s ago

dnsutils(Client)のインストール

DNS調査ツールのインストール

# システムのパッケージリストを更新
$ sudo apt update
# システムのインストール
$ sudo apt install dnsutils
# バージョン確認
$ dig -v
DiG 9.20.24-1ubuntu0.3-Ubuntu

DNS設定

Parent DNS の基本設定

# BINDの設定ファイルを確認
$ ls -l /etc/bind/
total 20
-rw-r--r-- 1 xxxx yyyy 455 Jul 10 20:52 named.conf
-rw-r--r-- 1 xxxx yyyy  42 Jul 10 20:52 named.conf.local
-rw-r--r-- 1 xxxx yyyy  43 Jul 10 20:52 named.conf.options
-rw-r--r-- 1 xxxx yyyy 116 Jul 10 20:52 named.conf.root-hints
-rw-r----- 1 xxxx yyyy 100 Sep  2 13:32 rndc.key

# named.conf.local のバックアップ
sudo cp /etc/bind/named.conf.local /etc/bind/named.conf.local.bak

# ゾーンを定義
# 「lab.test について聞かれたら、/etc/bind/db.lab.test を見て答えます」という設定を記載
$ sudo vim /etc/bind/named.conf.local

zone "lab.test" {
    type primary;
    file "/etc/bind/db.lab.test";
};

# Parentのゾーンファイルを作成
$ sudo vim /etc/bind/db.lab.test

$TTL 3600

@   IN  SOA ns dnsmaster (
        2026090401 ; Serial
        3600       ; Refresh
        900        ; Retry
        604800     ; Expire
        86400      ; Negative Cache TTL
)

    IN  NS  ns.lab.test.

ns  IN  A   192.168.56.10

# BIND全体の設定チェック
$ sudo named-checkconf

# ゾーンファイルをチェック
$ sudo named-checkzone lab.test /etc/bind/db.lab.test
zone lab.test/IN: loaded serial 2026090401
OK

# BINDを再読み込み
$ sudo systemctl reload bind9

# サービスの状態を確認
$ systemctl status bind9
● named.service - BIND Domain Name Server
     Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; preset: enabled)
     Active: active (running) since Fri 2026-09-04 12:25:10 UTC; 41min ago

# Parent自身に直接問い合わせる
$ dig @192.168.56.10 lab.test SOA

; <<>> DiG 9.20.24-1ubuntu0.3-Ubuntu <<>> @192.168.56.10 lab.test SOA
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12120  # エラーなし
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1  # aa = Authoritative Answer。権威回答であることを示す

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: a277f9c47bc5fcc9010000006a9ac27bfc5d5131662f9b64 (good)
;; QUESTION SECTION:
;lab.test.                      IN      SOA  # lab.test.のSOAレコード要求

;; ANSWER SECTION:
lab.test.               3600    IN      SOA     ns.lab.test. dnsmaster.lab.test. 2026090401 3600 900 604800 86400  # 設定したSOAレコードが反映されている

;; Query time: 0 msec
;; SERVER: 192.168.56.10#53(192.168.56.10) (UDP)
;; WHEN: Fri Sep 04 13:07:07 UTC 2026
;; MSG SIZE  rcvd: 114

$ dig @192.168.56.10 lab.test NS

; <<>> DiG 9.20.24-1ubuntu0.3-Ubuntu <<>> @192.168.56.10 lab.test NS
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63569
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 0a6d1db6342fb2d1010000006a9ac29ddae1218c4b0305b2 (good)
;; QUESTION SECTION:
;lab.test.                      IN      NS  # lab.test.のNSレコード要求

;; ANSWER SECTION:
lab.test.               3600    IN      NS      ns.lab.test.  # 設定したNSレコードが反映されている

;; ADDITIONAL SECTION:
ns.lab.test.            3600    IN      A       192.168.56.10  # 追加情報 → ちなみに ns.lab.test. のIPアドレスは 192.168.56.10

;; Query time: 0 msec  # 同じVMから同じラボ内のDNSへ問い合わせているので非常に高速
;; SERVER: 192.168.56.10#53(192.168.56.10) (UDP)  # 意図したParent BINDに問い合わせられている
;; WHEN: Fri Sep 04 13:07:41 UTC 2026
;; MSG SIZE  rcvd: 98

Child DNS の基本設定

# BINDの設定ファイルを確認
$ ls -l /etc/bind/
total 20
-rw-r--r-- 1 xxxx yyyy 455 Jul 10 20:52 named.conf
-rw-r--r-- 1 xxxx yyyy  42 Jul 10 20:52 named.conf.local
-rw-r--r-- 1 xxxx yyyy  43 Jul 10 20:52 named.conf.options
-rw-r--r-- 1 xxxx yyyy 116 Jul 10 20:52 named.conf.root-hints
-rw-r----- 1 xxxx yyyy 100 Sep  2 13:32 rndc.key

# named.conf.local のバックアップ
sudo cp /etc/bind/named.conf.local /etc/bind/named.conf.local.bak

# ゾーンを定義
# 「child.lab.test について聞かれたら、/etc/bind/db.child.lab.test を見て答えます」という設定を記載
$ sudo vim /etc/bind/named.conf.local

zone "child.lab.test" {
    type primary;
    file "/etc/bind/db.child.lab.test";
};

# Childのゾーンファイルを作成
$ sudo vim /etc/bind/db.child.lab.test

$TTL 3600

@   IN SOA ns dnsmaster (
        2026090401 ; Serial
        3600       ; Refresh
        900        ; Retry
        604800     ; Expire
        86400      ; Negative Cache TTL
)

    IN NS ns

ns  IN A 192.168.56.20
www IN A 192.168.56.100

# BIND全体の設定チェック
$ sudo named-checkconf

# ゾーンファイルをチェック
$ sudo named-checkzone child.lab.test /etc/bind/db.child.lab.test
zone child.lab.test/IN: loaded serial 2026090401
OK

# BINDを再読み込み
$ sudo systemctl reload bind9

# サービスの状態を確認
$ systemctl status bind9
● named.service - BIND Domain Name Server
     Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; preset: enabled)
     Active: active (running) since Fri 2026-09-04 12:25:13 UTC; 1h 15min ago

# Child自身に直接問い合わせる
$ dig @192.168.56.20 child.lab.test SOA

; <<>> DiG 9.20.24-1ubuntu0.3-Ubuntu <<>> @192.168.56.20 child.lab.test SOA
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45719
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 2235b8f90298a6ac010000006a9aca9e4d064bf9ef5ff1fb (good)
;; QUESTION SECTION:
;child.lab.test.                        IN      SOA

;; ANSWER SECTION:
child.lab.test.         3600    IN      SOA     ns.child.lab.test. dnsmaster.child.lab.test. 2026090401 3600 900 604800 86400  # 設定したSOAレコードが反映されている

;; Query time: 0 msec
;; SERVER: 192.168.56.20#53(192.168.56.20) (UDP)
;; WHEN: Fri Sep 04 13:41:50 UTC 2026
;; MSG SIZE  rcvd: 120

$ dig @192.168.56.20 child.lab.test NS

; <<>> DiG 9.20.24-1ubuntu0.3-Ubuntu <<>> @192.168.56.20 child.lab.test NS
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22244
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 18cc501e70a95b5a010000006a9acaad689bc4f2bd82ac21 (good)
;; QUESTION SECTION:
;child.lab.test.                        IN      NS

;; ANSWER SECTION:
child.lab.test.         3600    IN      NS      ns.child.lab.test.  # 設定したNSレコードが反映されている

;; ADDITIONAL SECTION:
ns.child.lab.test.      3600    IN      A       192.168.56.20  # 追加情報 → ちなみに ns.child.lab.test. のIPアドレスは 192.168.56.20

;; Query time: 0 msec
;; SERVER: 192.168.56.20#53(192.168.56.20) (UDP)
;; WHEN: Fri Sep 04 13:42:05 UTC 2026
;; MSG SIZE  rcvd: 104

$ dig @192.168.56.20 www.child.lab.test A  # ここが ParentDNS と違う部分

; <<>> DiG 9.20.24-1ubuntu0.3-Ubuntu <<>> @192.168.56.20 www.child.lab.test A
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38021
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 572e7d93946f04eb010000006a9acbc2c6834dc08c91a8ae (good)
;; QUESTION SECTION:
;www.child.lab.test.            IN      A

;; ANSWER SECTION:
www.child.lab.test.     3600    IN      A       192.168.56.100  # 設定したwwwのAレコードが反映されている

;; Query time: 0 msec
;; SERVER: 192.168.56.20#53(192.168.56.20) (UDP)
;; WHEN: Fri Sep 04 13:46:42 UTC 2026
;; MSG SIZE  rcvd: 91

Parent DNS に child.lab.test の委任を設定

# ゾーンファイルをバックアップ
$ sudo cp /etc/bind/db.lab.test /etc/bind/db.lab.test.bak

$ sudo vim /etc/bind/db.lab.test        
2026090402 ; Serial        # ゾーンファイルのシリアルを更新
child       IN NS ns.child
ns.child    IN A  192.168.56.20  # ゾーンファイルの最下部に以下設定を追加

# BIND全体の設定チェック
$ sudo named-checkconf

# ゾーンファイルをチェック
$ sudo named-checkzone lab.test /etc/bind/db.lab.test
zone lab.test/IN: getaddrinfo(ns.child.lab.test) failed: Temporary failure in name resolution
zone lab.test/IN: loaded serial 2026090402
OK

# BINDを再読み込み
$ sudo systemctl reload bind9

# サービスの状態を確認
$ systemctl status bind9
● named.service - BIND Domain Name Server
     Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; preset: enabled)
     Active: active (running) since Fri 2026-09-04 12:25:10 UTC; 1h 40min ago

# Parent自身に直接問い合わせる(再帰問い合わせを要求する) → 再帰処理では名前解決に失敗しSERVFAILとなった
dig @192.168.56.10 child.lab.test NS
; <<>> DiG 9.20.24-1ubuntu0.3-Ubuntu <<>> @192.168.56.10 child.lab.test NS
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 19522  # SERVFAIL(サーバー側の異常で名前解決に失敗)
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: fe9a881e33cb98ad010000006a9ad0c464bcd0c3c80d2cfc (good)
;; QUESTION SECTION:
;child.lab.test.                        IN      NS

;; Query time: 3 msec
;; SERVER: 192.168.56.10#53(192.168.56.10) (UDP)
;; WHEN: Fri Sep 04 14:08:04 UTC 2026
;; MSG SIZE  rcvd: 71

# Parent自身に直接問い合わせる(再帰問い合わせを要求しない)
$ dig +norecurse @192.168.56.10 child.lab.test NS

; <<>> DiG 9.20.24-1ubuntu0.3-Ubuntu <<>> +norecurse @192.168.56.10 child.lab.test NS
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27945
;; flags: qr ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 2  ## aa = Authoritative Answer のフラグなしなので、権威回答ではなく参照応答

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 79d7c1aedd81ea0e010000006a9ad0ba20d4d76f47b1c251 (good)
;; QUESTION SECTION:
;child.lab.test.                        IN      NS

;; AUTHORITY SECTION:  # child.lab.test については ns.child.lab.test に聞いてください。と返答されている
child.lab.test.         3600    IN      NS      ns.child.lab.test.  # 設定したNSレコードが反映されている

;; ADDITIONAL SECTION:
ns.child.lab.test.      3600    IN      A       192.168.56.20  # 追加情報 → ちなみに ns.child.lab.test. のIPアドレスは 192.168.56.20(グルーレコード)

;; Query time: 5 msec
;; SERVER: 192.168.56.10#53(192.168.56.10) (UDP)
;; WHEN: Fri Sep 04 14:07:54 UTC 2026
;; MSG SIZE  rcvd: 104

$ dig +norecurse @192.168.56.10 www.child.lab.test A

; <<>> DiG 9.20.24-1ubuntu0.3-Ubuntu <<>> +norecurse @192.168.56.10 www.child.lab.test A
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7879
;; flags: qr ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: d24b4a0ee76a5063010000006a9ad5a7cc24a0022b2a437a (good)
;; QUESTION SECTION:
;www.child.lab.test.            IN      A

;; AUTHORITY SECTION:  # child.lab.test については ns.child.lab.test に聞いてください。と返答されている
child.lab.test.         3600    IN      NS      ns.child.lab.test.  # 設定したNSレコードが反映されている

;; ADDITIONAL SECTION:
ns.child.lab.test.      3600    IN      A       192.168.56.20 # 追加情報 → ちなみに ns.child.lab.test. のIPアドレスは 192.168.56.20(グルーレコード)。child.lab.test はChildDNSへ委任されているため、Parentは www.child.lab.test のAレコードを権威回答せず、委任先の情報を返す

;; Query time: 0 msec
;; SERVER: 192.168.56.10#53(192.168.56.10) (UDP)
;; WHEN: Fri Sep 04 14:28:55 UTC 2026
;; MSG SIZE  rcvd: 108

Resolver の設定

# 設定ファイルを確認
$ sudo cat /etc/unbound/unbound.conf
$ sudo find /etc/unbound -maxdepth 2 -type f -print

# ラボ用設定ファイルを新規作成
$ sudo vim /etc/unbound/unbound.conf.d/dns-lab.conf
server:
    interface: 192.168.56.30
    access-control: 192.168.56.0/24 allow

    local-zone: "test." transparent
    domain-insecure: "lab.test."

stub-zone:
    name: "lab.test."
    stub-addr: 192.168.56.10

# 構文チェック
$ sudo unbound-checkconf

# Unboundを再起動
$ sudo systemctl restart unbound

# サービスの状態を確認
$ systemctl status unbound
● unbound.service - Unbound DNS server
     Loaded: loaded (/usr/lib/systemd/system/unbound.service; enabled; preset: enabled)
     Active: active (running) since Tue 2026-09-08 13:27:42 UTC; 36s ago

$ dig @192.168.56.30 www.child.lab.test A

; <<>> DiG 9.20.24-1ubuntu0.3-Ubuntu <<>> @192.168.56.30 www.child.lab.test A
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62746
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;www.child.lab.test.            IN      A  # www.child.lab.test のAレコードを問い合わせ

;; ANSWER SECTION:
www.child.lab.test.     3600    IN      A       192.168.56.100  # 名前解決できている

;; Query time: 8 msec
;; SERVER: 192.168.56.30#53(192.168.56.30) (UDP)
;; WHEN: Tue Sep 08 13:36:29 UTC 2026
;; MSG SIZE  rcvd: 63

Client で名前解決ができるか確認

$ dig @192.168.56.30 www.child.lab.test A

; <<>> DiG 9.20.24-1ubuntu0.3-Ubuntu <<>> @192.168.56.30 www.child.lab.test A
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63459
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;www.child.lab.test.            IN      A  # www.child.lab.test のAレコードを問い合わせ

;; ANSWER SECTION:
www.child.lab.test.     3187    IN      A       192.168.56.100  # 名前解決できている

;; Query time: 3 msec
;; SERVER: 192.168.56.30#53(192.168.56.30) (UDP)
;; WHEN: Tue Sep 08 13:43:22 UTC 2026
;; MSG SIZE  rcvd: 63

おまけ

SERVFAIL エラーの検証

「Parent DNS に child.lab.test の委任を設定」で +norecurse(再帰問い合わせを要求しない)をつけないとSERVFAIL(サーバー側の異常で名前解決に失敗)となる原因を調査した。

検証

ターミナル1

# パケットキャプチャ(Parent DNS)
~$ sudo tcpdump -ni any port 53
tcpdump: WARNING: any: That device doesn't support promiscuous mode
(Promiscuous mode not supported on the "any" device)
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes
12:12:22.481102 lo    In  IP 192.168.56.10.45482 > 192.168.56.10.53: 40442 [1au] NS? child.lab.test. (55)
12:12:22.481720 lo    In  IP 192.168.56.10.53 > 192.168.56.10.45482: 40442 0/1/2 (104)
12:12:32.346678 lo    In  IP 192.168.56.10.37116 > 192.168.56.10.53: 65160+ [1au] NS? child.lab.test. (55)
12:12:32.347314 enp0s8 Out IP 192.168.56.10.33827 > 192.168.56.20.53: 15920 [1au] NS? child.lab.test. (55)
12:12:32.348661 enp0s8 In  IP 192.168.56.20.53 > 192.168.56.10.33827: 15920* 1/0/2 NS ns.child.lab.test. (104)
12:12:32.350616 lo    In  IP 192.168.56.10.53 > 192.168.56.10.37116: 65160 ServFail 0/0/1 (71)

ターミナル2

$ dig +norecurse @192.168.56.10 child.lab.test NS
$ dig @192.168.56.10 child.lab.test NS

検証結果

+norecurse で問い合わせたとき

12:12:22.481102 lo    In  IP 192.168.56.10.45482 > 192.168.56.10.53: 40442 [1au] NS? child.lab.test. (55)

が 問い合わせ。

  • Parent自身 → ParentのDNS(53番ポート)
  • 「child.lab.test のNSを教えてください」
  • +norecurseなので「他のDNSへ問い合わせに行かなくていいです」
12:12:22.481720 lo    In  IP 192.168.56.10.53 > 192.168.56.10.45482: 40442 0/1/2 (104)

が回答。

  • Parent DNS → Parent DNS(dig)
  • 0/1/2 = ANSWER 0件 / AUTHORITY 1件 / ADDITIONAL 2件

この 0/1/2 は、以前 dig で見た、

ANSWER: 0
AUTHORITY: 1
ADDITIONAL: 2

と同じもの。

このログから読み取れる全体の動きは下記。

dig
 │
 │「child.lab.testのNSは?」
 │「再帰しなくていいよ」
 ▼
Parent
 │
 │ 自分が持っている委任情報を見る
 │
 │「ns.child.lab.testに聞いて」
 ▼
dig

重要なのは、この通信にParent→Childの通信がないこと
これが +norecurse の動き。

+norecurse なし

12:12:32.346678 lo    In  IP 192.168.56.10.37116 > 192.168.56.10.53: 65160+ [1au] NS? child.lab.test. (55)

が問い合わせ。

  • Parent自身 → Parent DNS
  • 「child.lab.test のNSを教えてください」
  • 今回は再帰要求あり

+norecurse とよく似たログだが、65160+ の + がポイント。
tcpdumpのDNS表示では、この + はRD(Recursion Desired)が立っていることを示す。

※tcpdump 公式GitHubリポジトリを参照
https://github.com/the-tcpdump-group/tcpdump/blob/master/print-domain.c
else {
/* this is a request */
ND_PRINT("%u%s%s%s", GET_BE_U_2(np->id),
ns_ops[DNS_OPCODE(flags)],
DNS_RD(flags) ? "+" : "",
DNS_CD(flags) ? "%" : "");

12:12:32.347314 enp0s8 Out IP 192.168.56.10.33827 > 192.168.56.20.53: 15920 [1au] NS? child.lab.test. (55)

が Child DNS への問い合わせ。

  • Parent DNS → Child DNS
  • Parentが「child.lab.test のNSを教えてください」とChildへ問い合わせた
12:12:32.348661 enp0s8 In  IP 192.168.56.20.53 > 192.168.56.10.33827: 15920* 1/0/2 NS ns.child.lab.test. (104)

が Child DNS からの回答。

  • Child DNS → Parent DNS
  • 「child.lab.test のNSは ns.child.lab.test です」と回答
  • * はAA(Authoritative Answer)が立っていることを示す(上述のGitHubリポジトリを参照)
12:12:32.350616 lo    In  IP 192.168.56.10.53 > 192.168.56.10.37116: 65160 ServFail 0/0/1 (71)

が最終回答。

  • Parent DNS → Parent DNS(dig)
  • なぜか最終的に「名前解決に失敗しました(SERVFAIL)」と回答

このログから読み取れる全体の動きは下記。

dig
 │
 │ child.lab.test NS?
 │ RD=1「必要なら代わりに調べて」
 ▼
Parent
 │
 │ 委任情報を確認
 │
 ▼
Child
 │
 │「NSはns.child.lab.testです」
 │ AA=1
 ▼
Parent
 │
 │ ここまでは成功
 │
 ▼
dig

SERVFAIL(?)

tcpdump だけでは分からないので追加調査

# ジャーナル確認
journalctl -n 20
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving 'test/DS/IN': 199.7.91.13#53
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving './NS/IN': 199.7.91.13#53
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving 'test/DS/IN': 192.203.230.10#53
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving './NS/IN': 198.97.190.53#53
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving 'test/DS/IN': 192.112.36.4#53
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving './NS/IN': 192.203.230.10#53
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving 'test/DS/IN': 192.36.148.17#53
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving './NS/IN': 192.112.36.4#53
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving 'test/DS/IN': 193.0.14.129#53
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving './NS/IN': 192.36.148.17#53
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving 'test/DS/IN': 170.247.170.2#53
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving './NS/IN': 193.0.14.129#53
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving 'test/DS/IN': 192.33.4.12#53
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving './NS/IN': 170.247.170.2#53
Sep 08 12:55:33 dns-parent named[962]: network unreachable resolving './NS/IN': 192.33.4.12#53
Sep 08 12:55:33 dns-parent named[962]: broken trust chain resolving 'child.lab.test/NS/IN': 192.168.56.20#53
Sep 08 12:55:33 dns-parent named[962]: resolver priming query complete: failure
  • ルートDNSサーバーへの test/DS や ./NS の問い合わせが network unreachable となっている
  • broken trust chain resolving から信頼の連鎖を築けなかったことが判明

このログから読み取れる全体の動きは下記。

RD=1
 ↓
Parentが再帰処理開始
 ↓
自分の委任情報を利用
 ↓
192.168.56.20のChildへ問い合わせ
 ↓
Childが正常な権威回答
 ↓
Parentの再帰処理でDNSSEC検証を行おうとする
 ↓
test/DSなどを確認しようとする
 ↓
外部DNSへ到達できない
 ↓
broken trust chain
 ↓
SERVFAIL

結論

検証サーバーを外部ネットワークに接続していなかったため、Parent DNSがDNSSEC検証に必要な外部DNSへの問い合わせを完了できず、信頼の連鎖を構築できなかった。その結果、再帰問い合わせは SERVFAIL となった。

まとめ

今回は、Parent DNS、Child DNS、Unbound、Clientを構築し、DNSSECを使用しない通常のDNS名前解決が正常に行えることを確認した。
次回は、この環境にDNSSECを導入し、Parent DNSとChild DNSの署名、DSレコードの登録、UnboundへのTrust Anchor設定を行い、DNSSECによる信頼の連鎖を構築する。

よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

この記事を書いた人

勉強中のセキュリティエンジニアです。
初心者の目線で学んだことをまとめています。

コメント

コメントする

CAPTCHA


目次