Using PacketFilter to transparently proxy packets in OS X

你说的曾经没有我的故事 提交于 2019-12-03 08:35:33

问题


There is a cool utility out there called sshuttle. It has depended on ipfw to forward packets in the past. It appears that ipfw is mostly broken in Mavericks and the advice is to use PacketFilter for this now.

I've spent most of the day looking at PacketFilter and it appears ipfw has a feature that PacketFilter does not support (hope I'm wrong about this).

The following rule:

ipfw -q add 12300 fwd 127.0.0.1,12300 tcp from any to any not ipttl 42 keep-state setup

will forward all traffic to 127.0.0.1 (localhost) port 12300. It does not, however, change the destination IP or port in the TCP packet. This is important to sshuttle as it uses the information about the original destination to forward the packet on to another network.

The closest rule I can find in the PacketFilter world is:

rdr pass proto tcp from any to any -> 127.0.0.1 port 12300

This rule does send the traffic to 127.0.0.1 (localhost) port 12300 but it also rewrites the destination address to be 127.0.0.1.

Any ideas on how to get the behavior sshuttle needs in OS X?

来源:https://stackoverflow.com/questions/25873329/using-packetfilter-to-transparently-proxy-packets-in-os-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!