免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: chuizx
打印 上一主题 下一主题

路由中iptables问题。。。 [复制链接]

论坛徽章:
0
11 [报告]
发表于 2008-08-15 11:09 |显示全部楼层

回复 #19 linux_admin 的帖子

第一句的ACCEPT 添加不进去  报错
不好意识,我这网速有点慢哈。。

论坛徽章:
0
12 [报告]
发表于 2008-08-15 11:23 |显示全部楼层

回复 #23 linux_admin 的帖子

我已经添加进去了,我看了下INPUT链中DROP排再ACCEPT前面,我是允许的同一网段的另一台机子可以上百度,在机子上测试了下。但是还可以所有网站可以上。郁闷。。。

论坛徽章:
0
13 [报告]
发表于 2008-08-15 11:27 |显示全部楼层

回复 #26 ssffzz1 的帖子

不是吧。。我要实现的是我只允许百度可以上 其他网站的上不去。
iptables -I FORWARD -s 192.168.0.230 -d www.baidu.com -j DROP,这样的话是不是就吧百度禁止啦。。?

论坛徽章:
0
14 [报告]
发表于 2008-08-15 11:29 |显示全部楼层

回复 #27 linux_admin 的帖子

这台linux服务器不是网关?

我这是个路由,在对路由进开发。。

论坛徽章:
0
15 [报告]
发表于 2008-08-15 11:33 |显示全部楼层

回复 #32 ssffzz1 的帖子

我再试试哈。。。非常感谢2位!!

论坛徽章:
0
16 [报告]
发表于 2008-08-15 11:35 |显示全部楼层

回复 #35 ssffzz1 的帖子

恩哈 。。。我弄这个都不知道断了多少次了。。。没关系。。断了重启  呵呵

论坛徽章:
0
17 [报告]
发表于 2008-08-15 11:51 |显示全部楼层

回复 #32 ssffzz1 的帖子

唉,终于搞清楚你要干吗了。可能我没有看仔细吧。

iptables -I FORWARD -j DROP
iptables -I FORWARD -s 192.168.0.230 -d www.baidu.com -j ACCEPT
iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

这个应该可以了。

[ 本帖最后由 ssffzz1 于 2008-8-15 11:33 编辑 ]



我试过了。。。里面的链是这样的了
Chain FORWARD (policy DROP)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     all  --  192.168.0.4          220.181.6.6         
ACCEPT     all  --  192.168.0.4          220.181.37.55      
DROP       all  --  anywhere             anywhere            


结果都断网了。。。连百度也上不去

论坛徽章:
0
18 [报告]
发表于 2008-08-15 12:00 |显示全部楼层

回复 #38 ssffzz1 的帖子

恩。都断了。。。

论坛徽章:
0
19 [报告]
发表于 2008-08-15 12:03 |显示全部楼层

回复 #38 ssffzz1 的帖子

我这样试了下  iptables -I FORWARD -s 192.168.0.230 -d -!www.baidu.com -j DROP
意识是除了百度,其他都禁止,但报语法错误。

论坛徽章:
0
20 [报告]
发表于 2008-08-15 13:11 |显示全部楼层

回复 #41 ssffzz1 的帖子

我重启路由,最初的表是
Chain FORWARD (policy DROP)
target     prot opt source               destination         
sysfw      all  --  anywhere             anywhere            state NEW
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     all  --  192.168.0.0/24       anywhere            state NEW

Chain INPUT (policy DROP)
target     prot opt source               destination         
sysfw      all  --  anywhere             anywhere            state NEW
re-admin   all  --  anywhere             anywhere            
lo-admin   all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain lo-admin (1 references)
target     prot opt source               destination         
ACCEPT     all  --  192.168.0.0/24       anywhere            

Chain p2pfw (0 references)
target     prot opt source               destination         

Chain re-admin (1 references)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh

Chain sysfw (2 references)
target     prot opt source               destination         
DROP       udp  --  anywhere             anywhere            udp dpts:135:netbios-ssn
DROP       tcp  --  anywhere             anywhere            tcp dpts:135:netbios-ssn
DROP       tcp  --  anywhere             anywhere            tcp dpt:445
我加了你说是那两行后,表如下:
Chain FORWARD (policy DROP)
target     prot opt source               destination         
ACCEPT     all  --  192.168.0.0/24       220.181.6.6         
ACCEPT     all  --  192.168.0.0/24       220.181.37.55      
DROP       all  --  anywhere             anywhere            
sysfw      all  --  anywhere             anywhere            state NEW
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     all  --  192.168.0.0/24       anywhere            state NEW

Chain INPUT (policy DROP)
target     prot opt source               destination         
sysfw      all  --  anywhere             anywhere            state NEW
re-admin   all  --  anywhere             anywhere            
lo-admin   all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain lo-admin (1 references)
target     prot opt source               destination         
ACCEPT     all  --  192.168.0.0/24       anywhere            

Chain p2pfw (0 references)
target     prot opt source               destination         

Chain re-admin (1 references)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh

Chain sysfw (2 references)
target     prot opt source               destination         
DROP       udp  --  anywhere             anywhere            udp dpts:135:netbios-ssn
DROP       tcp  --  anywhere             anywhere            tcp dpts:135:netbios-ssn
DROP       tcp  --  anywhere             anywhere            tcp dpt:445


结果我上百度也上不去,整个网都断了。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP