找回密码
 注册
查看: 788|回复: 1

请教各位仁兄一个iptables问题

[复制链接]
发表于 2006-4-21 15:44:55 | 显示全部楼层 |阅读模式
我们学校机房上网使用linux作路由器,路由表显示如下:
[root@localhost ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.100.0   *               255.255.255.0   U     0      0        0 eth0
192.168.150.0   *               255.255.255.0   U     0      0        0 eth2
192.168.140.0   *               255.255.255.0   U     0      0        0 eth1
169.254.0.0     *               255.255.0.0     U     0      0        0 eth2
default         192.168.100.254 0.0.0.0         UG    0      0        0 eth0
[root@localhost ~]#
其中eth0连接校园网、 eth1连接四机房 、eth2连接五机房,当启动ipforward后,四五机房的机器都能通过校园网访问因特网。
现在要实现在上课时只允许两个机房的教师机(ip地址分别是:192.168.140.100、192.168.150.100)可以访问因特网的功能,使用了iptables过滤数据包,配置如下:
[root@localhost ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  192.168.140.100      anywhere
ACCEPT     all  --  192.168.150.100      anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
[root@localhost ~]#
不知道为什么教师机还不可以上网,我是新手,请各位指点。谢谢!
发表于 2006-4-21 16:42:09 | 显示全部楼层
加一个试试

iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2025-2-12 20:00 , Processed in 0.023515 second(s), 15 queries .

© 2001-2025 Discuz! Team. Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表