Squid Web Cache Wiki

Squid Web Cache 文档

🔗 Linux 上的 Squid 和浏览器流量拦截

🔗 目录

无需任何客户端配置即可透明拦截 Web 请求。当 Web 流量由运行 Squid 的机器生成时。

NP:对于大多数非 Windows 盒子,设置 http_proxy 环境变量(http_proxy=”http://SQUIDIP:3128/”)是以下拦截的首选替代方案。

NP:其他用户报告设置传出的 TOS 并基于此进行过滤,而不是基于进程 gid,也有效。

🔗 iptables 配置

iptables -t nat -F  # clear table

# normal transparent proxy
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 80 -j REDIRECT --to-port 3127

# handle connections on the same box (SQUIDIP is a loopback instance)
gid=`id -g proxy`
iptables -t nat -A OUTPUT -p tcp --dport 80 -m owner --gid-owner $gid -j ACCEPT
iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination SQUIDIP:3127

🔗 Squid 配置文件

您需要像这样配置 Squid 以便它知道 IP 地址正在被拦截:

http_port 3127 transparent
http_port 3127 intercept

⚠️ Disclaimer: Any example presented here is provided "as-is" with no support
or guarantee of suitability. If you have any further questions about
these examples please email the squid-users mailing list.

类别: ConfigExample

导航:站点搜索站点页面分类🔼 向上