Setup squid proxy server to use multiple outgoing IP addresses

By Hameedullah Khan

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.

Tags: , , , , , ,

7 Responses to “Setup squid proxy server to use multiple outgoing IP addresses”

  1. Generating squid “myip acl” and tcp_outgoing_address for all your IPs on FreeBSD « Azaad Source Says:

    [...] Azaad Source it is all about freedom… « Setup squid proxy server to use multiple outgoing IP addresses [...]

  2. dimitry Says:

    i was looking for this, but i didn’t know the parameter “myip” :)
    thanks!

  3. Hameedullah Khan Says:

    I am happy I was of help for someone.

  4. Adam Says:

    Will this work if I want my proxy server to allow access to multiple external IP addresses?

  5. Hameedullah Khan Says:

    @Adam
    no, the above configuration is to allow use of multiple IPs on your proxy server as outgoing IPs.

  6. Chris Says:

    I have a list of IP addresses(outbound) which I need the proxy server randomly assign the users who enter to the proxy. Is this possible?

  7. Jorny Says:

    Thanks for your tiny! Now I succefully conquer the problem squid with multi-IP.

Leave a Reply