macos monterey:PF 加载锚语法错误

macos monterey:PF 加载锚语法错误

我正在尝试为 QEMU 创建一个 NAT 接口将 tap0 连接到互联网。到目前为止,我已经制作了一座桥并将 tap0 连接到它:

sudo ifconfig bridge1 create
sudo ifconfig bridge1 addm tap0
sudo Ifconfig bridge1 up

现在我正在尝试使用 PF 将 NAT 桥接 1 连接到互联网(我认为是 en0)。

我已在 pf.conf 文件中添加了一个锚点:

nat-anchor "com.apple/*"
rdr-anchor "com.apple/*"
dummynet-anchor "com.apple/*"
anchor "com.apple/*"
load anchor "com.apple" from "/etc/pf.anchors/com.apple"
anchor PF_NAT_Anchor

我的锚文件:

pass out on en0 inet from bridge1 to any nat-to (en0)

但是,每次我尝试加载文件时都会收到语法错误:

pfctl: Use of -f option, could result in flushing of rules
present in the main ruleset added by the system at startup.
See /etc/pf.conf for further details.

No ALTQ support in kernel
ALTQ related functions disabled
PATH_TO_FILE/PF_NAT_Anchor:1: syntax error
pfctl: Syntax error in config file: pf rules not loaded

我查看了 Anchor 文件,但找不到错误。我所有的脚本都是稍微修改过的版本https://www.openbsd.org/faq/pf/nat.html#statushttps://srobb.net/pf.html 请帮助并感谢您阅读本文。

答案1

对于将来需要这个的人,我想有不同版本的 PF。https://calomel.org/pf_config.html帮助过我。为我加载的行是:

nat on en0 from bridge1:network to any -> (en0)

相关内容