2012-09-28 180 views
6

我有一個奇怪的問題與魷魚3。它通常工作,我可以通過代理訪問大多數網站。然而一些網站如squid3無法訪問google.com或bing.com

google.com 
bing.com 

只是似乎被阻止,但並不總是如此。重新啓動squid3似乎沒有幫助,或者清除/ var/spool/squid3(緩存)目錄。

如果我登錄到squid3機器上運行,並

wget --no-proxy google.com 

那麼就沒有問題但是如果我通過它從不響應代理wget的。大多數其他網站都可以訪問,包括我在此時通過代理使用的stackoverflow.com。任何想法可能是關於google.com和bing.com的特別之處,以便squid3對待它們的方式不同,並且squid3 conf文件中是否存在可能與此類行爲有關的任何設置。

+0

僅供參考。 google.com正在重新開始工作。這似乎是一個間歇性問題。 – bradgonesurfing

+0

當您打開網站時會發生什麼?在提出請求時,你在squid的日誌中看到了什麼? – Mikec

回答

25

我也有同樣的問題。我的問題引起的ipv6連接問題。 Squid3支持ipv6和ipv4協議。如果你的服務器不能連接ipv6而遠程服務器更喜歡ipv6,那麼squid也更喜歡ipv6,並且不能像訪問日誌那樣檢索數據。

首先嚐試ipv6連接與ping。

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 
+0

如果您有新問題,請點擊[問問題](http://stackoverflow.com/questions/ask)按鈕。如果你有足夠的聲望,[你可以upvote](http://stackoverflow.com/privileges/vote-up)這個問題。或者,將其「明星」作爲最愛,並且您會收到任何新答案的通知。 – jjnguy

+0

謝謝,你救了我的一天 –

+0

哇哇謝謝!...添加'dns_v4_first on'解決了我的問題! –

2

請記住,dns_v4_first只適用於較新的squid3版本。 如果你運行例如一個debian6服務器,你有沒有這個配置開關的squid3-3.1.6。

爲你所編輯的配置行

tcp_outgoing_address SERVERIP all 

哪裏SERVERIP是您的服務器的IP舊版本。