A friend of mine needed my help to configure squid server to use multiple IP addresses based on the squid’s IP being used as proxy server. I told him that he can configure the squid server using following squid acls and tcp_outgoing_address directives.
acl ip1 myip 192.168.1.2
acl ip2 myip 192.168.1.3
acl ip3 myip 192.168.1.4
tcp_outgoing_address 192.168.1.2 ip1
tcp_outgoing_address 192.168.1.3 ip2
tcp_outgoing_address 192.168.1.4 ip3
The acl lines tell squid to match myip which means if someone uses the IP 192.168.1.2 as their proxy server they will match the acl ip1 and so on..
Update: But his problem was not solved by this, because he had to configure squid for 500+ IPs and doing this by hand is not worth it when you have so many languages out there. So I wrote a small perl script for him to generate squid acl and tcp_outgoing_address directives for all IPs.