【问题标题】:Transparent Proxy Squid with internal and external network具有内部和外部网络的透明代理 Squid
【发布时间】:2018-08-18 07:45:30
【问题描述】:

我有这样的网络设置,包括外部和内部网络。

我已经成功让 squid 使用内部浏览器的代理运行,现在我想设置为透明但遇到了一些问题。

网络

首先,我确实更改了“http_port 8080 拦截”,但在外部服务器上设置正确的 Iptables 时遇到了问题,因为数据包没有返回到 squid 盒。

iptables --policy INPUT DROP 
iptables --policy OUTPUT DROP 
iptables --policy FORWARD ACCEPT
iptables -A INPUT -i lo -j ACCEPT 
iptables -A OUTPUT -0 lo -j ACCEPT
iptables -t nat -A POSTROUTING -o enpos3 (this is NAT) -j MASQUERADE
iptables -I INPUT -s 192.168.1.0/24 -p tcp --dport 8080 -j ACCEPT
iptables -t nat -A PREROUTING -i enp0s3 -p tcp --dport 80 -j DNAT --to-destination 10.10.1.254:8080
iptables -t nat -A PREROUTING -i enp0s8 -p tcp --dport 80 -j REDIRECT --to-port 8080

据我所知,互联网在内部电脑上运行良好,但我不确定如何将 http 80 数据包重定向到 Squid 盒 (10.10.1.254:8080)

【问题讨论】:

  • 这是题外话,因为这个地方是编程相关的问题,这看起来像一个设置和管理问题。您应该将此问题自行迁移到Server Fault,在那里您可能会得到一些帮助。

标签: firewall iptables squid transparentproxy


【解决方案1】:

几件事。

从图中不清楚鱿鱼盒在哪里。考虑到您正在设置一个透明代理,它将位于您的内部网络和 WAN 连接之间,我相信您可能已经处理好了。请检查

  1. 考虑到这是一个双宿主盒,您需要将默认网关设置为指向您的 Squid Box WAN 接口。
  2. 您确实需要启用反向路径转发。
  3. 启用最后但最少的 IP 数据包转发。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-24
    • 1970-01-01
    相关资源
    最近更新 更多