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

121 thoughts on “Installing Squid Cache for Windows”

  1. hey Sir Markus, when I start squid, windows says “Windows could not start the squid service on local Computer” “Error 1067: The process terminated unexpectedly.”

    before it was working on the same machine, the same configuration.

    thanks

  2. these happened to me

    what i did when it occured was i installed the squid into g: directory. so i change it to c: directory, voila! problems solved.

    anyway thank to mr markus for giving such good manual. one question:

    my ip address is 192.168.1.100, which is not like u said “usually it have 192.168.0.x format so you can apply the configuration above” in step 5 (setup acl). how can i edit the squid.conf file if i want my ip address to be the proxy server.

    btw, great info!

    1. your PC’s LAN IP should be using 192.168.x.x address (or 10.0.x.x), you install squid on the gateway pc on your home network. and the outside network (internet server) will see your public IP if you browse through the proxy

  3. helo markus, thx u for ur guide..:)
    i am using squid on my home .. as for caching only… its working great.
    but i recently added some auth_parameters.

    pls see below…..
    auth_param basic program c:/squid/libexec/ncsa_auth.exe c:/squid/etc/interface/UsersInfo
    auth_param basic children 5
    auth_param basic casesensitive off

    acl all src 0.0.0.0/0.0.0.0
    acl localhost src 127.0.0.1/255.255.255.255
    acl localnet src 10.0.0.0/255.0.0.0
    acl localnet src 192.168.0.0/255.255.0.0
    #acl localnet proxy_auth REQUIRED src 10.0.0.0/255.0.0.0
    #acl localnet proxy_auth REQUIRED src 192.168.0.0/255.255.0.0
    acl our_networks src 192.168.1.1
    acl ncsa_users proxy_auth REQUIRED
    acl sleeping_time time S 00:00-06:00
    acl sleeping_time time M 00:00-06:00
    acl sleeping_time time T 00:00-06:00
    acl sleeping_time time W 00:00-06:00
    acl sleeping_time time H 00:00-06:00
    acl sleeping_time time F 01:00-06:00
    acl sleeping_time time A 01:00-06:00
    http_access deny ncsa_users sleeping_time
    http_access allow ncsa_users

    this script is working.. but i wanna add a admin account[ for emergency needs ]

    i have two acc. right now admin and user1,
    but like u see above all ncsa users will be denied access at night.
    how can i conf it so that it can differentiate two accounts.
    can u assist me here…. :]]

  4. Hello,

    It’s possible to configure so i can access it from outside. For example at work i want to use my home proxy to access some website with my home ip instead of work ?

    thanks you

  5. Not sure I’m reading this incorrectly or not. or if what I’m asking is possible.

    I have a server box with 2 NIC cards. 1 will be connected to an external modem that goes directly out to the internet. the other will be connected to a large internal LAN which I’d like to provide internet access from card 1 to any PC on the internal LAN via HTTP browsing proxy setting I’ve tried setting this up and failed several times. I’m trying to mimic the setup of an old Squid Linux box via windows this time using your guide. So in more detail.

    NIC 1.) (external internet access) 173.xxx.xxx.xxx I can also buy a small router if need be to work properly (wasn’t sure if it was necessary for several connections) I have it setup with a static address that never changes from my cable provider.

    NIC 2.) (internal LAN) 170.17.xxx.xxx (but will also allow access from 170.12.xxx.xxx, 170.10.xxx.xxx, 170.22.xxx.xxx etc etc.)

    Many thanks and much appreciated for your help!!!

    1. yes it should work, first you have to make sure that the windows server can access the internet. then you have to make sure all the clients can connect to the internet through the windows server. only after that you can install squid on the windows server and then setup the proxy settings on client’s PC

  6. while accessing acl’s for bandwidth allocation;

    if acl’s are dynamically updated then squid service has to be restarted.
    can u help me out with better soln wherein squid can read acl’s dat r dynamically updated…

  7. Hi,
    first of all let me apologize for my English school …
    I configured my squid on a W2K8 and works fine, but filled the C: partition and noticed that I have many GB of log files in google I saw that the log files can be automatically split could help me figure out how?

    1. you can stop the squid service, move the log file and create a new empty log file then restart squid again.

      you can also configure squid to put its log file on another partition so it doesn’t fill up your C: drive

  8. Is that possible to install squid cache on same server(web server). Or I need two servers like one for squid cache and one for web-server. Please explain it for me , I am little bit confused with this. And what are the minimum hardware requirements for Squid cache to work properly.

    BTW thanks to write this article.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>