论坛风格切换切换到宽版
  • 2079阅读
  • 9回复

[问题求助][RedHat] 配置iptables出了问题 [复制链接]

上一主题 下一主题
离线ygzhd.
 
发帖
1968
C币
-236010
威望
330
贡献值
6
银元
0
铜钱
4280
人人网人气币
0
只看楼主 倒序阅读 使用道具 楼主  发表于: 2009-05-01
OS:RHEL3
情况说明:为在防火墙上打开50000端口,执行了以下操作。但是在执行如下操作后,端口是打开了.(即通过客户端访问了),但是原有的防火墙规则都消失了(即iptab.les -L什么也看不到了),.不知道是哪块遗漏了(即使在reboot后也是一样的)。望哪位.指点一下。.

[root@mydb r.oot]# .iptables -L    美容
Cha.in .INPUT (policy ACCEPT)[成人用品]
target     prot opt source    .   .        destination电影
RH-Firewall-.1-INPUT  all  --  any.where             anywhere             汽车

C.hain. FORWARD (policy ACCEPT)          婚庆
target     prot opt source   .            desti.nation(        游戏          )
RH-Fir.ewall-1-INPUT  all  --  anywhere             any.where           鲜花

C.hain OU.TPUT (policy ACCEPT)健康
target     .prot opt source    .           destination.

Cha.in RH-Firewall-1-INPUT. (2 references)--- 印刷
target.     prot opt source.               destination.
ACCEPT     all. . --  anywhere             anywhere(广告)
ACCEPT     icmp --  anywhere             anywhere    .       icmp. any学习
ACCE.PT  .   ipv6-crypt--  anywhere             anywhere    健康
ACCEPT     ipv.6-auth--  anywhere             .anywhere学习
ACCEPT     all  --  anywhere     .        anywhere           state RELAT.ED,ESTAB.L服务器
ISHED
ACCEPT     tcp  --  anywhe.re             .anywhere           sta.te NEW tcp dpt:te.
lnet
ACCEPT  .   tcp  .--  anywhere  .           anywhere           state NEW tcp dpt:ft.
p
REJECT     a.ll  --  anywhere             anywhere.        .   reject-with icmp-hos--- 印刷
t-prohibited
[root@mydb root]# /etc/rc..d./init.d/iptables save(        游戏          )
Savi.ng firewall rules to /etc/sysconfig/i.ptables:   确定  ].
[root@mydb root]# iptables -A INPUT -p tcp -.-dport 50000 -j .ACCEPT教育
[root@mydb .root]# /etc/rc.d/init.d/iptab.les save.
Saving firewall rul.es to /etc/sysconfig/iptables: .  确定  ]             汽车
[root@mydb root]# ipta.ble.s -L电脑
Chai..n INPUT (policy ACCEPT)          婚庆
target    . prot opt source       .        destination.
RH-.Firewall-1-INPUT  all  --  an.ywhere             anywhere            杀毒
ACCEPT     tcp  --.  any.where             anywhere           tcp dpt:50000--- 印刷

Chain F.ORWARD (policy AC.CEPT).
target.     prot opt source               dest.ination.
RH-Firewall-1-INPUT  all.  -- . anywhere             anywhere.

Chain OUTPUT (po.licy ACCEP.T)    美容
target     prot opt source. .              destination    健康

C.hain RH-Firewall-1-IN.PUT (2 references)    外汇
targe.t   .  prot opt source               destination              乙肝
ACCEPT.     all  --  anywhere.             anywhere教育
ACCEPT     icmp --  anywhere             an..ywhere           icmp any[成人用品]
A.CCEPT     ipv6-crypt--  .anywhere             anywhere.
ACCEPT     ipv6-auth--  any.wh.ere             anywhere.
AC.C.EPT     all  --  anywhere             anywhere           stat.e RELATED,ESTABL虚拟主机
ISHED
ACCEPT     tc.p  --  any.whe.re             anywhere           state NEW tcp dpt:te.
lnet
ACCEPT     tcp  --  anywhere          .   anywhere  .        . state NEW tcp dpt:ft外贸
p
REJECT     all  --  anywhere             anywhere .          rej..ect-with icmp-hos.
t-prohibited
[root@mydb roo.t]# /etc/rc.d/init.d/iptables sa.ve              乙肝
Saving firewall rules to /etc/sysconfig/iptables:   确定..  ]外贸
[root@mydb root]# iptables -A INPUT -p .tcp --dpor.t 50000 -j ACCEPT.
[root@mydb ro.ot]# /etc/rc..d/init.d/iptables save
Saving firewall rules to /etc/sysconfi.g/iptables:   确定  ].<性病>
[root@mydb root]# serv.i.ce iptables restart            杀毒
Fl.ushing firewall rule.s:   确定  ]    健康
Setting chains to policy ACCEPT: filter .  确.定  ].
Unloading iptables m.odules:   确定.  ].
Applying iptables firewall ru.l.es: Bad argument `any'.
Error occured at line:. 12    健康
Try `iptables-restore -h' or 'iptabl.es-res.tore --help' for more infor.mation.(广告)
失败]
[root.@mydb root]# ipt.ables -L(广告)
Chain INPUT .(policy ACCEP.T)<性病>
target  .   prot opt source               dest.ination.

