I have been playing with a few different pieces of forward proxy software, primarily CCProxy and Squid Proxy/Cache. What I have is a dedicated server with a single NIC with multiple IPs assigned to it. One IP is static and the rest are dynamic. The static IP acts as a primary address, which is how I access my proxy server, the others are dynamic ip addresses for web scraping and other tasks. I have created a proxy in CCProxy and it allows you to link a user to a specific outbound ip address, this is really useful for what I am doing, allowing me to assign different tasks to different IPs.
So what I was wondering if this was possible to do in Squid Proxy?
I love how customisable Squid is but I really could do with this feature.
Thanks in advance,
Joe
Best Answer
The option to do this is
tcp_outgoing_address
:"outgoing IP address" really means "source IP". Now you can choose an acl to distinguish your user by any available mean, client's IP (
acl ... src ...
), simple proxy authentication (auth_param
+basic_ncsa_auth
) etc.Example adapted from documentation, using source IP as selector, where the squid server would be owning various IPs in the
192.0.2.0/24
LAN with its primary IP192.0.2.1
. Adding this to the typical samplesquid.conf
:will allow clients from
allowed_clients
, and have them use outgoing IP192.0.2.10
, except for client from198.51.100.174
which will get192.0.2.174
. Any other client configured elsewhere than in this example would use192.0.2.5
and the server's primary IP will never be used.