Squid 3.2-具有单个用户身份验证的随机出站 IP 的正确配置?

Squid 3.2-具有单个用户身份验证的随机出站 IP 的正确配置?

我正在尝试对 Squid 3.2 使用 AclRandom,但我觉得我对正确的方法有点困惑。这是我的配置:

http_port 3128
auth_param basic program /usr/local/squid32/libexec/basic_ncsa_auth /usr/local/squid32/etc/passwords
auth_param basic children 5
auth_param basic realm proxy
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
acl my_auth proxy_auth REQUIRED
http_access allow my_auth

max_filedesc 32768

acl randomIP random 1/3
tcp_outgoing_address x.154.198.x randomIP
tcp_outgoing_address x.154.198.x randomIP
tcp_outgoing_address x.154.198.x randomIP

tcp_outgoing_address x.154.198.x

forwarded_for delete
via off

而且它总是使用列表中的第一个 IP 地址。有人知道我如何让它随机使用这 3 个地址中的一个吗?此外,我请求的任何网站都收到大量 TCP_MISS,还有其他什么看起来很奇怪吗?

编辑:更新潜在解决方案:

http_port 3128
auth_param basic program /usr/local/squid32/libexec/basic_ncsa_auth /usr/local/squid32/etc/passwords
auth_param basic children 5
auth_param basic realm proxy
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
acl my_auth proxy_auth REQUIRED
http_access allow my_auth
http_access allow localhost
http_access deny all

max_filedesc 32768

authenticate_ttl 5 seconds
authenticate_ip_ttl 1 seconds

acl r_14 random 1/14
acl r_13 random 1/13
acl r_12 random 1/12
acl r_11 random 1/11
acl r_10 random 1/10
acl r_9 random 1/9
acl r_8 random 1/8
acl r_7 random 1/7
acl r_6 random 1/6
acl r_5 random 1/5
acl r_4 random 1/4
acl r_3 random 1/3
acl r_2 random 1/2
acl r_1 random 1/1

tcp_outgoing_address x.x.198.145 r_14
tcp_outgoing_address x.x.198.146 r_13
tcp_outgoing_address x.x.198.147 r_12
tcp_outgoing_address x.x.198.148 r_11
tcp_outgoing_address x.x.198.149 r_10
tcp_outgoing_address x.x.198.150 r_9
tcp_outgoing_address x.x.198.151 r_8
tcp_outgoing_address x.x.198.152 r_7
tcp_outgoing_address x.x.198.153 r_6
tcp_outgoing_address x.x.198.154 r_5
tcp_outgoing_address x.x.198.155 r_4
tcp_outgoing_address x.x.198.156 r_3
tcp_outgoing_address x.x.198.157 r_2
tcp_outgoing_address x.x.198.158 r_1

tcp_outgoing_address x.x.198.148

forwarded_for delete
via off

答案1

在线文档中有一个三向分割的示例。每个步骤都会带走到达该步骤的一部分流量,而不是所有流量的一部分。

  • 从所有流量开始,取 1/3 剩下 2/3。
  • 取2/3的一半,留下1/3
  • 拿走剩下的 1/3

Squid-Cache-Wiki:功能:ACL 类型“随机”

acl third random 1/3
acl half random 1/2

tcp_outgoing_address x.154.198.x third
tcp_outgoing_address x.154.198.x half
tcp_outgoing_address x.154.198.x

您的配置有 1/3、1/3、1/3,所有这些结果都是:

  • 从全部开始取 1/3,剩下 2/3
  • 取 2/3 的 1/3(2/9),剩下 4/9
  • 取 4/9 的 1/3(4/27),剩下 8/27
  • 参加剩余的 8/27

如果您的第一个和第四个传出地址相同,那么它将获得 17/27 的流量。

相关内容