19 iptables
我是服务器方面的新手,所以请原谅我的谦虚问题:-)
有人为我开发了一个充当网络服务器的 Python 应用程序。这个 TCP 应用程序需要监听 8080 端口。
[root@blabla jll]# netstat -tanpu | grep ":8080"
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 18209/python
Run Code Online (Sandbox Code Playgroud)
我的服务器防火墙好像没有打开8080。要打开它,我尝试像这样修改 iptables 规则:
/sbin/iptables -A RH-Firewall-1-INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)
但是我在http://my.server.name:8080仍然没有任何东西。
(我什至不确定“RH-Firewall-1-INPUT”或“INPUT”)
我现在能做什么 ?这些事情有什么一般程序吗?
我给你以下有用的信息:
/sbin/iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
49 3388 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
25M 3736M RH-Firewall-1-INPUT all -- * * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT 43M packets, 41G bytes)
pkts bytes target prot opt in out source destination
Chain RH-Firewall-1-INPUT (1 references)
pkts bytes target prot opt in out source destination
121K 15M ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
97773 8078K ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 255
0 0 ACCEPT esp -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT ah -- * * 0.0.0.0/0 0.0.0.0/0
17 2509 ACCEPT udp -- * * 0.0.0.0/0 224.0.0.251 udp dpt:5353
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:631
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:631
24M 3682M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
26069 1319K ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
3806 204K ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:443
563K 30M REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Run Code Online (Sandbox Code Playgroud)
和 :
/sbin/iptables -nvL -t nat
Chain PREROUTING (policy ACCEPT 168K packets, 15M bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 4200K packets, 252M bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 4200K packets, 252M bytes)
pkts bytes target prot opt in out source destination
Run Code Online (Sandbox Code Playgroud)
den*_*ane 33
除了iptables -nvL
, iptables -nvL -t nat
and的输出iptables -nVL -t mangle
,这在这种情况下很有用,这里有一个可能有效的快速方法:
iptables -I INPUT 1 -i eth0 -p tcp --dport 8080 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
107726 次 |
最近记录: |