配置 squid.conf
acl our_networks src 192.168.1.0/24 192.168.2.0/24
http_access allow our_networks
http_port 3128 transparent
cache_mgr zyh0755@gmail.com
cache_dir ufs /data/cache 4096 16 256
cache_mem 32 MB
cache_swap_low 90
cache_swap_high 95
cache_effective_user squid
cache_effective_group squid
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
visible_hostname 192.168.1.102
dns_nameservers 202.96.134.133
配置 iptables(假设 eth0是内网):
iptables -t nat -A PREROUTING -i eth0 -s 192.168.1.0/24 -p tcp --dport 80 -j REDIRECT --to-port 3128