Reaching a virtual host remotely with the vSphere client through a SSH tunnel is not as straight forward as one could hope. However, it is possible with a few simple steps.
How to connect to a remote ESXi server through a SSH tunnel
I will present two examples, one using the Putty GUI and the other with command line arguments for Putty.
A. Putty GUI
- Create or open an existing session to a machine located on the ESXi management network.
- Go to Connection – SSH – Tunnels and add the following tunnel configurations:
Replace 10.0.0.254 with the IP of your ESXi host.
- Return to the session settings and make sure you save your settings . It is always a pain to realize when pressing Open to early.
- Connect to the machine with the newly created session
- Due to some issues in the vSphere client we need to add an entry to the Windows hosts file. Open notepad with administrator privileges (needed to make changes to the hosts file) and open the file (without file extension):
(hint: copy paste the about line into the Open file dialogue)
- Add a line at the end of the file
Save the file and exit Notepad
- Fire the vSphere client and enter esxiserver as “IP address / Name” and your login credentials.
B. Putty command line
- Instead of setting up a Putty session with the GUI
putty.exe -L 443:destIP:443 -L 902:destIP:902 -L 903:destIP:903 user@local_machine
(all the above on the same line) where destIP is the IP of the ESXi-server, user is your username on the local_machine and local_machine is the machine on the local network. Hit enter to launch the SSH session and log in.
- Setup the hosts file as described in step 5-6 in the previous section
- Launch the vSphere client and connect as described in step 7 above.