LinuxSir.cn,穿越时空的Linuxsir!

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

squid无法透明代理上网

[复制链接]
发表于 2005-5-29 15:59:31 | 显示全部楼层 |阅读模式
装的是rh9,用自带的SQUID,两块网卡eth0:192.168.0.32,eth1:192.168.1.32
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.32
NETMASK=255.255.255.0
GATEWAY=192.168.0.1

DEVICE=eth1
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.32
NETMASK=255.255.255.0

192.168.0这个网段能上网

我只想让192.168.1这个网段的机器能够通过其透明代理上网。
squid.conf文件设置如下:
http_port 192.168.1.32:3128
cache_mar root
cache_dir ufs /var/squid/var/cache 100 16 256
cache_mem 32 M
cache_swap_low 90
cache_swap_high 95
cache_access_log /var/squid/access.log
cache_log /var/squid/cache.log
cache_store_log /var/squid/store.log
visible_hostname rh9
client_netmask 255.255.255.255
httpd_accel_host rh9
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_user_host_header on


iptables -t nat -A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128
iptables -t nat -A PORTROUTING -s 192.168.1.0/24 -o eth0 -j SNAT --to 192.168.0.32
我把客户器的IP设成192.168.1.33,255.255.255.0,网关192.168.1.32,DNS202.106.0.20仍然无法上网,请问什么原因?
 楼主| 发表于 2005-5-29 16:00:36 | 显示全部楼层
用IE浏览弹出以下错误
ERROR
The requested URL could not be retrieved

--------------------------------------------------------------------------------

While trying to retrieve the URL: /

The following error was encountered:

Invalid URL
Some aspect of the requested URL is incorrect. Possible problems:

Missing or incorrect access protocol (should be `http://'' or similar)
Missing hostname
Illegal double-escape in the URL-Path
Illegal character in hostname; underscores are not allowed
Your cache administrator is root.



--------------------------------------------------------------------------------

Generated Sun, 29 May 2005 07:52:44 GMT by rh9 (squid/2.5.STABLE1)
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-29 16:15:41 | 显示全部楼层
已经解决,谢谢!!!
回复 支持 反对

使用道具 举报

发表于 2005-5-30 08:07:26 | 显示全部楼层
如果已经解决的话就请说出解决的方法啊,这样让大家都可以学到啊!难道我们来论坛就单纯是解决自己的问题的吗?

解决方法应该是在squid.conf里加上 httpd_accel_host virtual 这一句吧。这和linux及squid的版本有关!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-30 10:20:37 | 显示全部楼层
对,还有就是要启动路由
echo 1 > /proc/sys/net/ipv4/ip_forward
回复 支持 反对

使用道具 举报

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

本版积分规则

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