針對擁有專線、固定 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.comyourdomain.com 時指定本機為授權 DNS/etc/named.confoptions {
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 記錄 |
root.hintsrndc 實現遠端重載配置、查看狀態,避免暴力 killallow-recursion 限制來源 IP,防止濫用本配置為基礎權威 DNS 架構,實際部署仍需依據安全稽核、效能調校與法規遵循進一步強化。