免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123下一页
最近访问板块 发新帖
查看: 8807 | 回复: 21
打印 上一主题 下一主题

[proxy] squid普通代理求助 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-05-14 17:30 |只看该作者 |倒序浏览
本帖最后由 12fzm34 于 2011-05-16 21:28 编辑

环境:Vmware7.1虚拟机环境
      Linux:Rhl6.0_x64  eth0:10.0.0.3
         Win2003                 eth0:10.0.0.4
         Squid_3.1.4_l.el6.x86_64用的是rpm包安装。
  现在做一般代理,linux能够上网,win2003代理填写的10.0.0.3端口8888,能够在win2003上ping通linux的eth0的10.0.0.3,但是用代理上网不能,以下是squid.conf里的配置:已经快疯掉了!有谁能帮我一下,后面还要配置方向代理,这都不通后面更不好配了。谢谢谢谢!!!
#
# Recommended minimum configuration:
#
acl win src 10.0.0.4/32
http_access allow win
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl localhost src ::1/128
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl to_localhost dst ::1/128

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7   # RFC 4193 local private network range
acl localnet src fe80::/10  # RFC 4291 link-local (directly plugged) machines

acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
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 CONNECT method CONNECT

#
# Recommended minimum Access Permission configuration:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access allow manager

# Deny requests to certain unsafe ports
http_access allow !Safe_ports

# Deny CONNECT to other than secure SSL ports
http_access allow CONNECT !SSL_ports

# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all

# Squid normally listens to port 3128
http_port 8888 vhost vport

# We recommend you to use at least the following line.
hierarchy_stoplist cgi-bin ?

# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /var/spool/squid 100 16 256.
# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid

# Add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320

#cache_mem
cache_mem  128 MB

#cache_mgr
cache_mgr root@example.com

#visible_hostname
visible_hostname squids

dns_nameservers 202.103.24.68


启动过程没有问题,防火墙已关闭,修改了下配置文件,现在客户机可以访问代理了
但是提示下面错误:
当尝试取回该 URL 时遇到下面的错误:http://www.163.com/

目前无法将您的请求进行转送操作

您的请求无法被转送到原始网络服务器或其他的上层缓存服务器,发生这个问题最可能的原因是缓存服务器管理员不允许本服务器与原始网络服务器直接连结,而 所有本服务器指定的上层缓存服务器都暂时无法连结。

缓存服务器的管理员 root@example.com.

这是cache.log的内容:
2011/05/14 03:24:43|    never_direct = 0
2011/05/14 03:24:43|        timedout = 0
2011/05/14 03:24:54| Failed to select source for 'http://www.sina.com.cn/'
2011/05/14 03:24:54|   always_direct = 0
2011/05/14 03:24:54|    never_direct = 0
2011/05/14 03:24:54|        timedout = 0
2011/05/14 03:24:54| Failed to select source for 'http://www.squid-cache.org/Artwork/SN.png'
2011/05/14 03:24:54|   always_direct = 0
2011/05/14 03:24:54|    never_direct = 0
2011/05/14 03:24:54|        timedout = 0

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
2 [报告]
发表于 2011-05-15 07:48 |只看该作者
squid服务器的ip转发开启了没有

论坛徽章:
0
3 [报告]
发表于 2011-05-15 17:13 |只看该作者
本帖最后由 12fzm34 于 2011-05-15 17:42 编辑

回复 2# chenyx


    这个是要开还是要关闭?我现在不知道我的开了还是关闭了,要是关怎么关?要是开怎么开呢?我刚才查了下还不知道怎么调试,我完全是从0开始配置linux服务器!

我把vim /etc/resolv.conf 中编辑成这样了nameserver 202.103.24.68,也还是同样出现上面的情况,防火墙也关闭了
    vim /etc/sysctl.conf中的net.ipv4.ip_forward = 0修改成1了,不知道这是不是就是开启了ip转发,问题依旧!

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
4 [报告]
发表于 2011-05-15 17:52 |只看该作者
/etc/sysctl.conf修改完成,用sysctl -p才启用

论坛徽章:
0
5 [报告]
发表于 2011-05-15 18:00 |只看该作者
本帖最后由 12fzm34 于 2011-05-15 18:06 编辑

回复 4# chenyx

这个是sysctl -p后的结果!!
    net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
还是不行

我以为是acl规则的问题,在squid.conf里面加入了acl win src 10.0.0.4/32    http_access allow win,10.0.0.4是客户机的ip!问题依旧

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
6 [报告]
发表于 2011-05-15 18:04 |只看该作者
你的服务器os是什么,如果是redhat(centos),关闭selinux,重启下squid服务看看

论坛徽章:
0
7 [报告]
发表于 2011-05-15 18:10 |只看该作者
回复 6# chenyx


    我用的红帽子企业版6.0x64的系统,selinux没有运行!要是运行的话,squid服务无法启用

论坛徽章:
0
8 [报告]
发表于 2011-05-15 22:58 |只看该作者
http_access allow !Safe_ports 这个是不是反了。。

论坛徽章:
0
9 [报告]
发表于 2011-05-16 09:27 |只看该作者
回复 8# dexter_yccs


    这个http_access allow !Safe_ports ,我改成deny也不行!之前就试过了

论坛徽章:
0
10 [报告]
发表于 2011-05-16 10:02 |只看该作者
回复 9# 12fzm34


    你最后是allow all啊。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP