15
4
In the office, I can connect to internal machines without a proxy, but need a proxy for external connections. Outside of the office, I can connect to other external machines without a proxy, but need to use one of 2 proxies to connect to internal machines.
If I can figure out a way to autodetect what network I'm on, can I instruct ssh to load the appropriate config file?
If not, is there a more elegant solution than writing a shell script to symlink the appropriate config file to ~/.ssh/config (my best idea so far)?
Edit: I think @pcm and JonnyRo understood my question and I'll try what they suggest, but just to be clear, I want
|--------\ Dest | abc.example.com | xyz.external.org |
| Source \---------\| | |
|--------------------+-----------------+------------------|
| example.com office | No Proxy | Proxy |
| outside | Proxy | No Proxy |
Thanks! Aliases with -F will definitely be my fallback if I can't get a script working based on IP. – Nate Parsons – 2012-04-25T06:29:46.153
This is awesome, I was just about to ask the same question. I already script some other options to set environment variables when I start a new terminal, I can easily create an alias or symlink the proper .ssh/config based on the environment. – newz2000 – 2013-05-23T18:12:39.313