我有一个Linux Debian机器,它有很多运行Squid的networking接口(venet0:1到venet0:5)。 如果我连接到接口venet0:2 squid使用venet0:0作为传出stream量,但我希望Squid使用相同的networking接口进行连接。 所以如果我连接到venet0:1的IP地址,代理也应该使用相同的接口传出stream量。
目前我使用以下configuration:
http_port 200 forwarded_for off uri_whitespace encode visible_hostname localhost via off collapsed_forwarding on auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/users auth_param basic children 5 auth_param basic realm Proxy auth_param basic credentialsttl 2 hours auth_param basic casesensitive off acl ncsa_users proxy_auth REQUIRED access_log none cache_store_log none cache_log /dev/null acl all src all http_access allow ncsa_users header_access From deny all header_access Referer deny all header_access Server deny all header_access User-Agent allow all header_access WWW-Authenticate deny all header_access Link deny all header_access Accept-Charset deny all header_access Accept-Encoding deny all header_access Accept-Language deny all header_access Content-Language deny all header_access Mime-Version deny all
我已经从http://www.tastyplacement.com/squid-proxy-multiple-outgoing-ip-addresses尝试了教程,但我不认为我可以使用它,因为我使用ncsa而不是使用源ip对用户进行身份validation地址。
有没有可能使鱿鱼使用正确的networking接口? 如果我可以避免ACL规则将是很好的,因为这将需要改变一个IP地址的configuration更改。
最好的解决scheme是为每个接口创build一个acl,使到该接口的所有请求都属于该组,并将该组redirect到特定的出接口。
例:
服务器X具有以下IP:
因此,squid.conf文件应该是这样的:
acl 10_0_0_1 localip 10.0.0.1 tcp_outgoing_address 10.0.0.1 10_0_0_1 acl 10_0_0_2 localip 10.0.0.2 tcp_outgoing_address 10.0.0.2 10_0_0_2 acl 10_0_0_3 localip 10.0.0.3 tcp_outgoing_address 10.0.0.3 10_0_0_3
然后任何对“10.0.0.1”的请求将使用“10.0.0.1”接口,任何对“10.0.0.2”的请求将使用“10.0.0.2”接口等等。
我知道这是一个老问题,但由于它仍然是第一个谷歌search结果,它仍然是有效的发布正确的答案。
它是在acl中configuration的,所以在这行之后:
acl youracl src IP.Ad.Res.Of venet:0:2
添加以下内容:
tcp_outgoing_address 192.168.1.1 youracl
您需要与您列出的链接类似的东西,但方法不同。 假设VEIP1表示venet0:1的IP地址。
acl ncsa_users proxy_auth REQUIRED http_access deny!ncsa_users
acl ve1acl localip VEIP1 http_access allow ve1acl ncsa_users tcp_outgoing_address VEIP1 ve1acl
acl ve2acl localip VEIP2 http_access allow ve2acl ncsa_users tcp_outgoing_address VEIP2 ve2acl
(我想你可以找出其余的模式。)
另外,我想你必须删除上面的http_access allow ncsa_users行,因为我们现在要用户进行身份validation并连接到这些特定的IP之一。
PS我从来没有configuration鱿鱼,所以我不积极这是完整的答案。 但是从阅读文档,我很欣慰地说这是正确的方向。 祝你好运,让我知道它是怎么回事!