【问题标题】:squid3 can't access google.com or bing.com [closed]squid3 无法访问 google.com 或 bing.com [关闭]
【发布时间】:2012-09-28 05:05:02
【问题描述】:

我对 squid3 有一个奇怪的问题。它正常工作,我可以通过代理访问大多数网站。但是有些网站像

google.com
bing.com 

只是似乎被阻止但并非总是如此。重新启动 squid3 似乎没有帮助,或者清除 /var/spool/squid3 ( 缓存 ) 目录。

如果我登录到运行 squid3 的机器并且

wget --no-proxy google.com

那么没有问题,但是如果我通过代理它永远不会响应。大多数其他网站都可以访问,包括我目前通过代理使用的 stackoverflow.com。知道 google.com 和 bing.com 可能有什么特别之处,以便 squid3 以不同方式对待它们,并且 squid3 conf 文件中是否有任何可能与此类行为相关的设置。

【问题讨论】:

  • 仅供参考。 google.com 又开始工作了。这似乎是一个间歇性问题。
  • 打开网站时究竟发生了什么?在发出请求时,您在 squid 的日志中看到了什么?

标签: squid


【解决方案1】:

我也有同样的问题。我的问题是由 ipv6 连接问题引起的。 Squid3 支持 ipv6 和 ipv4 协议。如果您的服务器无法连接 ipv6 而远程服务器更喜欢 ipv6,那么 squid 也更喜欢 ipv6 并且无法检索访问日志等数据。

首先尝试使用 ping 连接 ipv6。

ping6 ivp6.google.com

如果 ping 没有响应,让我们先将 squid3 配置为首选 ipv4。

在 squid.conf 中搜索

TAG: dns_v4_first

之后

#Default:
#dns_v4_first off

添加

dns_v4_first on

然后重启squid3服务器

service squid3 restart

这是我修复前的访问日志。

1352760882.854    796 88.my.ip.108 TCP_MISS/000 0 GET http://connect.facebook.net/en_US/all.js [squiduser] DIRECT/connect.facebook.net -
1352760885.717     69 88.my.ip.108 TCP_MISS/000 0 GET http://www.google.com.tr/complete/search? [squiduser] DIRECT/www.google.com.tr -
1352760886.250     13 88.my.ip.108 TCP_MISS/000 0 GET http://www.google.com.tr/complete/search? [squiduser] DIRECT/www.google.com.tr -
1352760887.011    369 88.my.ip.108 TCP_MISS/000 0 GET http://www.google.com.tr/complete/search? [squiduser] DIRECT/www.google.com.tr -
1352760887.989     42 88.my.ip.108 TCP_MISS/000 0 GET http://www.google.com.tr/complete/search? [squiduser] DIRECT/www.google.com.tr -
1352760888.984     75 88.my.ip.108 TCP_MISS/000 0 GET http://www.google.com.tr/complete/search? [squiduser] DIRECT/www.google.com.tr -
1352760897.351   8165 88.my.ip.108 TCP_MISS/000 0 GET http://www.google.com.tr/search? [squiduser] DIRECT/www.google.com.tr -
1352761072.531  10970 88.my.ip.108 TCP_MISS/000 0 GET http://www.google-analytics.com/__utm.gif? [squiduser] DIRECT/www.google-analytics.com -
1352761072.533  10272 88.my.ip.108 TCP_MISS/000 0 GET http://apis.google.com/js/plusone.js [squiduser] DIRECT/apis.google.com -
1352761072.535  10262 88.my.ip.108 TCP_MISS/000 0 GET http://connect.facebook.net/en_US/all.js [squiduser] DIRECT/connect.facebook.net -

这是我的完整鱿鱼配置。我使用 squid 作为匿名代理服务器。

