Question: When outside our company firewall, I use a script to tunnel via SSH and expose our internal wiki to my OSX machine. Is there a command to temporarily tell OSX to resolve to my local port when the tunnel is set up?

The sequence I'm hoping to use is:

1. open the tunnel
`ssh -f external-proxy.example -L 8001:internal-wiki.example:8000 -N`
2. [DO SOMETHING HERE]
3. typing the URL **internal-wiki.example:8000** in my browser causes it to transparently view **localhost:8001**

Other details:

* I could edit **/etc/hosts** but that would be a persistent change. I want to use this only when outside
* We're not using SSL or certs.

Answer: 
Create temporary hosts entry:

```
rm /tmp/hosts
cp /etc/hosts /tmp/hosts
echo "127.0.0.1 example.com" >> /tmp/hosts
mount --bind /tmp/hosts /etc/hosts

```

Remove temporary hosts entry (and return persistent hosts file):

```
umount -f /etc/hosts

```

or reboot or shutdown.
Run a load balancing web server on your Mac balancing between the localhost forwarding and the real address of the wiki configured to prefer the localhost forwarding address. 

When the ssh connection is down the load balancer will notice and direct your
connections to the regular wiki address. 

Configure your web browser to proxy connections for the wiki via the load balancer.

Somewhat of a sledgehammer to crack a nut though.