[已解决]iptables的问题

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
achengmao
帖子: 11
注册时间: 2015-10-28 15:18
系统: Archlinux

[已解决]iptables的问题

#1

帖子 achengmao » 2016-03-22 15:10

代码: 全选

iptables -P INPUT DROP 
iptables -A INPUT -m state --state ESTABLISHED,RELATED  -p all -j ACCEPT
发现wget无法访问web服务器80端口了,web服务器发送回来的数据包难道不是ESTABLISHED状态的么?

不是iptables配置问题,而是锐速appex模块对网络数据包有影响,2者启动顺序问题
上次由 achengmao 在 2016-12-30 17:21,总共编辑 1 次。
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: iptables的问题

#2

帖子 poloshiao » 2016-03-22 17:57

1. 參閱
1-1. http://manpages.ubuntu.com/manpages/xen ... les.8.html
1-2. https://help.ubuntu.com/community/IptablesHowTo
1-3. https://www.frozentux.net/iptables-tuto ... orial.html
1-4. http://www.netfilter.org/documentation/ ... HOWTO.html
web服务器发送回来的数据包难道不是ESTABLISHED状态的么?
2. 送回來in both directions 不符合
2-1. http://serverfault.com/questions/371316 ... ckets?rq=1
iptables: difference between NEW, ESTABLISHED and RELATED packets
ESTABLISHED -- meaning that the packet is associated with a connection which has seen packets in both directions,
2-2. http://serverfault.com/questions/762604 ... shed-state
Iptables: Difference between RELATED and ESTABLISHED state?
achengmao
帖子: 11
注册时间: 2015-10-28 15:18
系统: Archlinux

Re: iptables的问题

#3

帖子 achengmao » 2016-03-22 20:51

poloshiao 写了:1. 參閱
1-1. http://manpages.ubuntu.com/manpages/xen ... les.8.html
1-2. https://help.ubuntu.com/community/IptablesHowTo
1-3. https://www.frozentux.net/iptables-tuto ... orial.html
1-4. http://www.netfilter.org/documentation/ ... HOWTO.html
web服务器发送回来的数据包难道不是ESTABLISHED状态的么?
2. 送回來in both directions 不符合
2-1. http://serverfault.com/questions/371316 ... ckets?rq=1
iptables: difference between NEW, ESTABLISHED and RELATED packets
ESTABLISHED -- meaning that the packet is associated with a connection which has seen packets in both directions,
2-2. http://serverfault.com/questions/762604 ... shed-state
Iptables: Difference between RELATED and ESTABLISHED state?
我把一样的配置放到虚拟机上,发现虚拟机上能正常访问,重装了一下系统,结果好了.....
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: iptables的问题

#4

帖子 poloshiao » 2016-03-22 21:20

发现wget无法访问web服务器80端口了
重装了一下系统,结果好了.....
http://superuser.com/a/695952
the reason why wget is failing is that you have made no allowance for DNS, thus where is no name resolution on your system: you are blocking all such requests.
前面所說的 wget 失敗 可能原因之一是 無法獲得 DNS 通過

意思是
wget 失敗 跟 ESTABLISHED 状态 不一定存在因果關係
发现wget无法访问web服务器80端口了,web服务器发送回来的数据包难道不是ESTABLISHED状态的么?
achengmao
帖子: 11
注册时间: 2015-10-28 15:18
系统: Archlinux

Re: iptables的问题

#5

帖子 achengmao » 2016-03-22 21:32

poloshiao 写了:
发现wget无法访问web服务器80端口了
重装了一下系统,结果好了.....
http://superuser.com/a/695952
the reason why wget is failing is that you have made no allowance for DNS, thus where is no name resolution on your system: you are blocking all such requests.
前面所說的 wget 失敗 可能原因之一是 無法獲得 DNS 通過

意思是
wget 失敗 跟 ESTABLISHED 状态 不一定存在因果關係
发现wget无法访问web服务器80端口了,web服务器发送回来的数据包难道不是ESTABLISHED状态的么?
DNS的可能性我用ip方式排除了.我的理解是vps用wget获取web数据(80或者443),那么vps应该会发出一个带NEW状态的包给目标web服务器,我的OUTPUT是全部ACCEPT的,所以这个包应该是能发送到web服务器的,而web服务器应该会返回带ESTABLISHED的数据包,应该不会被vps的防火墙给拦住. 这样理解不知道有没有问题 :em06
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: iptables的问题

#6

帖子 poloshiao » 2016-03-23 5:42

我的理解是vps用wget获取web数据(80或者443),那么vps应该会发出一个带NEW状态的包给目标web服务器,我的OUTPUT是全部ACCEPT的,所以这个包应该是能发送到web服务器的,而web服务器应该会返回带ESTABLISHED的数据包,应该不会被vps的防火墙给拦住.
看看 這一段 有沒有幫助
http://superuser.com/questions/695887/i ... 952#695952
wget connects to port 80 on the other end but gets a random port number on our end.

add this and see if it does anything.

代码: 全选

iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
achengmao
帖子: 11
注册时间: 2015-10-28 15:18
系统: Archlinux

Re: iptables的问题

#7

帖子 achengmao » 2016-03-23 13:18

poloshiao 写了:
我的理解是vps用wget获取web数据(80或者443),那么vps应该会发出一个带NEW状态的包给目标web服务器,我的OUTPUT是全部ACCEPT的,所以这个包应该是能发送到web服务器的,而web服务器应该会返回带ESTABLISHED的数据包,应该不会被vps的防火墙给拦住.
看看 這一段 有沒有幫助
http://superuser.com/questions/695887/i ... 952#695952
wget connects to port 80 on the other end but gets a random port number on our end.

add this and see if it does anything.

代码: 全选

iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
这条我加了,但是没效果
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: iptables的问题

#8

帖子 poloshiao » 2016-03-23 17:59

这条我加了,但是没效果
你是希望達到什麼效果 ?
回复