這是本文件的舊版!
在 Alpine Linux 3 底下安裝 Bind 當 DNS
- 採用 PVE 內提供的 alpine-3.14 (2.5MB) 建立 CT
- 預計安裝與配置:
- CPU:1vcore / RAM:512MB / Root Disk:8GB
- 啟動主機的 IP 網段 10.20.0.0/24
- 允許本機與 10.0.0.0/8 來源詢問任何 Domain Name
- 上游 DNS : 1.1.1.1
安裝與設定 BIND
- 安裝 BIND
apk add bind
- 設定 /etc/bind/named.conf
options { directory "/var/bind"; pid-file "/var/run/named/named.pid"; listen-on { 127.0.0.1; 10.20.0.0/24; }; allow-query { localhost; 0.0.0.0/0; }; recursion yes; max-cache-size 218M; allow-recursion { 127.0.0.1/32; 10.0.0.0/8; }; forwarders { 1.1.1.1; }; };
- 驗證設定是否沒問題
named-checkconf
- 設定開機啟動與啟動 DNS 服務
rc-update add named rc-service named start
- 啟動時如果出現以下的異常訊息
: Jul 8 07:47:30 ct-dns daemon.info named[537]: none:100: 'max-cache-size 90%' - setting to 173990MB (out of 193322MB) Jul 8 07:47:33 ct-dns daemon.err /etc/init.d/named[535]: start-stop-daemon: failed to start `/usr/sbin/named' Jul 8 07:47:33 ct-dns daemon.err /etc/init.d/named[397]: ERROR: named failed to start
- 可以在 /etc/bind/named.conf 內強制設定 max-cache-size 來解決, Exp:
: max-cache-size 218M; :