Ssh – Port Forwarding for ESXi remote management with VSphere

port-forwardingsshvmware-esxivmware-vsphere

I am connecting to ESXi with vSphere client from a remote LAN.

ESXi is running on 10.1.1.10, so I create an ssh tunnel (using cygwin but putty or plink should also work) with this command:

ssh -v -p 2222 -L 903:10.1.1.10:903 -L 902:10.1.1.10:902 -L 443:10.1.1.10:443 -L 80:10.1.1.10:80 ssh-user@remote-lan-router.example.com

VSphere does not connect, I get a "connection error" connecting to localhost. I can telnet the ports on localhost, they are responding.

Do I have to forward more ports apart from 80,433,902 and 903? When I connect with VSphere client from within the remote-lan to 10.1.1.10 it works.

In this drawing = means WAN connection and -stands for LAN connection:

[vSphere client machine] = = = ssh = = = [remote-lan-router] - - - [ESXi 10.1.1.10]

Edit: Solution (via accepted answer):

I added a host entry 127.0.0.1 myhost1 to the hosts file (c:\WINDOWS\system32\drivers\etc\hosts) on the vSphere client machine (which runs windows) and then connected the vSphere client to myhost1

At least with a single client controlling a single server this seems to work fine.

Best Answer

You're going to have problems with this, because ESXi relies on client-side name resolution, which is unlikely to work over an SSH tunnel.

To get around this and get you to connect, try adding an entry into your hosts file with a name of your choosing and settings its IP 127.0.0.1 and connecting to that instead. This should at least get you in, but I don't know how well name resolution will work inside of vSphere (for nodes and clusters, etc)

Related Topic