mygod100 发表于 2014-12-26 17:25

squid如何配置使某些域名的访问到指定的另外一个squid服务器

有两台squid服务器:
1.squid_high:http_port 3128
icp_port 0
snmp_port 0

acl route_vps_domain dstdomain "/etc/squid/route_vps_domain"
http_access allow route_vps_domain
http_access deny !route_vps_domain
http_access allow all
2.squid_low:http_port 3128
icp_port 0
snmp_port 0

cache_peer squid_high parent 3128 0 no-query no-digest no-netdb-exchange
acl route_vps_domain dstdomain "/etc/squid/route_vps_domain"

cache_peer_access squid_high allow route_vps_domain
cache_peer_access squid_high deny !route_vps_domain

http_access allow all
环境条件:
1. 普通用户连接不到squid_high,但squid_low可以连接访问到squid_high
2. 如果没有squid_high,route_vps_domain域名列表中的地址普通用户无法直接访问。

目的:
使普通用户可以访问route_vps_domain的中的地址,而非route_vps_domain中的数据则不通过squid_high访问。

以上设置后,发现普通用户仍然无法访问route_vps_domain,请问应该如何正确设置啊?谢谢!

woxizishen 发表于 2014-12-27 16:57

本帖最后由 woxizishen 于 2014-12-27 16:58 编辑

:shutup:

cache_peer squid_high parent 3128 0 no-query no-digest no-netdb-exchange
允许通过邻居访问所有网址
cache_peer_access squid_high allow route_vps_domain
允许通过邻居访问这些网址。
cache_peer_access squid_high deny !route_vps_domain
拒绝通过邻居访问这些网址外的。

上面你的2条规则我看到着实有点头疼。本来就是允许通过邻居访问所有网址。你使用下面这条就可以达到你的目的了。
cache_peer_access squid_high deny !route_vps_domain
拒绝通过邻居访问不是route_vps_domain这些网址的网页。

你确认你的2台squid配置正确吗?就是上层的邻居squid_high允许squid_low这台访问吗?好好检查下,你的配置只发这么一点,怎么帮。


mygod100 发表于 2014-12-29 09:54

本帖最后由 mygod100 于 2014-12-29 09:55 编辑

woxizishen 发表于 2014-12-27 16:57 static/image/common/back.gif
cache_peer squid_high parent 3128 0 no-query no-digest no-netdb-exchange
允许通过邻居访 ...

1. 这两台独立运作时正常的,测试时用squidclient分别可以单独获取可以共同访问的163首页(不好意思论坛没权限发表URL,下用163COM代替):
squid_low:squidclient -p 3128 -h squid_low 163COM
HTTP/1.0 302 Moved Temporarily
Server: Cdn Cache Server V2.0
Date: Mon, 29 Dec 2014 01:23:15 GMT
Content-Length: 0
Location: 163COM
X-Cache: MISS from squid_low
X-Cache-Lookup: MISS from squid_low:3128
Via: 1.0squid_low:3128 (squid/2.6.STABLE21)
Proxy-Connection: close
squid_high:squidclient -p 3128 -h squid_high 163COM
HTTP/1.0 302 Moved Temporarily
Server: Cdn Cache Server V2.0
Date: Mon, 29 Dec 2014 01:22:33 GMT
Content-Length: 0
Location: 163COM
X-Cache: MISS from squid_high
X-Cache-Lookup: MISS from squid_high:3128
Via: 1.0squid_low (squid/3.1.10)
Connection: close
2. cache_peer_access squid_high allow route_vps_domain
允许通过邻居访问这些网址。
cache_peer_access squid_high deny !route_vps_domain
拒绝通过邻居访问这些网址外的。

这些让您晕的地方主要是想保证有且仅有在route_vps_domain中的域名可以通过这个通道(squid_low=>squid_high)访问,而其它域名的数据仍然是按没有cache_peer的方式各自走原来的通道访问。

woxizishen 发表于 2014-12-29 11:16

1.我的意思是下面这一条就够了,你只是限制非这些域名网址通过邻居查询。
cache_peer_access squid_high deny !route_vps_domain
拒绝通过邻居访问这些网址外的。

没必要去加这一条允许的,你加不加都可以访问这个域名网址的。
cache_peer_access squid_high allow route_vps_domain


2.既然2台代理各自都可以单独访问外部网页,你的low那台不可以通过high访问,你首先应该先测试在正常情况下,他能否通过邻居查询访问外部网络。
配置邻居访问,你的low配置了,high也要配置。



mygod100 发表于 2014-12-29 16:20

本帖最后由 mygod100 于 2014-12-29 16:22 编辑

woxizishen 发表于 2014-12-29 11:16 static/image/common/back.gif
1.我的意思是下面这一条就够了,你只是限制非这些域名网址通过邻居查询。
cache_peer_access squid_high d ...

1.在squid_low上可以使用squid_high:3128访问,在squid_low上执行结果如下:
squid_low_1>squidclient -p 3128 -h squid_high 163COM
HTTP/1.0 302 Moved Temporarily
Server: Cdn Cache Server V2.0
Date: Mon, 29 Dec 2014 08:16:03 GMT
Content-Length: 0
Location: 163COM
X-Cache: MISS from squid_high
X-Cache-Lookup: MISS from squid_high:3128
Via: 1.0 squid_high (squid/3.1.10)
Connection: close
2.squid_high上面还需要做其它的设置来允许squid_low来访问吗?
页: [1]
查看完整版本: squid如何配置使某些域名的访问到指定的另外一个squid服务器