最近在评估 SmartDNS 在 Ubuntu Server 系统上面的运行效果,就在安装好 SmartDNS ,做好基本配置之后,执行“sudo systemctl enable smartdns”和“sudo systemctl start smartdns”命令启动 SmartDNS,但是无法正常启动,有如下提示:

执行命令:journalctl -xeu smartdns.service ,可以看到有一条信息:run daemon failed, please check log at /var/log/smartdns/smartdns.log 提示运行守护进程失败,并提示可以到 /var/log/smartdns/smartdns.log 查看相关的日志。

按系统提示打开日志文件查看,里面有很多这样的提示:“bind service []:53 failed, Address already in use”、“create server socket failed.”,看样子,感觉是在提示 DNS 端口(端口号53)被占用了。

经过了解,在 Ubuntu Server 下面,系统自带的解析服务 systemd-resolved 默认会占用53端口,与 SmartDNS 冲突,因此在搭建 SmartDNS 系统之后,需要关闭 systemd-resolved 服务:
sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolved

执行以后,再重新启动 SmartDNS ,如果其它配置没有问题的话,应该就能启动成功了。