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. スマートDNSとGSLBの基本概念

1.1 グローバルサーバーロードバランシング(GSLB)

地理的に分散したサーバー群へ最適なルーティングを行う技術
主な特徴

  • ユーザーの位置情報に基づいた最適サーバー選択
  • レイテンシの最小化
  • 障害発生時の自動フェイルオーバー

1.2 CDNの動作原理

image.png

  1. ユーザーがDNSにクエリ
  2. CNAMEレコードでCDNプロバイダにリダイレクト
  3. 最適エッジサーバーを選択
  4. コンテンツをキャッシュまたはオリジンサーバーから取得

2. BINDの高度な機能

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

acl internal-net {
    10.0.0.0/24;
    172.16.0.0/16;
};

主な用途

  • クエリ許可リストの定義
  • ゾーン転送の制御
  • ビューによる条件分岐

2.2 ビュー機能の基本構成

view "view-name" {
    match-clients { acl-name; };
    recursion yes;
    zone "example.com" {
        type master;
        file "example.com.zone.internal";
    };
};

3. 実践的な設定例:拠点別ルーティング

3.1 ネットワークトポロジー

拠点 ネットワーク 対象Webサーバー
東京 10.0.0.0/24 10.0.0.7
大阪 172.16.0.0/16 172.16.0.7

3.2 メイン設定ファイル

acl tokyo-net { 10.0.0.0/24; };
acl osaka-net { 172.16.0.0/16; };

view "tokyo-view" {
    match-clients { tokyo-net; };
    zone "example.com" {
        type master;
        file "example.com.zone.tokyo";
    };
};

view "osaka-view" {
    match-clients { osaka-net; };
    zone "example.com" {
        type master;
        file "example.com.zone.osaka";
    };
};

3.3 ゾーンファイル例(東京)

$TTL 1D
@   IN SOA  ns1.example.com. admin.example.com. (
    2023082101
    3H
    15M
    1W
    1D )
    NS  ns1
www IN A 10.0.0.7

3.4 動作検証

# 東京拠点からのクエリ
dig @dns-server www.example.com +short
# 期待結果: 10.0.0.7

# 大阪拠点からのクエリ
dig @dns-server www.example.com +short
# 期待結果: 172.16.0.7

4. 高度な設定テクニック

4.1 フェイルオーバー構成

view "backup-view" {
    match-clients { !tokyo-net; !osaka-net; };
    zone "example.com" {
        type forward;
        forwarders { 8.8.8.8; };
    };
};

4.2 ロードバランシング

www IN A 10.0.0.71
www IN A 10.0.0.72
www IN A 10.0.0.73

5. 重要注意事項

  1. ビューの順序管理
    マッチングは上から順に行われるため、より具体的な条件を上位に配置

  2. 再帰問い合わせの制限
    適切なACLでrecursionを制限し、DNS増幅攻撃を防止

  3. ログ管理の強化
    ビュー別にログを分割し、監視を容易に

logging {
    channel tokyo-log {
        file "/var/log/named/tokyo.log";
        severity debug 3;
    };
    channel osaka-log {
        file "/var/log/named/osaka.log";
        severity debug 3;
    };
    category queries {
        tokyo-log; 
        osaka-log;
    };
};

6. パフォーマンス最適化

6.1 キャッシュチューニング

options {
    max-cache-size 1G;
    max-cache-ttl 3600;  // 1時間
    min-cache-ttl 300;   // 5分
};

6.2 スレッドプール設定

options {
    listen-on port 53 { any; };
    coresize default;
    max-recursive-queries 5000;
    recursive-clients 10000;
};

7. セキュリティ強化策

7.1 DNSSECの実装

dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;

7.2 レスポンスレートリミッティング

rate-limit {
    responses-per-second 100;
    window 15;
};
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?