C.hain FORWARD (.policy ACCEPT)电脑
target     prot opt source  .             destinatio.n(        游戏          )

Chain O.UTPUT (policy. ACCEPT)健康
ta.rget     prot opt sour.ce               destination    美容
[root@m.ydb root]#           女人

[ 本帖最后由 .wxx_126 于 2009-3-5 10:09 编辑 .](广告)

评价一下你浏览此帖子的感受

精彩

感动

搞笑

开心

愤怒

无聊

灌水
离线yeats520.
发帖
2217
C币
-151825
威望
453
贡献值
1
银元
-3
铜钱
5084
人人网人气币
0
只看该作者 沙发  发表于: 2010-04-14
Re:[RedHat]
将这个文件/etc/sysconfig/iptables放上来看看具体的问题

离线沸冰.
发帖
2034
C币
-235630
威望
364
贡献值
1
银元
-3
铜钱
4553
人人网人气币
0
只看该作者 板凳  发表于: 2010-04-14
Re:[RedHat]
把iptables文件贴上来看看

发帖
1928
C币
-235601
威望
357
贡献值
1
银元
-5
铜钱
4330
人人网人气币
0
只看该作者 地板  发表于: 2010-04-14
Re:[RedHat]
是不是规则书写的顺序问题

离线17772.
发帖
2092
C币
-60655
威望
392
贡献值
1
银元
-3
铜钱
4723
人人网人气币
0
只看该作者 4楼 发表于: 2010-04-14
Re:[RedHat]
[root@mydb root]# more /etc/sysconfig/iptables
# Generated by iptables-save v1.2.8 on Thu Mar  5 05:43:02 2009
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [749:69407]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A INPUT -p tcp -m tcp --dport 50000 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 50000 -j ACCEPT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp -m icmp any -j ACCEPT
-A RH-Firewall-1-INPUT -p esp -j ACCEPT
-A RH-Firewall-1-INPUT -p ah -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 23 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Thu Mar  5 05:43:02 2009
[root@mydb root]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
[root@mydb root]#

离线douxp.
发帖
2188
C币
-193049
威望
401
贡献值
1
银元
0
铜钱
4922
人人网人气币
0
只看该作者 5楼 发表于: 2010-04-14
Re:[RedHat]
service iptables restart看看

离线dk97531.
发帖
2014
C币
2762
威望
379
贡献值
1
银元
-1
铜钱
4492
人人网人气币
0
只看该作者 6楼 发表于: 2010-04-14
Re:[RedHat]
service iptables restart
是执行过的(如1楼所示),执行过后,iptables -L还是空的。
不知应该是以iptables -L为准,还是以/etc/sysconfig/iptables中的内容为准呢??

离线zyb12344.
发帖
2072
C币
-60320
威望
403
贡献值
1
银元
-2
铜钱
4745
人人网人气币
0
只看该作者 7楼 发表于: 2010-04-14
Re:[RedHat]
你要修改/etc/sysconfig/iptables-config文件第32行
把no改为yes才可以使用保存的命令

离线gongxieyan.
发帖
1937
C币
-193666
威望
358
贡献值
1
银元
-1
铜钱
4382
人人网人气币
0
只看该作者 8楼 发表于: 2010-04-14
Re:[RedHat]
Applying iptables firewall rules: Bad argument `any'
Error occured at line: 12
Try `iptables-restore -h' or 'iptables-restore --help' for more information.

发帖
1957
C币
-198861
威望
367
贡献值
1
银元
-3
铜钱
4483
人人网人气币
0
只看该作者 9楼 发表于: 2010-04-14
Re:[RedHat]
iptables -L这个是实际生效的规则
快速回复
限100 字节
如果您提交过一次失败了,可以用”恢复数据”来恢复帖子内容
 
上一个 下一个