I am sharing a Wi-Fi connection from a Mac over USB to an iPhone using Internet Sharing. This works fine. However, I would like to also tunnel the iPhone traffic through the SOCKS proxy on my Mac. The goal is to have the iPhone be unaware that it's using a proxy/VPN of any kind.
I have tried the following setup :
(1) SSH into a remote machine from my Mac and setup a SOCKS proxy in System Preferences -> Network -> Wi-Fi -> Advanced -> Proxies. This works well for the traffic from the Mac.
(2) Connect the iPhone over USB and turn on Internet Sharing (share Wi-Fi with iPhone USB). This also works, as the iPhone can then connect to the internet and the IP is the same as the non-proxied Mac.
However, while Mac network traffic is sent through the proxy, the shared traffic from the iPhone ignores the proxy settings entirely. Is there any way to force the iPhone traffic to also go through the SOCKS proxy?
I have tried enabling a SOCKS proxy on the "iPhone USB" interface with
networksetup -setsocksfirewallproxy, but this has no effect.
There seems to be a partial answer to this question when using Linux here. However, I am not sure how to translate the
iptables commands to
pfctl, and I am hoping there is an easier way. Maybe a simple