Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux 可以通过iptables redirect实现透明代理, macOS可以么? #3212

Open
huhu415 opened this issue Nov 4, 2024 · 2 comments
Open
Labels
help wanted Extra attention is needed

Comments

@huhu415
Copy link

huhu415 commented Nov 4, 2024

我看源码发现是支持freebsd的, 所以我在想, 支不支持macos的PF (Packet Filter) 防火墙, 然后我试了几个规则, 发现没用啊, 比如

nat on en0 from 192.168.1.0/24 to any -> (en0)
rdr pass on en0 proto tcp from any to any port 80 -> 127.0.0.1 port 8080

如果不支持macos, 那一般是什么系统才会用到freebsd的那个函数?
有人可以帮助我, 告诉我应该怎么做么?

@AkinoKaede AkinoKaede added the help wanted Extra attention is needed label Dec 4, 2024
@helloqb
Copy link

helloqb commented Dec 15, 2024

我成功了

rdr on en0 inet proto tcp to any port {80, 443, 53} -> 127.0.0.1 port 1080
pass out on en0 from any to any keep state
pass in on en0 from any to any keep state

总的配置参考:Mac mini 原生实现旁路由

@huhu415
Copy link
Author

huhu415 commented Dec 15, 2024

cool, 等我有空要试试, 不过有个问题, 你只需要劫持这 80, 443, 53 三个端口的流量? . 这里面是有兼容性原因么, 还是因为什么?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants