LinuxSir.cn,穿越时空的Linuxsir!

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

[求助]配置好squid.conf和iptables还是不能上网

[复制链接]
发表于 2006-4-15 14:38:52 | 显示全部楼层 |阅读模式
eth2 外网 229.146.115.76  DNS:221.53.149.13   gateway:229.146.115.73
eth1 内网 192.168.0.1 /24
以下是我根据网上的教程写的配置,高手们指教一下,小弟弄了三天了都没弄通,救救我.另外客户PC需要如何设置?

/etc/squid.conf  (其中其它默认的项目用#标没有改动)

http_port 3128
icp_port 3130
cache_mem 256 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 40960 KB
maximum_object_size_in_memory 4096 KB
ipcache_size 1024
ipcache_low 90
ipcache_high 95
fqdncache_size 1024
cache_dir ufs /var/spool/squid 40000 16 256

refresh_pattern ^ftp:                1440        20%        10080
refresh_pattern ^gopher:        1440        0%        1440
refresh_pattern .                0        20%        4320

acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 563
acl Safe_ports port 80                # http
acl Safe_ports port 21                # ftp
acl Safe_ports port 443 563        # https, snews
acl Safe_ports port 70                # gopher
acl Safe_ports port 210                # wais
acl Safe_ports port 1025-65535        # unregistered ports
acl Safe_ports port 280                # http-mgmt
acl Safe_ports port 488                # gss-http
acl Safe_ports port 591                # filemaker
acl Safe_ports port 777                # multiling http
acl Safe_ports port 53   #DNS
acl CONNECT method CONNECT

acl inside src 192.168.0.0/24 (内网)

http_access allow all
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports (这两句是默认的,但我没看懂)
http_reply_access allow all

icp_access allow all


cache_effective_user squid
cache_effective_group squid

httpd_accel_port 80
httpd_accel_single_host off
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
coredump_dir /var/spool/squid

iptables:
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth2 -j SNAT --to 229.146.115.76
iptables -t nat -A PREROUTING -s 192.168.0.0/24 -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -A INPUT -i eth1 -p udp -m multiport --dports 53 -j ACCEPT
还有,现在客户端能PING通ETH2(就是外网那个网卡),但PING不通外网那个网关
 楼主| 发表于 2006-4-15 15:24:05 | 显示全部楼层
研究了半天,设置一下网卡间的转发功能就OK了,但每次系统重启就需要再输入一次
echo 1 > /proc/sys/net/ipv4/ip_forward,我写到rc.local里还是不行,它自动运行是在什么地方设置?

现在还有一个问题,我用squid做透明代理,客户端需要在IE里面设置代理服务器地址才能正常上网,能有什么办法客户端除了IP地址其它的什么都不用设就可以上网的
回复 支持 反对

使用道具 举报

发表于 2006-4-15 16:37:13 | 显示全部楼层
如果做透明代理的话,需要在
squid.conf中添加:
httpd_accel_host virtual
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-4-15 20:11:48 | 显示全部楼层
好的,我去试试。以前我是有这一句的,但好象记得第一次启动的时候squid报这一句出错,所以后来我就没用这句了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-4-15 20:12:58 | 显示全部楼层
还有个问题,客户端用flashget或nettransport下载失败,下载工具链到一个.asp,然后就提示http错误,以前看到有我问过这个问题,但没看到解答。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-4-16 13:36:08 | 显示全部楼层
加了httpd_accel_host virtual,透代成功,flashget可以下载了
回复 支持 反对

使用道具 举报

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

本版积分规则

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