| Subcribe via RSS

Installing Squid Cache for Windows

June 10th, 2007 Posted in Information Technology

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, click 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: http://squid.acmeconsulting.it/download/squid-2.6.STABLE12-bin-DELAYP.zip

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 :)

Markus

Related Posts

15 Responses to “Installing Squid Cache for Windows”

  1. R960XT Says:

    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


  2. Markus Says:

    check your firewall configuration, if you have it installed on your computer.


  3. tahder Says:

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


  4. Markus Says:

    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.


  5. kucinghitam Says:

    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?


  6. Markus Says:

    Hi Kucing Hitam,

    i tried that configuration. I put that config on squid.conf so it looks like this:

    #Default:
    # dead_peer_timeout 10 seconds
     
    # Let the clients favourite video site through
    acl youtube dstdomain .youtube.com
    cache allow youtube
     
    #  TAG: hierarchy_stoplist
    #	A list of words which, if found in a URL, cause the object to
    #	be handled directly by this cache.  In other words, use this
    #	to not query neighbor caches for certain objects.  You may
    #	list this option multiple times. Note: never_direct overrides
    #	this option.
    #We recommend you to use at least the following line.
    hierarchy_stoplist cgi-bin ?

    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


  7. Ahmed Says:

    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


  8. Ahmed Says:

    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?


  9. Ryan Says:

    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.


  10. Markus Says:

    yes, have a look at configuration file squid.conf. on ACL part you can see some example.

    try search on “acl blockfiles urlpath_regex”


  11. kyaw tun Says:

    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”


  12. Markus Says:

    did you run the squid as administrator? it seems that you don’t have the privilege to install services


  13. Bandwidth Shaping Using Squid Cache and WIPFW | Markus Blog Says:

    […] For guide on SquidNT installation please see my post: Installing Squid Cache for Windows […]


  14. maison9 Says:

    hello thanks for these exemple of configuration
    Is there a plugin to redirect to windows antivirus like squidclam ?


  15. Byblyk Says:

    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.


Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word