免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1631 | 回复: 8
打印 上一主题 下一主题

求一条简单的iptables语句, [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-11-11 15:02 |只看该作者 |倒序浏览
就是允许别人Telnet到我这台机子上啊,没有接触过这个东东,不会写,
这是我机子上原来的:
[root@Rhel5 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     icmp --  anywhere             anywhere            icmp any
ACCEPT     esp  --  anywhere             anywhere            
ACCEPT     ah   --  anywhere             anywhere            
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

论坛徽章:
0
2 [报告]
发表于 2008-11-11 15:58 |只看该作者
iptables -A INPUT -i eth0 -p tcp --dport 端口号 -j ACCEPT


filter表,input链


默认端口号是23,如果没改的话。

论坛徽章:
0
3 [报告]
发表于 2008-11-11 16:02 |只看该作者
楼主的三个链默认就是ACCEPT,现在应该可以连接吧

论坛徽章:
0
4 [报告]
发表于 2008-11-11 16:08 |只看该作者
不会,看不懂,正在学习当中

论坛徽章:
1
操作系统版块每日发帖之星
日期:2015-07-11 22:20:00
5 [报告]
发表于 2008-11-11 16:12 |只看该作者
如果是新手,把规则都清除了吧。

  1. iptables -F
  2. iptables -X
  3. iptables -Z
  4. service iptables save
复制代码

论坛徽章:
0
6 [报告]
发表于 2008-11-11 16:19 |只看该作者
[root@Rhel5 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:telnet

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     icmp --  anywhere             anywhere            icmp any
ACCEPT     esp  --  anywhere             anywhere            
ACCEPT     ah   --  anywhere             anywhere            
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

这是changzi100的方法,我发现那个允许23的在上面,
而这时不能Telnet啊,为什么?

iptables -A INPUT -i eth0 -p tcp --dport 23 -j ACCEPT
我是这样输进去的,

[ 本帖最后由 Peifei 于 2008-11-11 16:25 编辑 ]

论坛徽章:
0
7 [报告]
发表于 2008-11-11 16:20 |只看该作者
[root@Rhel5 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     icmp --  anywhere             anywhere            icmp any
ACCEPT     esp  --  anywhere             anywhere            
ACCEPT     ah   --  anywhere             anywhere            
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:telnet
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

这是我用system-config-securitylevel设的结果,那个telnet规则在下面,
就是可以正常Telnet的,

[ 本帖最后由 Peifei 于 2008-11-11 16:24 编辑 ]

论坛徽章:
0
8 [报告]
发表于 2008-11-11 16:22 |只看该作者
原帖由 cst05001 于 2008-11-11 16:12 发表
如果是新手,把规则都清除了吧。

iptables -F
iptables -X
iptables -Z
service iptables save


我只是想知道手工如何加上ACL,
以前搞过PIX和路由器上的ACL,这种Linux ACL命令只是一下子看不清楚啊,

论坛徽章:
0
9 [报告]
发表于 2008-11-11 16:26 |只看该作者
如果你不是在本机的话建议你不要直接在命令行下面添加RULE
在你的iptalbes文件里面修改
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP