Iptablesexception不起作用

我想用iptables设置一个防火墙,但它阻止了我不想阻塞的东西:(

添加我的例外之后,执行以下操作:
iptables -A INPUT -j DROP

我无法运行:
curlwww.whatismyip.com/automation/n09230945.asp
curlwww.whatismyip.com

我添加了whatisyip.com whois列出的所有ips和nameservers:

iptables -A INPUT -s 72.233.195 -j ACCEPT
iptables -A INPUT -s 72.233.195 -j ACCEPT
iptables -A INPUT -s 72.233.195 -j ACCEPT
iptables -A INPUT -s 72.233.195 -j ACCEPT
iptables -A INPUT -s 72.233.195 -j ACCEPT
iptables -A INPUT -s 72.233.195 -j ACCEPT

find: http : //cqcounter.com/whois/

有些事情要检查:

  • 你是否阻止DNS? 只要解除whatismyip.com的名称服务器是不够的; 要找出www.whatismyip.com使用的是什么名字服务器,您的机器至less需要经过一个名称服务器。
  • 您的OUTPUT政策中的任何内容是否阻止您访问该网站?

另外,为了debugging,我build议你在每个-j DROP前立即加上-j LOG; 这样,你可以查看系统日志,看看什么是下降。

我build议使用iptables 状态检查 。 通过添加这个规则

iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT 

您所调用页面的DNS服务器和Web服务器可以向您发送对您请求的响应。

因为你必须在OUTPUT链上允许DNS和HTTP请求。

以下是www.whatismytrip.com的IP地址

72.233.89.198 72.233.89.199 72.233.89.200

1)如“tetromino”build议,请检查您的DNS设置。 看看名字是否得到解决。

2)您正在使用-A选项在INPUT链的末尾添加规则。 使用iptables -L检查默认的全部删除规则是最后一个。

3)你将不得不在OUTPUT链中添加规则,对于所有解决的IP。

iptables -A OUTPUT -d 72.233.89.198 -j ACCEPT