ITeye博客

CentOS7 搭建DNS服务后的iptables配置问题

Cash · 2020-04-09 16:01 · Unix/Linux · 开源软件 · Markdown

CentOS7搭建DNS服务后,客户端nslookup无法解析,发现端口被iptables阻止; 通过iptables -I INPUT -p udp -m multiport --dports 53 -j 命令添加; 通过service iptables save保存配置后,重启服务器仍不生效; 需要通过解除其开机自启动项,再添加其开机自启动项后解决;

停止服务 [root@localhost ~]# systemctl stop firewalld.service

禁止开机启动 [root@localhost ~]# systemctl disable firewalld.service Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

增加放行UDP53端口访问条目 [root@localhost ~]# iptables -I INPUT -p udp -m multiport --dports 53 -j ACCEPT

保存配置 [root@localhost ~]# service iptables save iptables: Saving firewall rules to /etc/sysconfig/iptables:[ 确定 ]

重启服务 [root@localhost ~]# systemctl restart iptables.service

开机自启动 [root@localhost ~]# systemctl enable iptables.service

重启服务器 [root@localhost ~]# reboot

使用iptables -nL --line-number命令查看防火墙状态 Chain INPUT (policy ACCEPT) num target prot opt source destination
1 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 multiport dports 53

此时客户机可以使用此DNS服务了!

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。