0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

DNS、CDNサービスの詳細解説(六)

Last updated at Posted at 2025-04-08

DNSサブドメイン委任とフォワードサーバーの実装ガイド

1. サブドメイン委任の実装

1.1 サブドメイン委任の基本概念

サブドメイン委任により、大規模なDNSインフラを分散管理可能にします。
主な特徴

  • 権限委譲による管理負荷分散
  • 地理的/組織的なドメイン分割
  • トラフィックの最適化

1.2 親ドメイン側の設定

// named.confのゾーン定義
zone "wang.org" {
    type master;
    file "wang.org.zone";
    allow-transfer { 10.0.0.18; };
};

// ゾーンファイルへの委任設定
$TTL 1D
@   IN SOA  ns1.wang.org. admin.wang.org. (
    2023082101 ; Serial
    3H         ; Refresh
    15M        ; Retry
    1W         ; Expire
    1D )       ; Minimum

    NS   ns1.wang.org.
shanghai NS ns1.shanghai.wang.org.
ns1.shanghai A 10.0.0.18

重要なポイント

  1. 親ゾーンに子DNSのNSレコードを追加
  2. グルーレコード(Aレコード)を併記
  3. セキュリティのためゾーン転送を制限

1.3 子ドメイン側の設定

// 子ドメインのゾーン定義
zone "shanghai.wang.org" {
    type master;
    file "shanghai.zone";
};

// サブドメインゾーンファイル
$TTL 1D
@   IN SOA  ns1.shanghai.wang.org. admin.shanghai.wang.org. (
    2023082101 
    3H        
    15M       
    1W        
    1D )      
    NS  ns1
ns1  A  10.0.0.18
www  A  10.0.0.17

1.4 動作検証手順

# 委任の確認
dig +norec NS shanghai.wang.org @10.0.0.8

# 実際の名前解決テスト
dig www.shanghai.wang.org @10.0.0.18

2. DNSフォワードサーバーの実装

2.1 グローバルフォワード設定

options {
    forward first;
    forwarders { 10.0.0.18; };
    dnssec-enable no;
    dnssec-validation no;
};

動作モード比較

モード 動作 用途
first フォワード失敗後ルートサーバーに問合せ フォールバック必要
only フォワードのみ依存 完全依存環境

2.2 特定ゾーン向けフォワード

zone "example.com" {
    type forward;
    forward first;
    forwarders { 192.168.1.10; };
};

2.3 キャッシュサーバー設定例

// named.conf設定
options {
    directory "/var/named";
    recursion yes;
    allow-query { any; };
    forwarders {
        8.8.8.8;
        8.8.4.4;
    };
    forward only;
    dnssec-validation no;
};

3. パフォーマンスチューニング

3.1 キャッシュ設定最適化

options {
    max-cache-size 512M;
    max-cache-ttl 3600;  // 1時間
    min-cache-ttl 300;   // 5分
    cleaning-interval 60;// 1分毎の掃除
};

3.2 リソース制限設定

options {
    max-recursive-queries 1000;  // 同時再帰問合せ数
    recursive-clients 5000;      // 同時接続数
    coresize unlimited;          // メモリ制限解除
};

4. セキュリティ強化策

4.1 アクセス制御リスト(ACL)

acl "trusted" {
    10.0.0.0/24;
    192.168.1.0/28;
};

options {
    allow-query { trusted; };
    allow-recursion { trusted; };
    allow-transfer { none; };
};

4.2 TSIG認証によるゾーン転送

# 鍵生成
dnssec-keygen -a HMAC-SHA512 -b 512 -n HOST zone-transfer

# 設定ファイル追記
key "zone-transfer" {
    algorithm hmac-sha512;
    secret "xxxxxxxxxxxxxxxxxxxx==";
};

zone "example.com" {
    type master;
    file "example.com.zone";
    allow-transfer { key zone-transfer; };
};

5. モニタリングとログ管理

5.1 統計情報の取得

rndc stats
cat /var/named/data/named_stats.txt

5.2 ログ設定のカスタマイズ

logging {
    channel query_log {
        file "/var/log/named/queries.log" versions 5 size 50m;
        severity debug 3;
        print-time yes;
    };
    category queries { query_log; };
};
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?