Category Archives: Squid

Squid Multiple Outgoing IP

I got lots of queries from Fellow VPS server Administrators on using all of IPs provided by provider for browsing the internet and rotating the IP addresses for squid multiple outgoing ip

When squid server is configured by using following squid acls and tcp_outgoing_address directives we can use all of IPs that are assigned.Here is configuration of  squid multiple outgoing IP address using tcp_outgoing_address

acl myip1 myip 10.0.11.2
acl myip2 myip 10.0.11.3
acl myip3 myip 10.0.11.4

tcp_outgoing_address 10.0.11.2 myip1
tcp_outgoing_address 10.0.11.3 myip2
tcp_outgoing_address 10.0.11.4 myip3

Here I take 10.0.11.2 -10.0.11.4 as your assigned IP

The acl lines tell squid to match myip which means if someone uses the IP 10.0.1.2 as their proxy server they will match the acl ip1 and so on..

Squid Reverse proxy

We can use squid as a reverse proxy for sharing a public IP with multiple server as well as web acceleration.

Below is the configuration of squid.conf for the purpose of having multiple domains in private IP and that is accessed from the same proxy

# External Port no for squid reverse proxy
http_port 8080 accel vhost

# directive to tell Squid the IP address of the servers 192.168.0.6-7 are private ip address hosted inside the network
cache_peer 192.168.0.6 parent 80 0 no-query no-digest originserver name=server1
cache_peer 192.168.0.7 parent 80 0 no-query no-digest originserver name=server2
cache_peer 192.168.0.8 parent 80 0 no-query no-digest originserver name=server3

acl sites_server1 dstdomain server1.domain.com
acl sites_server2 dstdomain server2.domain.com
acl sites_server3 dstdomain server3.domain.com

cache_peer_access server1 allow sites_server1
cache_peer_access server2 allow sites_server2
cache_peer_access server3 allow sites_server3

http_access allow sites_server1
http_access allow sites_server2
http_access allow sites_server3

Here 192.168.0.X are internal IPs and serverX.domain.com are  web address that is routed to corresponding internal websites.

Thanks to :

http://www.sweetnam.eu/index.php/Reverse_Proxy_with_Squid