SQUID proxy service (3)

Transparent proxy
The service function provided by the transparent proxy is the same as that of the traditional proxy, but its "transparent" implementation relies on the default route and the redirection strategy of the firewall, so it is more suitable for serving LAN hosts, not for customers in the Internet. Machine provides services.
Configure SQUID to support transparent proxy
The default configuration of the SQUID service does not support transparent proxy, so you need to adjust the relevant settings. For SQUID services of version 2.6 and above, transparent proxy can be supported as long as a "transparent" option is added to the http_port configuration line.

*vim /etc/squid.conf*
*httpport 192.168..4.1:3128 transparent  //只在其中一个IP地址上提供服务*
*service squid reload*

Set redirection policy for IPTABLES

iptables -t nat -I PREROUTING -i eth1 -s 192.168.10.0/24 -p tcp --dport 80 -j REDIRECT --to 3128
iptables -t nat -I PREROUTING -i eth1 -s 192.168.10.0/24 -p tcp --dport 443 -j REDIRECT --to 3128
service iptables save

Verify the use of transparent proxy
unset HTTP_PROXY HTTPS_PROXY

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325319048&siteId=291194637