由 恍若如梦 在 06-17-2004 16:30 发表:
求教::关于Squid做透明代理的问题!
环境是这样的,一台trustix-2.0Linux服务器,用来拨号上网,一个HUB,一台Windowd2000系统,很简单的一个局限网,Linux服务器的IP地址为192.168.20.1,Windows2000系统IP地址为192.168.20.2,我想让Linux做透明代理服务器,2000通过这台代理服务器上网.
我的Squid2.5版本配置如下:
http_port 8080
cache_mem 8 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 4096 KB
cache_dir ufs /opt/cache 100 16 256
cache_access_log /usr/local/squid/var/logs/access.log
cache_log /usr/local/squid/var/logs/cache.log
dns_nameservers 219.234.32.254
unlinkd_program /usr/local/squid/libexec/unlinkd
acl allwed_hosts src 192.168.20.0/255.255.255.0
http_access allow all
cache_effective_user sjweb
cache_effective_group sjweb
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
visible_hostname www.sina.com.cn
Iptalbes脚本如下:
#begin
echo 1 > /proc/sys/net/ipv4/ip_forward
modprobe iptable_nat
modprobe ip_conntrack
modprobe ip_conntrack_ftp
iptables -F INPUT
iptables -F FORWARD
iptables -F POSTROUTING -t nat
iptables -t nat -F
iptables -P FORWARD DROP
iptables -A FORWARD -s 192.168.20.0/24 -j ACCEPT
iptables -A FORWARD -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.20.0/24 -j MASQUERADE
#end
现在的问题是,在2000系统上可以ping通192.168.20.1,把网关设置成为192.168.20.1,然后用Linux拨号上网,但2000却打开不了网页,直接输入IP地址也不行,能否让大家帮帮忙,谢谢!
由 Snoopy 在 06-17-2004 17:18 发表:
iptables需要添加规则
And then in the evening light, when the bars of freedom fall
I watch the two of you in the shadows on the wall
How in the darkness steals some of the choices from my hand
Then will I begin to under
由 恍若如梦 在 06-17-2004 21:12 发表:
请问如而添加呢?能帮写出来,谢谢!
由 faint 在 06-17-2004 21:24 发表:
你的FORWARD 的 Default Policies 都drop掉了。
把倒数二三条规则换成下面的试试:
iptables -A FORWARD -i ppp0 -s 192.168.20.0/24 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i ppp0 -d 192.168.20.0/24 -m state --state ESTABLISHED,RELATED -j ACCEPT
BTW:机器那么少,不用squid都可了:-),学习就另当别论

由 faint 在 06-17-2004 21:25 发表:
另外,如果你一定要squid的话,还得添加另外一二条规则:-)
自己找找.......
由 恍若如梦 在 06-17-2004 22:44 发表:
完完全全是为了学习,按上面的方法还是不行,包括squid非透明代理都不行,提示出错:
ERROR
The requested URL could not be retrieved
--------------------------------------------------------------------------------
While trying to retrieve the URL: http://219.234.32.251/
The following error was encountered:
Access Denied.
Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.
Your cache administrator is webmaster.
------------------------------------------------------