LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 545|回复: 0

请教各位仁兄一个iptables问题

[复制链接]
发表于 2006-4-21 16:04:53 | 显示全部楼层 |阅读模式
我们学校机房上网使用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 ~]#
不知道为什么教师机还不可以上网,我是新手,请各位指点。谢谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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