Installing Squid Cache for Windows
Linux users mostly already know Squid proxy server as the best and most used proxy server. As on my previous post “Bandwidth Shaping Using Squid Cache and WIPFW” I need a free proxy server for my windows server. I found SquidNT which is ported from its Linux version by Guido Serassio.
You can download SquidNT from Acme Consulting’s website or here. If you want to do bandwidth shaping then you must download SquidNT with Delay Pool version. On this installation guide, I use the Delay Pool version as I want to do bandwidth shaping.
Step 1: download SquidNT Delay Pool version here
Step 2: extract the zip file and put it on C: drive
Step 3: configure the squid.conf file on /etc folder. There is squid.conf.default you can rename it to squid.conf and edit it.
Step 4: configure the DNS nameserver. On squid.conf find:
# TAG: dns_nameservers
# Use this if you want to specify
# a list of DNS name servers (IP addresses)
# to use instead of those given in your
# /etc/resolv.conf file.
#
# Example: dns_nameservers 10.0.0.1 192.172.0.4
#
#Default:
# none
dns_nameservers 192.168.0.1
To find what is your nameserver is type: ipconfig on command prompt and find the IP number on Default Gateway field. Copy it to your squid.conf file like above.
Step 5: setup ACL
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from
# where browsing should be allowed
#acl our_networks src 192.168.1.0/24 192.168.2.0/24
#http_access allow our_networks
acl our_networks src 192.168.0.0/16
http_access allow our_networks
Here you can setup which network that allowed to use your proxy server. From ipconfig command you can find out what is your IP address, usually it have 192.168.0.x format so you can apply the configuration above.
Step 6: Setup the hostname
# TAG: visible_hostname
# If you want to present a special hostname …
# then define this. Otherwise, the return …
# will be used. If you have multiple caches …
# get errors about IP-forwarding you must …
# names with this setting.
#
#Default:
# none
visible_hostname localhost
Here you can define the name for your hostname, for example you can use “localhost” or “server.youdomain.com”
Step 7: Setup cache directory
Run this command from command prompt: c:\squid\sbin\squid -D –z
Step 8: On Windows XP/2000/2003 you can setup SquidNT as a service
Run this command from command prompt: c:\squid\sbin\squid –i
You can start/stop/restart the service called Squid from: Control Panel > Administrative Tools > Services
Step 9: Setup your browser to use proxy server
For Internet Explorer users, go to: Tools > Internet Options. Select Connection tab and click on LAN Settings
On the pop up window you’ll find proxy box, give a check on “Use a proxy server for your LAN…” and fill your server’s IP (where you install SquidNT) on the address field and fill “3128” on port field. 3128 is the default port for SquidNT.
Click Ok to save the configuration. Now try to open a web page and see if you can open it. If you can then the configuration is set correctly.
Step 10: Setup the Delay Pool.
As I want to do bandwidth shaping then I needs to setup the Delay Pool. Here is the configuration:
#
#Default:
# delay_pools 0
delay_pools 1
delay_class 1 1
Then create delay_access:
# delay_access 2 allow lotsa_little_clients
# delay_access 2 deny all
#
#Default:
# none
delay_access 1 allow our_networks
delay_access 1 deny all
Now we setup how much bandwidth we want to allocate. For example, you have 384 Kbps ADSL connection which means you can download at around 40KB/s. Now you want to shape the maximum to around 30KB/s download rate, here is the configuration:
#
#delay_parameters 2 32000/32000 8000/8000 600/8000
#
# There must be one delay_parameters line for each delay pool.
#
#Default:
# none
delay_parameters 1 30000/30000
Step 11: Restart the Squid service from: Control Panel > Administrative Tools > Services
Done! Now you have 30KB/s for browsing and another 10KB/s reserved for other internet connection like chatting or streaming radio ![]()
June 20th, 2007 at 9:07 am
i’ve tried this configuration..
i can successfully block few websites i want.
but then, i also can’t open any other web.
the progress bar just won’t move.
please help
June 20th, 2007 at 10:17 am
check your firewall configuration, if you have it installed on your computer.
August 2nd, 2007 at 2:47 pm
thanks for this configurations and for the documentations… It has less problems in wired LAN configurations based on my experience, but when we have our wireless LAN the squid proxy service would automatically shutdown or stop… Especially when all the clients are now online accessing different websites, what would be possible cause of this? I change the cache but still not works.. by the way we are using 20 workstations running windows xp and the server running windows 2003 with squid server 2.6 same with you have presented..
August 2nd, 2007 at 5:59 pm
tahder, squid doesn’t have anything to do with network connection type. whether its wired or wireless it should be working.
on my network some user connect via cable and some using wireless connection and both didn’t have problem connecting to the internet.
August 3rd, 2007 at 3:00 am
Markus, thanks for this nice guide..i’ve successfully configured my squid and it runs perfectly..just one question, aside from caching web pages, i also want my squid to cache video streaming on youtube etc..i tried the instruction explained on this page: http://wiki.squid-cache.org/ConfigExamples/DynamicContent but it didnt work..i could suft youtube site but when i tried to view some videos, those video just didnt load..any idea?
August 3rd, 2007 at 9:37 am
Hi Kucing Hitam,
i tried that configuration. I put that config on squid.conf so it looks like this:
I visit you tube and I can open the streaming videos there. but it seems that the videos didn’t get cached.
try to refresh your browser if the video didn’t load, and important thing is that to view videos on youtube.com your web browser must have flash player installed
August 28th, 2007 at 10:39 pm
thanks for the documentation. I’ve got squid up and running so far so good. There is one part of your instructions that has left me confused and I am not able to find answers. In the section where you explain the ACL setup, you put 192.168.0.0/16 for those who have the default 192.168.0.x network. I have a network with 10.0.0.x so therefore i have put 10.0.0.0/16 but the part i am confused about is, what exactly is the /16 for? does that mean i can have from 0-16 at the end of the IP? if this is so, how do i enable all the way to 254? as my IP ranges start from 1 and hop all the way to about 225
August 29th, 2007 at 12:39 am
I am just wondering if i set the delay_parameters to the following:
delay_parameters 1 50000/50000
will that give me 50KB/Sec on the entire connection? and then spread it out between all the clients? or will it give each client 50KB?
September 4th, 2007 at 10:21 pm
Can squid for windows be used to block access to specific urls or keywords? I found the program squidguard that performs these tasks, but it appears to be a linux program only.
September 4th, 2007 at 11:26 pm
yes, have a look at configuration file squid.conf. on ACL part you can see some example.
try search on “acl blockfiles urlpath_regex”
March 9th, 2008 at 2:47 pm
Thanks for nice configuration guide
But i’ve a problem on starting squid service
when i type c:\squid\sbin\squid -i, error message appear “CreateService failed”.
when i type c:\squid\sbin\squid, it appear “abnormal program termination”
March 9th, 2008 at 8:04 pm
did you run the squid as administrator? it seems that you don’t have the privilege to install services
March 17th, 2008 at 11:58 am
[...] For guide on SquidNT installation please see my post: Installing Squid Cache for Windows [...]
March 20th, 2008 at 9:20 pm
hello thanks for these exemple of configuration
Is there a plugin to redirect to windows antivirus like squidclam ?
April 26th, 2008 at 3:23 am
Great guide, it gave me a crash course on how to get this going!
Ahmed, as for your question regarding the 192.168.0.0/16 address. The 16 at the end represents a class B subnet, that is 255.255.0.0. There are 8 bits per octet for a total of 32 bits. this means taht his network address is 192.168.x.x leaving the last two octets(represented by x) for host addresses.
Hope that helped.
September 17th, 2008 at 11:54 am
Thanks for the config guide especially the starting as a service bit.
Other sites say you can create a whitelist using squid that will only allow only the sites listed in the file to be access while the rest are blocked.
The lines added in are - acl white dstdomain “/etc/squid/whitelist” and http_access deny !white. you then create a file in that location listing locations.
http://heifner.blogspot.com/2007/04/simple-whitelist-internet-filter.html is an example
Can you advise what needs to change in this so it can work using a windows machine rather that linux as i have tried various changes with no luck.
Any help would be appreciated.
September 17th, 2008 at 1:57 pm
@nezzal, the configuration between the windows and linux version are the same, so if that config work on linux, then it should work on windows too (except for “transparant proxy”, this feature is not available on windows version yet).
you’ll need to change the path of the whitelist file into something like “C:\squid\conf\whitelist” and makesure it’s readable
September 18th, 2008 at 3:32 am
MARKUS… YOU ROCK!
I got it working. Thanks for the walkthrough, dude !
One of the few CFG stuff that got it up and running. But I got a question, in the browser’s settings I must use the proxy as the interface’s IP address not as localhost.. what’s the workaround for that to accept the localhost phrase? I mean what if I join another network with another ip address.
September 18th, 2008 at 3:46 am
@khaled, localhost will always point to the computer itself, you can only use “localhost” only if you setup the proxy on the same computer where you use to browse the internet.
if you for example setup the proxy on computer A and browse from computer B, then you have to use computer A’s IP address as the proxy address on your browser.
October 26th, 2008 at 4:35 am
[...] Installing Squid Cache for Windows [...]
November 18th, 2008 at 9:07 am
[...] Installing Squid Cache for Windows [...]
November 20th, 2008 at 11:24 am
Hi Markus,
Thanks for clear explanation on you TUT, btw I have a problem when I try to enter “www.LiveConnector.com/Chat/” I got an error message “Connection attemp failed”, I’ve already using the latest flash player, but still got the same message. Is there any port do I have to set in the acl Safe_Ports section and what port is that?
kind regards,dblog
November 20th, 2008 at 11:32 am
Hi Markus,
Is there a way to install squid not in the default folder “c:” but in other folder “d:”?
I’ve try to replace all “c:/squid” with “d:/squid” in squid.conf but it always failed to run it says “abnormal program termination”
hmmm…. still wondering what makes that error… T_T
warm regards,
dblog
November 20th, 2008 at 11:37 am
@dblog
i think http://www.LiveConnector.com/chat/ is broken i can’t open it even without proxy, firefox says it’s an infinite loop url
i haven’t test to run squid on d: drive, but you can change the directory where squid NT store its cache if i’m not mistaken