免费注册 查看新帖 |

Chinaunix

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

[其他] squid如何配置使某些域名的访问到指定的另外一个squid服务器 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2014-12-26 17:25 |只看该作者 |倒序浏览
有两台squid服务器:
1.squid_high:
  1. http_port 3128
  2. icp_port 0
  3. snmp_port 0

  4. acl route_vps_domain dstdomain "/etc/squid/route_vps_domain"
  5. http_access allow route_vps_domain
  6. http_access deny !route_vps_domain
  7. http_access allow all
复制代码
2.squid_low:
  1. http_port 3128
  2. icp_port 0
  3. snmp_port 0

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

  6. cache_peer_access squid_high allow route_vps_domain
  7. cache_peer_access squid_high deny !route_vps_domain

  8. 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,请问应该如何正确设置啊?谢谢!

论坛徽章:
24
天蝎座
日期:2014-05-13 18:05:59IT运维版块每日发帖之星
日期:2015-11-26 06:20:00操作系统版块每月发帖之星
日期:2015-12-02 14:57:54IT运维版块每月发帖之星
日期:2016-01-07 23:01:56IT运维版块每周发帖之星
日期:2016-01-07 23:04:2615-16赛季CBA联赛之青岛
日期:2016-01-23 07:58:272016猴年福章徽章
日期:2016-02-18 15:30:3415-16赛季CBA联赛之北控
日期:2016-03-23 14:20:06IT运维版块每日发帖之星
日期:2016-04-01 06:20:0015-16赛季CBA联赛之吉林
日期:2016-06-28 13:51:54IT运维版块每日发帖之星
日期:2016-07-01 06:20:00IT运维版块每日发帖之星
日期:2015-11-23 06:20:00
2 [报告]
发表于 2014-12-27 16:57 |只看该作者
本帖最后由 woxizishen 于 2014-12-27 16:58 编辑



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这台访问吗?好好检查下,你的配置只发这么一点,怎么帮。


论坛徽章:
0
3 [报告]
发表于 2014-12-29 09:54 |只看该作者
本帖最后由 mygod100 于 2014-12-29 09:55 编辑
woxizishen 发表于 2014-12-27 16:57
cache_peer squid_high parent 3128 0 no-query no-digest no-netdb-exchange
允许通过邻居访 ...


1. 这两台独立运作时正常的,测试时用squidclient分别可以单独获取可以共同访问的163首页(不好意思论坛没权限发表URL,下用163COM代替):
squid_low:
  1. squidclient -p 3128 -h squid_low 163COM
  2. HTTP/1.0 302 Moved Temporarily
  3. Server: Cdn Cache Server V2.0
  4. Date: Mon, 29 Dec 2014 01:23:15 GMT
  5. Content-Length: 0
  6. Location: 163COM
  7. X-Cache: MISS from squid_low
  8. X-Cache-Lookup: MISS from squid_low:3128
  9. Via: 1.0  squid_low:3128 (squid/2.6.STABLE21)
  10. Proxy-Connection: close
复制代码
squid_high:
  1. squidclient -p 3128 -h squid_high 163COM
  2. HTTP/1.0 302 Moved Temporarily
  3. Server: Cdn Cache Server V2.0
  4. Date: Mon, 29 Dec 2014 01:22:33 GMT
  5. Content-Length: 0
  6. Location: 163COM
  7. X-Cache: MISS from squid_high
  8. X-Cache-Lookup: MISS from squid_high:3128
  9. Via: 1.0  squid_low (squid/3.1.10)
  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的方式各自走原来的通道访问。

论坛徽章:
24
天蝎座
日期:2014-05-13 18:05:59IT运维版块每日发帖之星
日期:2015-11-26 06:20:00操作系统版块每月发帖之星
日期:2015-12-02 14:57:54IT运维版块每月发帖之星
日期:2016-01-07 23:01:56IT运维版块每周发帖之星
日期:2016-01-07 23:04:2615-16赛季CBA联赛之青岛
日期:2016-01-23 07:58:272016猴年福章徽章
日期:2016-02-18 15:30:3415-16赛季CBA联赛之北控
日期:2016-03-23 14:20:06IT运维版块每日发帖之星
日期:2016-04-01 06:20:0015-16赛季CBA联赛之吉林
日期:2016-06-28 13:51:54IT运维版块每日发帖之星
日期:2016-07-01 06:20:00IT运维版块每日发帖之星
日期:2015-11-23 06:20:00
4 [报告]
发表于 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也要配置。



论坛徽章:
0
5 [报告]
发表于 2014-12-29 16:20 |只看该作者
本帖最后由 mygod100 于 2014-12-29 16:22 编辑
woxizishen 发表于 2014-12-29 11:16
1.我的意思是下面这一条就够了,你只是限制非这些域名网址通过邻居查询。
cache_peer_access squid_high d ...


1.在squid_low上可以使用squid_high:3128访问,在squid_low上执行结果如下:

  1. squid_low_1>squidclient -p 3128 -h squid_high 163COM
  2. HTTP/1.0 302 Moved Temporarily
  3. Server: Cdn Cache Server V2.0
  4. Date: Mon, 29 Dec 2014 08:16:03 GMT
  5. Content-Length: 0
  6. Location: 163COM
  7. X-Cache: MISS from squid_high
  8. X-Cache-Lookup: MISS from squid_high:3128
  9. Via: 1.0 squid_high (squid/3.1.10)
  10. Connection: close
复制代码
2.squid_high上面还需要做其它的设置来允许squid_low来访问吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP