分页: 1 / 1

[已解决]iptables的问题

发表于 : 2016-03-22 15:10
achengmao

代码: 全选

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

不是iptables配置问题,而是锐速appex模块对网络数据包有影响,2者启动顺序问题

Re: iptables的问题

发表于 : 2016-03-22 17:57
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?

Re: iptables的问题

发表于 : 2016-03-22 20:51
achengmao
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?
我把一样的配置放到虚拟机上,发现虚拟机上能正常访问,重装了一下系统,结果好了.....

Re: iptables的问题

发表于 : 2016-03-22 21:20
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状态的么?

Re: iptables的问题

发表于 : 2016-03-22 21:32
achengmao
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

Re: iptables的问题

发表于 : 2016-03-23 5:42
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

Re: iptables的问题

发表于 : 2016-03-23 13:18
achengmao
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
这条我加了,但是没效果

Re: iptables的问题

发表于 : 2016-03-23 17:59
poloshiao
这条我加了,但是没效果
你是希望達到什麼效果 ?