Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> 電腦軟體教學 >> 伺服器技術 >> DNS 伺服器

Linux 專線環境下架設 DNS 伺服器實作筆記

編輯:DNS 伺服器

針對擁有專線、固定 IP 區段(如 16 個 C Class IP)並已向 CNNIC 註冊網域的企業,本文記錄在 Red Hat Linux 5.2 上以 BIND 8.x 架設同時兼具防火牆角色的權威 DNS 伺服器完整配置過程。

環境與規劃

  • 雙網卡:eth0(外網,公網 IP 202.a.b.c)、eth1(內網,192.168.11.5)
  • 主機名:dns.yourdomain.com
  • 軟體:Red Hat Linux 5.2 附贈 BIND 8.x
  • 向 CNNIC 註冊網域 yourdomain.com 時指定本機為授權 DNS

核心配置檔 /etc/named.conf

options {
  directory "/var/named";
  forward first;
  forwarders { 202.96.199.133; };  // ChinaNet DNS (ns.sta.net.cn)
};

zone "." {
  type hint;
  file "root.hints";
};

zone "0.0.127.in-addr.arpa" {
  type master;
  file "127.0.0";
};

zone "11.168.192.in-addr.arpa" {
  type master;
  file "192.168.11";
};

zone "yourdomain.com" {
  notify no;
  type master;
  file "yourdomain.com";
};

關鍵區域檔案說明

檔案用途備註
root.hints根伺服器位址從 ftp://ftp.internic.net/domain/named.ca 下載,每月更新
127.0.0本機回環反解設定後幾乎不需修改
192.168.11內網段反解記錄內部伺服器 PTR
yourdomain.com正向解析區域包含 www、mail、ftp 等 A/CNAME/MX 記錄

進階維護建議

  • 撰寫 Shell 腳本自動定期下載更新 root.hints
  • 配合 rndc 實現遠端重載配置、查看狀態,避免暴力 kill
  • 若需對外提供遞迴查詢,請謹慎設定 allow-recursion 限制來源 IP,防止濫用
  • 建立 Slave DNS 於異地機房,確保服務高可用性

本配置為基礎權威 DNS 架構,實際部署仍需依據安全稽核、效能調校與法規遵循進一步強化。

Copyright © Windows教程網 All Rights Reserved