2012/11/14 00:09:02| Processing Configuration File: /etc/squid3/squid.conf (depth 0)
2012/11/14 00:09:02| Processing: auth_param basic program /usr/lib/squid3/ncsa_auth /etc/squid3/squid.passwd
2012/11/14 00:09:02| Processing: auth_param basic children 5
2012/11/14 00:09:02| Processing: auth_param basic realm Squid proxy-caching web server
2012/11/14 00:09:02| Processing: auth_param basic credentialsttl 2 hours
2012/11/14 00:09:02| Processing: acl manager proto cache_object
2012/11/14 00:09:02| Processing: acl localhost src 127.0.0.1/32 ::1
2012/11/14 00:09:02| Processing: acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
2012/11/14 00:09:02| Processing: acl CONNECT method CONNECT
2012/11/14 00:09:02| Processing: http_access allow manager localhost
2012/11/14 00:09:02| Processing: http_access deny manager
2012/11/14 00:09:02| Processing: http_access allow localhost
2012/11/14 00:09:02| Processing: acl ncsaauth proxy_auth REQUIRED
2012/11/14 00:09:02| Processing: http_access allow ncsaauth
2012/11/14 00:09:02| Processing: http_access deny all
2012/11/14 00:09:02| Processing: http_port 8880
2012/11/14 00:09:02| Processing: coredump_dir /var/spool/squid3
2012/11/14 00:09:02| Processing: refresh_pattern ^ftp:      1440    20% 10080
2012/11/14 00:09:02| Processing: refresh_pattern ^gopher:   1440    0%  1440
2012/11/14 00:09:02| Processing: refresh_pattern -i (/cgi-bin/|\?) 0    0%  0
2012/11/14 00:09:02| Processing: refresh_pattern (Release|Packages(.gz)*)$      0       20%     2880
2012/11/14 00:09:02| Processing: refresh_pattern .      0   20% 4320
2012/11/14 00:09:02| Processing: dns_v4_first on
2012/11/14 00:09:02| Processing: forwarded_for delete
2012/11/14 00:09:02| Processing: request_header_access Allow allow all 
2012/11/14 00:09:02| Processing: request_header_access Authorization allow all 
2012/11/14 00:09:02| Processing: request_header_access WWW-Authenticate allow all 
2012/11/14 00:09:02| Processing: request_header_access Proxy-Authorization allow all 
2012/11/14 00:09:02| Processing: request_header_access Proxy-Authenticate allow all 
2012/11/14 00:09:02| Processing: request_header_access Cache-Control allow all 
2012/11/14 00:09:02| Processing: request_header_access Content-Encoding allow all 
2012/11/14 00:09:02| Processing: request_header_access Content-Length allow all 
2012/11/14 00:09:02| Processing: request_header_access Content-Type allow all 
2012/11/14 00:09:02| Processing: request_header_access Date allow all 
2012/11/14 00:09:02| Processing: request_header_access Expires allow all 
2012/11/14 00:09:02| Processing: request_header_access Host allow all 
2012/11/14 00:09:02| Processing: request_header_access If-Modified-Since allow all 
2012/11/14 00:09:02| Processing: request_header_access Last-Modified allow all 
2012/11/14 00:09:02| Processing: request_header_access Location allow all 
2012/11/14 00:09:02| Processing: request_header_access Pragma allow all 
2012/11/14 00:09:02| Processing: request_header_access Accept allow all 
2012/11/14 00:09:02| Processing: request_header_access Accept-Charset allow all 
2012/11/14 00:09:02| Processing: request_header_access Accept-Encoding allow all 
2012/11/14 00:09:02| Processing: request_header_access Accept-Language allow all 
2012/11/14 00:09:02| Processing: request_header_access Content-Language allow all 
2012/11/14 00:09:02| Processing: request_header_access Mime-Version allow all 
2012/11/14 00:09:02| Processing: request_header_access Retry-After allow all 
2012/11/14 00:09:02| Processing: request_header_access Title allow all 
2012/11/14 00:09:02| Processing: request_header_access Connection allow all 
2012/11/14 00:09:02| Processing: request_header_access Proxy-Connection allow all 
2012/11/14 00:09:02| Processing: request_header_access User-Agent allow all 
2012/11/14 00:09:02| Processing: request_header_access Cookie allow all 
2012/11/14 00:09:02| Processing: request_header_access All deny all 

【讨论】:

  • 如果您有新问题,请点击 按钮提出问题。如果您有足够的声誉,you may upvote 的问题。或者,将其“加注”为收藏夹,您将收到任何新答案的通知。
  • 哇哇谢谢!...添加dns_v4_first on解决了我的问题!
  • 谢谢!我知道这是一个老话题,但它仍在解决问题。
【解决方案2】:

请记住,dns_v4_first on 仅适用于较新的 squid3 版本。 例如,如果您运行 debian6 服务器,则您的 squid3-3.1.6 没有此配置开关。

对于那些旧版本,您必须编辑配置行

tcp_outgoing_address SERVERIP all

SERVERIP 是您的服务器的 IP。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-26
    • 2021-09-24
    • 2011-01-21
    • 2011-01-20
    • 2016-03-22
    • 2021-05-26
    • 2021-01-08
    • 1970-01-01
    相关资源
    最近更新 更多