常見的dns開源軟件有很多召川,bind,dnsmasq,smartdns等等惑折,本文主要介紹比較容易上手的smartdns水孩。
安裝
環(huán)境是centos7
從github下載smartdns
https://github.com/pymumu/smartdns/releases
image.png
下載后上傳到服務(wù)器痕鳍,然后執(zhí)行如下命令
tar zxf smartdns.1.yyyy.MM.dd-REL.x86_64-linux-all.tar.gz
cd smartdns
chmod +x ./install
./install -i
配置
- 配置上游服務(wù)器
默認配置文件 /etc/smartdns/smartdns.conf
在smartdns.conf文件中配置上游服務(wù)器
上游dns
server 182.16.188.13
server 8.8.8.8
配置想要的域名
自定義域名
address /xxx.xxx.com/182.18.4.112
上述配置含義:xxx.xxx.com 映射到182.18.4.112
每條映射一行
每次增加域名后需要重啟服務(wù)级遭,所以該軟件只適用于局域網(wǎng)內(nèi)部開發(fā)測試使用疲憋。
啟動命令
systemctl enable smartdns
systemctl start smartdns
systemctl restart smartdns