Thursday, April 3, 2014

SSH tunnel to multiple vSphere/ESXi hosts

An SSH tunnel to a single host is easy; reference: http://www.virtuallifestyle.nl/2010/03/tunneling-a-vsphere-client-connection-over-ssh/

However, if you want to open the vSphere client multiple times for simultaneous connections to multiple ESXi/vCenter hosts, then you have to get a little creative. Basically you follow the same instructions as above, except you don't need to edit the hosts file. Just use a single address in the loopback network (127.0.0.2 - 127.255.255.254 ) for each remote ESXi host.  e.g.:

ESXi host Tunnel Source Tunnel Destination
host1 127.0.0.2:443 esxhost1:443
host1 127.0.0.2:902 esxhost1:902
host1 127.0.0.2:903 esxhost1:903
host2 127.0.0.3:443 esxhost2:443
host2 127.0.0.3:902 esxhost2:902
host2 127.0.0.3:903 esxhost2:903

Then simply connect vSphere client to one of the loopback addresses you used.  In the example above, to connect to esxhost1, you connect vSphere Client to 127.0.0.2.  For esxhost2, 127.0.0.3.

You should be able to make up to ~16 million tunnels this way!

NOTE: When using an SSH tunnel, the vSphere Client will not show the "Hardware" tab for your hosts.

No comments:

Post a Comment