SSH config with jumphost
I needed to use a mobile 4G hotspot today and realised there’s another very common reason for using SSH jumphosts. You see, when I’m on a 4G hotspot I tend to use VPN client for securing Internet connection. And jumphosts may help in VPN scenarios.
Sometimes I then switch to home WiFi and need to manually disable VPN, otherwise my connection keeps getting protected. Using VPN on home WiFi allows me to use SSH client on laptop to use one of my Raspberry Pi servers as jumphost for connecting to external servers.
The reason this works is because laptop is the only system running VPN, but it usually still has access to local networks in my home network. So if I ssh onto one of my Raspberry Pi servers, any connection I make from there on will use my home’s broadband IP (because Raspberry doesn’t have VPN configured).
I have my dedicated servers configured like this in /Users/greys/.ssh/config file:
If I need to use jumphost to access s3, I’ll update this configuration setting:
Just to remind you, gw.ts.fm is my SSH jumphost name and it’s listening to SSH on port 202.
In case you need to edit this config file in Linux, this is in /home/greys/.ssh/config file for me – so /home/$USER/.ssh/config format.
See Also SSH reference