Macos – Mac OS X Force Internet Sharing Traffic Through Proxy

macosnetworkingPROXY

I have Internet Sharing set up on my Mac OS 10.9.5 machine, sharing my Ethernet connection to any devices connected to the created Wi-Fi hotspot. I'm looking for a way to force all that traffic through a proxy server so I can monitor the traffic using Charles.

Proxy Settings

I had assumed that, since Charles automatically sets up proxy settings (above) on the outgoing Ethernet connection that all the Wi-Fi traffic would already be proxied, but I was wrong. It seems Internet Sharing creates a new bridge (named "bridge100" at the moment) that does not run through the same network service even though the packets go out the same network interface.

I can see all the traffic generated by my machine in Charles, just not the traffic from other machines. Is there a way to set up the routing so my proxy settings for the Ethernet are also applied to the bridge? If not, is there any way to route the bridge's traffic to the same proxy?

Best Answer

I expect this is not going to be simple, if possible.

When you have a proxy server, either running on the machine itself, or on a device on the network, the client apps (e.g. whatever is going out to the inet) needs to direct its traffic to the proxy server (not just directly to the relevant network interface). This is configured either in the client app settings or at the OS level. However, when you set up a proxy at the OS level, as you show in your screen shot, that is probably set for the user session, and may not affect daemons (not sure).

The hotspot is probably running at a daemon level, and may not respect that proxy setting.

It might make sense to think of the problem differently. E.g. perhaps run ethereal or other packet sniffer, and look at the traffic hitting the ethernet port (which would include traffic to/from the OSX-based hotspot). (A packet sniffer is lower level than Charles, but that may be the price of getting lower level access to traffic.)

Related Question