Running Squid proxy on a specific IP, not the main server IP - how?

tomfra

Well-Known Member
Sep 30, 2002
68
1
158
Hi everyone,

I have successfully installed Squid on my server (VPS, CentOS 4.4, CPanel) and it runs just fine. However, there is a small problem that's driving me crazy...

I have more than one IP address on the server. Let's say the main server IP is 1.2.3.4, it's the IP address for the main DNS server etc. Then I have another IP address - let's say 1.2.3.5 that's also assigned to my server. I can ping it with no problems.

Now, what I would like to do is to force Squid to listen on the second IP only so I edit squid.conf with something like:

http_port 1.2.3.5:8080

This indeed makes Squid to listen only on the IP 1.2.3.5 and port 8080 and everything seems to work as intended. Except for one detail...

Despite Squid is listening and accepting connections on the second IP, it reveals the first/main server IP to the destination page. Even if I config my Firefox or MSIE to use IP 1.2.3.5, port 8080, services such as http://www.danasoft.com/vipersig.jpg tell me my IP is 1.2.3.4 .

Do you have an idea what could be causing this?

Thanks!

Tomas
 

tomfra

Well-Known Member
Sep 30, 2002
68
1
158
OK, I got the answer elsewhere meanwhile. In case someone else is wondering about the same thing as I did, you need to set udp_outgoing_address, tcp_outgoing_address in squid.conf to the IP you want to use.

Tomas
 

p.kiula

Member
Sep 13, 2007
20
0
51
Hello tomfra, could you share with this forum how you got squid working? Installing is easy, but how have you configured it, and is it any good -- for instance, how do you make sure that if I edit and update a file that has been cached by Squid, it should be refreshed in the cache? Also, does it cache non-static files? Thanks in advance!
 

tomfra

Well-Known Member
Sep 30, 2002
68
1
158
Well, it wasn't that difficult to make it work, the sample config files I found helped me a lot as well as the docs at visolve.com . I am using the 3.0 branch.

My setup is somewhat special - I am not using Squid for caching but instead in conjunction with SSH tunnelling to provide "anonymization". It's all a bit complex and I do not want to go into detail for now. I am not really a "Squid guru". I found a lot of answers at http://www.experts-exchange.com . I can show you my config file if you want but as I said, it's a special purpose one and may be useless for you.

Tomas


Hello tomfra, could you share with this forum how you got squid working? Installing is easy, but how have you configured it, and is it any good -- for instance, how do you make sure that if I edit and update a file that has been cached by Squid, it should be refreshed in the cache? Also, does it cache non-static files? Thanks in advance!