Can Squid be configured to use the incoming IP address as the outgoing Address if multiple IPs are used on the server

bindPROXYsquid

At the moment I have to define rules for all local ips like this:

acl ip1 localip 1.1.1.1/32
tcp_outgoing_address 1.1.1.1 ip1
acl ip2 localip 2.2.2.2/32
tcp_outgoing_address 2.2.2.2 ip2
acl ip3 localip 3.3.3.3/32
tcp_outgoing_address 3.3.3.3 ip3

As I need to configure several server adn they always have different ips I would like to configure squid in a way that always the same address that is used as incoming address is also used as outgoing address.

Is this possible?

I am also open to other solutions. I tried tinyproxy, which has the "bindsame" option for this, but lacks the possibility to define external authentication scripts.
I also need external authentication via a program which squid is able to do.

Best Answer

Short answer: Based on my research, squid does not support anything like tinyproxy's "BindSame".

Details: I have been researching this very topic because I am in precisely the same situation as you: I want to use tinyproxy for the BindSame configuration, but I need authentication, which tinyproxy does not support. Unfortunately, my conclusion is that squid does not have an equivalent to tinyproxy's BindSame. I can see no other directive that could be used to specify the outgoing IP address.

From squid reference documentation, we see that the tcp_outgoing_address directive requires a specific IP address as an argument. It won't accept something like "same" or a variable from a matching ACL.

I wish I had a more favorable answer for you, because if I did, I'd be using it, too!

Related Topic