Squid代理:如何使用ipv6地址发送请求

问题描述 投票:1回答:1

我在一台数字海洋ubuntu机器上安装了Squid

我想要做的是:我将向这个代理服务器发送一个ipv4地址,我需要选择并使用iPv6中配置的squid.conf地址。我在conf文件中添加了2个ipv6地址。

如果我通过将地址指定为ipv6来尝试以下命令,它可以正常工作。

curl -H 'Cache-Control: no-cache' --proxy localhost:3128 [2400:xxx:x:xx::xxx:a001]

即,它将从conf文件中选择一个随机的ipv6地址,并通过该IP地址发送请求。

如果我通过将地址指定为ipv4来尝试以下命令,则它无效

curl -H 'Cache-Control: no-cache' --proxy localhost:3128 34.xxx.xxx.148

即,它没有选择conf文件中指定的ipv6地址。相反,它使用服务器公共IP。

我的/etc/squid/squid.conf文件内容现在就是这样的。

acl one_fourth_3 random 1/2
acl one_fourth_4 random 1/1
tcp_outgoing_address 2604:xxxx:xxx:xxx::xx:a001 one_fourth_3
tcp_outgoing_address 2604:xxxx:xxx:xxx::xx:a002 one_fourth_4

http_access deny !safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access allow localhost
http_access allow all
http_access deny all
http_port 3128

我的鱿鱼版是

Squid Cache: Version 3.5.12
Service Name: squid
proxy ipv6 squid
1个回答
0
投票

Squid隐式使用IP版本,您应该使用或强制使用IPv6。

Squid将为每一行添加一个隐式IP版本测试。

访问IPv4网站的请求将使用传出的10.1.0。*地址。

访问IPv6网站的请求将使用传出的2001:db8:*地址。

http://www.squid-cache.org/Doc/config/tcp_outgoing_address/

© www.soinside.com 2019 - 2024. All rights reserved.