# tar -zxvf squid-2.5.STABLE10.tar.gz
# cd squid-2.5.STABLE10
# ./configure  --prefix=/opt/squid/
# make
# make install
# cd /opt/squid/
#  chown -R nobody:nobody var
# cd etc
# cp squid.conf squid.conf.bak
# vi squid.conf
修改一下内容:
http_port 3128
cache_dir ufs /opt/squid/var/cache 100 16 256
cache_effective_user nobody
cache_effective_group nobody
http_access allow all
httpd_accel_port 80
httpd_accel_host 192.168.10.2  (IP:web的IP地址)
httpd_accel_single_host on
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
#cd /opt/squid/sbin
#./squid -z
#./squid -sD
iptable脚本:
iptables脚本:ip.sh
#/bin/bash
iptable -F
iptable -X
iptable -t nat -F
iptable -t nat -X
iptable -t mangle -F
iptable -t mangle -X
service iptable restart
echo "1" > /proc/sys/net/ipv4/IP_forward
iptable -t nat -A PREROUTING -s 10.10.0.0/24 -p tcp --dport 80 -j REDIRECT --to-ports 3128
iptable -t nat -A POSTROUTING -s 10.10.0.0/24 -o eth0 -j MASQUERADE
#iptable -t nat -A POSTROUTING -s 10.10.0.0/24 -o eth0 -j SANT --to-source 192.168.10.2
wq!
#. ./ip.sh   ---执行脚本
netstat -lnp  --查看squid是否起来了