Configure OS X to pass incoming traffic to another server? I have a PC and a 2011 Mac mini on one wireless network, which does not have Internet access.  The Mac mini is also connected to another network which has Internet access.

Is there a way I can share access to a single IP using the Mac?  i.e., Forward all requests on ports XX-YY to AAA.BBB.CCC.DDD?

EDIT: I'd prefer a solution that is 100% command-line based.

OS X 10.11.3
I need the PC to be able to access resources on the Mac's network.
Internet sharing replaces the Mac's connection to the wifi network.

The PC is wired to a wireless router without internet.  The Mac is wired to a wireless router with internet.  The Mac is also wifi connected to the PC's wireless router.  The PC's wireless router is not capable of acting as a client.
An SSH tunnel will serve the purpose here, assuming that you configure a gazillion LocalForward ports.

Place these contents into your ~/.ssh/config file:

Host [hostname]
User [username]
Port [SSH port]              # (if using port 22, omit this line)
LocalForward 1 0.0.0.0:1     # Replace all these
LocalForward 2 0.0.0.0:2     # port numbers with
LocalForward 3 0.0.0.0:3     # the actual ports
LocalForward 4 0.0.0.0:4     # that you need.
LocalForward 5 0.0.0.0:5     #
LocalForward 6 0.0.0.0:6     # Format is like this:
LocalForward 7 0.0.0.0:7     # LocalForward [port] 0.0.0.0:[port]
LocalForward 8 0.0.0.0:8     #
LocalForward 9 0.0.0.0:9
LocalForward 10 0.0.0.0:10


... and so on for whatever ports you want.

This will set up listening ports on the Mac, and will forward the traffic on those ports to [hostname] over an SSH connection to [username] on port [SSH port] whenever you run this Terminal command:

ssh [hostname]


Keep in mind that [hostname] must be running an SSH server, and you will get a shell on the remote host in Terminal.  It's possible to configure a port-forward-only SSH server, but that is beyond the scope of this answer.  If you don't want a shell on the remote server, run this command instead:

ssh [hostname] sleep 3600


You will instead get a 1 hour connection, and no shell.  Don't close the Terminal window.  If you want, you can set it up such that you can close Terminal by running this:

nohup ssh [hostname] sleep 3600 &amp;


Replace 3600 with the number of seconds you want the connection to last.