
特定的 Raspberry Pi 4 連接到4G 路由器 ( ) 上的wlan0
( ) ,並具有 4G 移動連接。192.168.10.174
192.168.10.1
已經在介面eth0
( 192.168.1.41
) 上的是我的本地網路路由器 ( 192.168.1.254
) 和網際網路 ISP。
知道這些資訊後,我如何建立本地代理伺服器(使用 Squid?),以便我可以透過另一個網路裝置(範例)進行連接,並從Raspberry Pi 的介面192.168.1.42
從 4G 路由器使用網路?wlan0
我在 Squid 中使用了以下設置,但顯然它不起作用:
http_port 3128
cache_peer wlan0 parent 8080 0 no-query default
never_direct allow all
如果我只使用http_port 3128
它,它會工作,但它將使用設定為 eth0 的系統預設網關。然而,我需要在squid中定義這個網關,因為將來我將有10個路由器在squid中建立不同的端口,一個用於路由器的每個公共IP。
另外,我相信您需要 iptables 條目。
這個怎麼做?
答案1
運行多個 Squid,每個 Squid 都位於使用此腳本建立的單獨 Cgroup 中
https://gist.github.com/akruis/da385170f33799112df713ec7c3e9305
或者
https://gist.github.com/level323/54a921216f0baaa163127d960bfebbf0