Unbound實現dns高速緩存
1: 檢測Hostname 和 IP
# hostnamectl
# ip addr show | grep inet
Step 2: 安裝和配置 Unbound
# yum update -y
# yum install unbound -y
Step 3 備份複製文件
# cp /etc/unbound/unbound.conf /etc/unbound/unbound.conf.original
Step 4 編輯 ‘unbound.conf‘ 配置文件
# vim /etc/unbound/unbound.conf
以下爲本機使用
Interface 192.168.0.50
do-ip4: yes
do-udp: yes
do-tcp: yes
logfile: /var/log/unbound
hide-identity: yes
hide-version: yes
Access Control
注意:可以用allow_snoop使用一些額外的參數,如dig和它支持的遞歸和非遞歸。
domain-insecure: "tecmintlocal.com
forward-zone:
name: "."
forward-addr: 8.8.8.8
forward-addr: 8.8.4.4
最後保存並推出,使用wq!
修改文件
# unbound-checkconf /etc/unbound/unbound.conf
5. 安全開始服務
# systemctl start unbound.service
# sudo systemctl enable unbound.service
6: 測試本地 DNS Cache 使用‘drill‘命令:
drill india.com @192.168.0.50
7. 設置防火牆
# firewall-cmd --add-service=dns
# firewall-cmd --add-service=dns --permanent
8.獲得當前服務狀態
# unbound-control status
9. 跳轉 DNS cache 到一個文本文件.
# unbound-control dump_cache > /tmp/DNS_cache.txt
10. 恢復你的跳轉文件
# unbound-control dump_cache < /tmp/DNS_cache.txt
11.查找DNS信息
# unbound-control lookup google.com
18. 使用 flush 查看以下記錄 A, AAA, NS, SO, CNAME, MX, PTR 等.使用 flush_zone 移除所有信息.
# unbound-control flush www.digitalocean.com
# unbound-control flush_zone tecmintlocal.com
19.檢查當前 DNS Forwards
20. 使用centos6作爲客戶端,unbound DNS 服務端 IP爲:92.168.0.100;以下客戶端
Primary DNS : 192.168.0.50
Secondary DNS : 192.168.0.50
OK –> Save&Quit –> Quit.
21,增加主和輔dns ip 重新開始你的網絡
# /etc/init.d/network restart
22.驗證unbound DNS server服務
# elinks aol.com
# dig aol.com