安装 dnsmasq 的步骤如下
安装 dnsmasq
在 Ubuntu 系统中安装 dnsmasq:
sudo apt-get update sudo apt-get install dnsmasq
启动并设置开机启动
启动 dnsmasq 服务:
sudo systemctl start dnsmasq sudo systemctl enable dnsmasq
配置 dnsmasq
编辑配置文件:
sudo nano /etc/dnsmasq.conf
interface=eth nameserver=127...1
如果需要为特定域名指定解析:
domain=example.com
应用配置
重启 dnsmasq 服务:
sudo systemctl restart dnsmasq
或者重载配置文件:
sudo systemctl reload dnsmasq
测试配置
测试 DNS 配置:
nslookup localhost
验证 DHCP 配置(可选)
如果需要设置 DHCP,编辑配置文件并添加相关选项:
dhcp-range=192.168.1./24,192.168.1.255
然后重启服务并测试 DHCP 是否正常工作:
sudo systemctl restart dnsmasq
查看日志
检查服务状态:
sudo systemctl status dnsmasq
查看日志:
tail -f /var/log/messages
故障排除
如果出现错误,检查网络接口名是否正确,并确保网络设置无误。
通过以上步骤,你应该能够成功安装并配置 dnsmasq。

@版权声明
转载原创文章请注明转载自原子VPN|多平台网络连接与线路优化工具,支持节点切换、网络测速及电脑手机端使用,满足不同网络环境下的连接需求,网站地址:https://yuanziapp.com.cn/