iptables不允许我联系我的DNS名称服务器

我有以下iptables规则:

Chain INPUT (policy DROP) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:ssh ACCEPT tcp -- anywhere anywhere tcp dpt:http ACCEPT tcp -- anywhere anywhere tcp dpt:https ACCEPT tcp -- localhost.localdomain anywhere tcp dpt:mysql ACCEPT tcp -- anywhere anywhere tcp dpt:14443 ACCEPT tcp -- anywhere anywhere tcp dpt:ftp ACCEPT tcp -- anywhere anywhere tcp dpt:ftp-data ACCEPT tcp -- anywhere anywhere tcp dpt:xxxxxxx Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination 

当我closuresiptables时,我可以使用wget和所有其他命令。 当这些规则启用时,我无法连接到任何地址。 任何想法,为什么这将是?

您阻止了对DNS查询的响应 – 以及对HTTP TCP连接的响应。

在你的INPUT链中插入一条规则,以允许build立的连接和与build立的连接相关的stream量(如有关路由问题的ICMP信息)。

 iptables -I INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT