Paul Chilton electronics, programming, server administration

18Apr/100

Squid: Transparent Cache

Squid

This is my step by step instructions for how I setup Ubuntu server as a transparent Squid web cache.

Note: This post is by no means a definative guide on setting up a server, or squid, but is just the steps I took in getting it working in its most basic form.

  • Install Ubuntu Server 9.10
  • Logon to the server and login as root
    • "sudo su"

  • Install packages
    • "apt-get update"
    • "apt-get -y install openssh-server"
    • "apt-get -y install nano"
    • "apt-get -y install squid"
  • Setup Squid
    • "nano /etc/squid/squid.conf"
      • Uncomment http_access localnet line
      • Find line http_port 3128 and add transparent to it
  • Restart Squid
    • "cd /etc/init.d/"
    • "squid -k kill"
    • "squid"
  • Restart Network Interfaces
    • "/etc/init.d/networking restart"
  • Enable IP forwarding
    • "echo "1" > /proc/sys/net/ipv4/ip_forward"
    • "nano /etc/sysctl.conf"
      • Set net.ipv4.conf.forwarding=1
  • NAT setup
    • "modprobe iptable_nat"
    • "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE"
  • Add forwarding rules for squid
    • "iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128"
  • Save iptables config
    • "iptables-save > /etc/iptables.conf"
  • Install calamaris squid log analizer
    • "apt-get install calamaris"
    • "/usr/bin/calamaris -a -F html /var/log/squid/access.log > /usr/index.html"

Posted by Paul

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.