How to configure putty to ssh to multiple vm using same host

networkingputtysshvirtual machinevirtualbox

I am running two Hortonworks Sandbox 1.3 guest VMs (both running Centos 6) on a Windows 7 host. I am using Oracle VirtualBox 4.3.2 with host-only adapter added to each of the guest VMs in addition to their default NAT adapter.
I have enabled DHCP server in Preferences –> Network –> Host-only Networks –> DHCP Server with specifications as follows:

Enable Server: Checked
Server Address: 192.168.56.100
Server Mask: 255.255.255.0
Lower Address Bound: 192.168.56.101
Upper Address Bound: 192.168.56.254

On launching both the guest VMs, it says that the guest can be SSHed on 127.0.0.1:2222 as shown in screenshot here:
enter image description here

I want to use putty SSH client to open terminals for the two different guest VMs. But the problem is I can only SSH successfully to the 127.0.0.1:2222 in either new connection. This restricts me to SSH to only a single guest instance at present.

How should I create two different SSH connections using my putty client for the two guest VMs?

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) Centrino(R) Wireless-N 1030
   Physical Address. . . . . . . . . : XX-XX-XX-XX-XX-X1
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : xxNN::NNNN:NNxN:xNNN:xxNN%11(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.1.2(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Friday, November 29, 2013 3:14:48 PM
   Lease Expires . . . . . . . . . . : Saturday, November 30, 2013 3:14:52 PM
   Default Gateway . . . . . . . . . : 192.168.1.1
   DHCP Server . . . . . . . . . . . : 192.168.1.1
   DHCPv6 IAID . . . . . . . . . . . : NNNNNNNN0
   DHCPv6 Client DUID. . . . . . . . : NN-NN-NN-NN-NN-XX-XN-XN-NN-XN-XX-NN-XX-X0

   DNS Servers . . . . . . . . . . . : 192.168.1.1
   NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : VirtualBox Host-Only Ethernet Adapter
   Physical Address. . . . . . . . . : XX-XX-XX-XX-XX-X2
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : xxNN::xN:NNNN:xNNN:NxxN%24(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.56.1(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : NNNNNNNN1
   DHCPv6 Client DUID. . . . . . . . : NN-NN-NN-NN-NN-XX-XN-XN-NN-XN-XX-NN-XX-X1

   DNS Servers . . . . . . . . . . . : xxxN:N:N:xxxx::1%1
                                       xxxN:N:N:xxxx::2%1
                                       xxxN:N:N:xxxx::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter VirtualBox Host-Only Network #2:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : VirtualBox Host-Only Ethernet Adapter #2
   Physical Address. . . . . . . . . : XX-XX-XX-XX-XX-X3
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : xxNN::xxxN:NNNN:xNxx:NNNx%26(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.43.1(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : NNNNNNNN2
   DHCPv6 Client DUID. . . . . . . . : NN-NN-NN-NN-NN-XX-XN-XN-NN-XN-XX-NN-XX-X2

   DNS Servers . . . . . . . . . . . : xxxN:N:N:xxxx::1%1
                                       xxxN:N:N:xxxx::2%1
                                       xxxN:N:N:xxxx::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled

My scenario is best described through the image below or Is that my understanding of the network architecture is mistaken? Can somebody please explain and help me get SSH access to the two guest VMs.

enter image description here

Best Answer

You can't. You need to modify something - the easiest something to modify is probably your SSH config - maybe you can modify ssh to listen on an alternative port (maybe by modifying /etc/ssh/sshd on the hosts and restarting it), and/or modifying the ListenAddress so it binds to all interfaces so you can access it by IP address.

[ I can only speculate the exact steps you need to take - they will depend on your specific configuration. I suspect you will actually need to enable SSh on the machines, and that your SSH sessions on port 2222 are something set up by Virtualbox with some kind of forwarding. - I don't use Virtualbox though]

The reason why looking in your network configs to have 2 x 127.0.0.1 connections won't help with respect to "127.0.0.1" is that 127.0.0.1 ALWAYS refers to "This machine", thus there is no way to connect to these.

Related Question