SSH client Config for Using a Jumphost

SSH config with jumphost SSH config with jumphost

SSH jumphost configuration in .ssh/config

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).

How To Specify Jumphost in SSH Client Config

I have my dedicated servers configured like this in /Users/greys/.ssh/config file:

Host s3
     HostName s3.unixtutorial.org
     Port 212

If I need to use jumphost to access s3, I’ll update this configuration setting:

Host s3
      HostName s3.unixtutorial.org
      Port 212
      ProxyCommand ssh -W %h:%p [email protected] -p 202

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

See Also




Contact Me

Follow me on Facebook, Twitter or Telegram:
Recommended
I learn with Educative: Educative
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!
Recent Articles
03 Sep 2024

macOS Sequoia 15.0

02 Sep 2024

Video: Has This Worked Before?

24 Mar 2024

Homelab: Mac Pro 2013 32GB

Recent Tweets