Setup squid proxy server to use multiple outgoing IP addresses

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.

About these ads

Tags: , , , , , ,

14 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.

  8. till Says:

    Hey,

    I know this entry is dated – but anyway, I was wondering, when you configure Squid to do this, does that mean it’ll advertise multiple IPs at the same time to a server.

    E.g., in our logs I saw: “127.0.0.1, 127.0.0.2, 127.0.0.3″, where usually I saw “127.0.0.1” (these are examples, of course).

    And then, if this is it – why do people need to advertise multiple IPs at the same time? I always thought that you assign a pool and it will “randomly” pick one instead.

    Cheers,
    Till

  9. Markus Says:

    >> perl script for him to generate squid acl and tcp_outgoing_address directives for all IPs.

    link is dead, any way to get the script?

  10. wahid Says:

    thanks, i just knew that there is “myip” parameter

  11. Welcome we’re Hacksomeone and we could jump at the chance to present you some unique hacks! Hacksomeone is a day by day redesigned web space who hunt the web down you! We’re not enjoy most hacksites sharp at one sort of hack. We actually hunt all arou Says:

    Welcome we’re Hacksomeone and we could jump at the chance to present you some unique hacks! Hacksomeone is a day by day redesigned web space who hunt the web down you! We’re not enjoy most hacksites sharp at one sort of hack. We actually hunt all aro…

    […]Setup squid proxy server to use multiple outgoing IP addresses « Azaad Source[…]…

  12. Andersen Says:

    I know the thread is old – but, thank you…

    Solved my issue…

  13. Nice Says:

    thanks for the script

    but can you customize it to be working under centos ?

    i tried to change the em0 to eth0:0 for example but it only show that interface address and not doing it to all

    ? thanks a lot

  14. Proxy Sites Says:

    Proxy Sites…

    […]Setup squid proxy server to use multiple outgoing IP addresses « Azaad Source[…]…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: