pf 防火牆阻止 raspbian apt-get 更新

pf 防火牆阻止 raspbian apt-get 更新

我正在將我的 raspberry pi 3(raspbianstretch)連接到我的 Macpro(10.13.2;High Sierra)到 802.3 以太網端口,該端口是bridge100使用 Internet 共享功能的橋接適配器 ( ) 的一部分。 Mac 上的網際網路介面是en2(無線)。

雖然,我可以 pinggoogle.commirrordirector.raspbian.org,當我嘗試更新軟體包時,apt-get 永遠掛起:

# apt-get update
0% [Connecting to mirrordirector.raspbian.org (93.93.128.193)] [Connecting to archive.raspberrypi.org (93.93.130.104)]

當我在 Mac 上停用 pf 防火牆時,它開始工作。我的 pf 規則如下:

LAN="bridge100"
WLAN="en2"

dns="53"
ntp="123"

set fingerprints "/etc/pf.os"
set skip on lo
set block-policy drop

set ruleset-optimization basic
set optimization normal
set timeout { tcp.established 600, tcp.closing 60 }
scrub in all no-df fragment reassemble
antispoof log quick for { lo $LAN $WLAN }


block all
block in log quick from no-route to any

pass in quick on { $LAN $WLAN } proto { udp tcp } from any to any port $dns keep state
pass in quick proto udp from any port 67 to any port 68
pass in proto udp from any to port $ntp

pass in inet proto icmp from 10.8.0.0/24
pass in inet proto icmp from 192.168.1.0/24
pass in inet proto icmp from 192.168.2.0/24
pass in inet proto icmp from 172.16.42.0/24

pass out all

我應該使用什麼規則來允許apt-get update.我以為pass out all會做到這一點,但似乎我並不完全理解 pf 防火牆。請幫忙。

答案1

好吧,我終於明白這一點了。問題很複雜。

1 - 我有以下我不知道的重定向規則:

rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080
rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 8443

所以我對它們進行了評論,因為 apt-get 使用連接埠 80(可能還有 443)

2 - 主要的事情。勾選時網路分享複選框中優先,MacOS動態加入以下pf錨點:

nat-anchor "com.apple.internet-sharing" all
rdr-anchor "com.apple.internet-sharing" all

scrub-anchor "com.apple.internet-sharing" all fragment reassemble
anchor "com.apple.internet-sharing" all

運行sudo pfctl -sa以確保包含這些錨點。如果沒有,那麼只需取消勾選,然後再次勾選即可網路分享MacOS系統中的複選框優先

相關內容