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.
Best Answer
An SSH tunnel will serve the purpose here, assuming that you configure a gazillion LocalForward ports.
Place these contents into your
~/.ssh/config
file:... 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: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: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:
Replace
3600
with the number of seconds you want the connection to last.