SQUID Configuration:
In /etc/squid/squid.conf configuration file find the following parameters and change those to your own ones.
(i) NETWORK OPTIONS
| Code: |
| http_ports 8080 |
(ii) OPTIONS WHICH AFFECT THE CACHE SIZE
| Code: |
| cache_mem 8 MB (Size of RAM being used for active cache) maximum_object_size 4 MB |
(iii) LOG FILE PATHNAMES AND CACHE DIRECTORIES
| Code: |
| cache_dir ufs /var/spool/squid 3000 16 256 (define your own cache size) cache_access_log /var/log/squid/access.log (define your own log path) |
(iv) ACCESS CONTROLS
Here we will be defining our acls for allowing or denying any network
| Code: |
| acl mynetwork src 192.168.0.0/255.255.255.0 (Allow ur network) http_access allow mynetwork (Allow ur network) |
(v) ADMINISTRATIVE PARAMETERS
| Code: |
| cache_mgr you@yournetwork.com (your email here) cache_effective_user squid cache_effective_group squid visible_hostname yourname |
(vi) HTTPD ACCELERATOR OPTIONS
We need to put these parameters to make squid work in transparent mode but keep in mind in squid 2.6.xx we do not need to use these parameters.
| Code: |
| httpd_accel_port 80 httpd_accel_host virtual httpd_accel_with_proxy on httpd_accel_uses_host_header on |
Now save and exit the configuration file.
Now add the following lines into your /etc/rc.local file.
| Code: |
| echo “1″ > /proc/sys/net/ipv4/ip_forward iptables –t nat -A PREROUTING -i eth0 -p tcp -m tcp –dport 80 -j REDIRECT –to-ports 8080 iptables –t nat –A POSTROUTING –o eht1 –j MASQUERADE |
(Wheras eth0 is LAN, and eth1 is WAN)
Note:
Use your input or local network interface in place of eth0 and your internet or wan interface in place of eth1.
Change Permissions on Cache Directory:
| Code: |
| # chown squid:squid /var/spool/squid (or your own cache dir) # chmod -R 755 /var/spool/squid # squid -z (for creating cache dir) |
Now reboot your machine and start squid service and we are ready to go.
| Code: |
| # service squid start |