1、编辑配置文件/etc/squid/squid.conf
增加
acl localnet src 192.168.2.0/255.255.255.0
http_access allow localnet
visible_hostname squid.server.net
更改
http_port 3128
为
http_port 3128 transparent
2、初始化squid
squid -z
3、配置iptables
iptables -t nat -I PREROUTING -i eth0 -s 192.168.2.0/24 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -I PREROUTING -i eth0 -s 192.168.2.0/24 -p tcp --dport 443 -j REDIRECT --to-port 3128