Sunday, March 25, 2007

IPKungfu, Squid Screwed on Edgy... Nah!

Whew! I almost thought that I could no longer use my trusted combination of IpKungfu and Squid for a transparent proxy setup on our local intranet here at the Community eCenter of Gerona.

Yesterday, I upgraded our router/squid/samba/printer server from Ubuntu Dapper to Ubuntu Edgy Eft via a fresh install.

To my horror, as I tried to run ipkungfu from the terminal... it won't run leaving several lines of error warnings! I did some research with Mr. Google in which I find out that I only have to open /usr/sbin/ipkungfu...
sudo gedit /usr/sbin/ipkungfu
and change the first line to...
and then my IpKungfu started to work flawlessly.

Then next is Squid. When I tried the same configurations I used on this blogpost, Squid won't start with matching errors (again!).

After a few seconds Googling the net, I found out that I no longer have to setup the lines below on Squid version 2.6 (Dapper uses the older version)...
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
Instead, all I have to do is to change the http_port tag at the squid configuration file from "http_port 3128" to "http_port 3128 transparent" and that's it!

Now Ipkungfu and Squid works well hand in hand (and a bit zippier!) on my Ubuntu Edgy Eft box as if it was configured by a pro. :)

Online Resources: Transparent Caching on Squid 2.6 and Ipkungfu on Edgy Eft.

Friday, March 16, 2007

My basic Squid Proxy configuration

A certain Albuemil asked thru a comment on this blog on how I configured my Squid proxy. So here I am sharing what I learned via PLUG mailing list (special mention to AC Perdon for his excellent instructions) on how to configure Squid proxy. Warning: I am no computer expert and so I welcome additional information to enrich my Linux experience.

First install squid via apt-get or synaptic:
sudo apt-get install squid
After installation, edit Squid's configuration file:
sudo gedit /etc/squid/squid.conf
In the /etc/squid/squid.conf file, search and edit the following options/tags:

http_port 3128

cache_mem (1/4 of the your RAM) MB

(e.g. assuming your RAM is 1Gb then its "cache_mem 250 MB")

#cache_dir ufs /var/spool/squid 100 16 256
cache_dir diskd /cache (capacity of your /cache in MB) 16 256

(make sure /cache already exists)

acl netxxx src

(specify your network and netmask e.g. "acl mynet src

http_access allow netxxx

(e.g. "http_access allow mynet")

visible_hostname (yourserver name)

#Then i just add these lines after the last lines of the configuration file

ie_refresh on
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on

Save the file and then close.

At the terminal, change the ownership of /cache
sudo chown proxy:proxy /cache
Then create swap directories at /cache:
sudo squid -z
Then fireaway squid!
sudo /etc/init.d/squid start
You may now follow the instructions on this blogpost for a transparent proxy using Ipkungfu.

To check if its working, open a web browser on a PC in your LAN and then do the following at the terminal :
sudo tail -f /var/log/squid/access.log
Enjoy Squid!

P.S.: I am using Ubuntu LTS on a Pentium IV 1.7 Ghz 1Gb RAM 120 Gb HB PC.