Be on bluetooth tethering + wifi, and select which traffic goes through each

bluetoothPROXYtetheringwifi

I have found some wifi networks have 'overly-aggressive' firewalls. E.G. many will block SSH traffic. The wifi signal is otherwise strong and good, and I'd like to use it for most of my internet work.

I would like to direct all SSH connections to go through the bluetooth tethering. I think this might involve some command-line config that specifies the bluetooth hardware device. Maybe a SOCK5 setup? I'm not too familiar.

I occasionally see general issues when running both bluetooth tethering + wifi. Not sure if others see / experience the same. Thanks for any any all insights toward an answer.

edit 1: I have considered a solution by connecting to bluetooth tethering and wifi, and then changing the network order, when needed. This post taught me the networksetup -listnetworkserviceorder and networksetup -ordernetworkservices commands to do it. Still, I'd prefer a savvy, real, solution!

Best Answer

You need to use what is known as "policy-based routing". I.e. you route the network packets not based on the IP address of the destination, but on different criteria.

On macOS this is done using pf (see the man pages for pf.conf and pfctl).

In your case you need to create a policy rule that specifies that packets with destination port 22 will be routed over the tethering interface.