ssh to two VM?

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
zabouti
Posts: 11
Joined: 20. May 2009, 04:33
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: ubuntu-9.04-server

ssh to two VM?

Post by zabouti »

I want to define multiple virtual machines, run them at the same time and be able to ssh to each one. But I can't do it.

I've got two virtual machines defined AND running under virtualbox:

Guest Machine #1:

Code: Select all


	bash-3.2$ vm1=LibraryLink/Machines/ubu_9_04_server_min_base
	bash-3.2$ VBoxManage getextradiata $vm1 enumerate
	VirtualBox Command Line Management Interface Version 2.2.4
	(C) 2005-2009 Sun Microsystems, Inc.
	All rights reserved.

	Key: GUI/SaveMountedAtRuntime, Value: yes
	Key: GUI/LastWindowPostion, Value: 10,259,720,422
	Key: GUI/Fullscreen, Value: off
	Key: GUI/Seamless, Value: off
	Key: GUI/AutoresizeGuest, Value: on
	Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol, Value: TCP
	Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort, Value: 22
	Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort, Value: 2222
Guest Machine #2:

Code: Select all

bash-3.2$ vm2=ubu_9_04_server_min_base_mysql_5.1.35
	bash-3.2$ VBoxManage getextradata $vm1 enumerate
	VirtualBox Command Line Management Interface Version 2.2.4
	(C) 2005-2009 Sun Microsystems, Inc.
	All rights reserved.

	Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol, Value: TCP
	Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort, Value: 22
	Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort, Value: 2223
	Key: GUI/LastWindowPostion, Value: 22,347,720,422
	Key: GUI/Fullscreen, Value: off
	Key: GUI/Seamless, Value: off
	Key: GUI/AutoresizeGuest, Value: on
I can ssh from the Host to Guest #1:

Code: Select all

bash-3.2$ ssh -l ge -p 2222 localhost
	ge@localhost's password: 
	Linux ubumin 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686

	The programs included with the Ubuntu system are free software;
	the exact distribution terms for each program are described in the
	individual files in /usr/share/doc/*/copyright.

	Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
	applicable law.

	To access official Ubuntu documentation, please visit:
	http://help.ubuntu.com/

	The programs included with the Ubuntu system are free software;
	the exact distribution terms for each program are described in the
	individual files in /usr/share/doc/*/copyright.

	Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
	applicable law.

	To access official Ubuntu documentation, please visit:
	http://help.ubuntu.com/
	Last login: Sat Jun  6 14:36:56 2009
	ge@ubumin:~$ uname -a
	Linux ubumin 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686 GNU/Linux
	ge@ubumin:~$ exit
	logout
	Connection to
localhost closed.

But I cannot ssh from the Host to Guest #1. I just get a timeout:

Code: Select all

	bash-3.2$ ssh -l ge -p 2223 localhost
	^C
	bash-3.2$ exit
I would really appreciate any advice ....

Other than "Forget about it", that is. ;-)

-- ge
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: ssh to two VM?

Post by Perryg »

What are the host and guest using for the adapter type? Host-only, NAT, Bridged, Internal?
zabouti
Posts: 11
Joined: 20. May 2009, 04:33
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: ubuntu-9.04-server

Re: ssh to two VM?

Post by zabouti »

Both Guests have this as their network adapter:

Adapter 1: PCnet-FAST III (NAT)


It's not clear (to me) how the Host finds Guests, but my impression is that all are 'localhost' but respond to different ports if they've been definde differently (in my case, host's ssh port is 22, one guest is 2222 and the second guest is 2223). But that's all I know.

If the adapter type tells you something, please enlighten me! I really appreciate it. I was suspecting that some '0' has to change here, but I'm not sure:

Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort, Value: 2223

-- ge
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: ssh to two VM?

Post by vbox4me2 »

This should work, no firewall or such in use?
You are typing "VBoxManage getextradata $vm1 enumerate" for both queries and get different results??? check your syntax.
zabouti
Posts: 11
Joined: 20. May 2009, 04:33
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: ubuntu-9.04-server

Re: ssh to two VM?

Post by zabouti »

vbox4me2 wrote:This should work, no firewall or such in use?
You are typing "VBoxManage getextradiata $vm1 enumerate" for both queries and get different results??? check your sentax.
Nope. Just a vanilla (I think) pair of guest hosts inside osx leopard.

But they have different names, so I used $vm1 for one query and $vm2 for the other.

I defined them:

$ vm1=LibraryLink/Machines/ubu_9_04_server_min_base
$ vm2=ubu_9_04_server_min_base_mysql_5.1.35
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: ssh to two VM?

Post by Perryg »

Myself, I use bridged mode and don't worry about port forwarding. But I like to keep it simple too.

What vbox4me2 was saying is to type this in your terminal window:

VBoxManage getextradata $vm1 enumerate and then
VBoxManage getextradata $vm2 enumerate

Look at the output and see if you can see the difference.
zabouti
Posts: 11
Joined: 20. May 2009, 04:33
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: ubuntu-9.04-server

Re: ssh to two VM?

Post by zabouti »

Perryg wrote:Myself, I use bridged mode and don't worry about port forwarding. But I like to keep it simple too.

What vbox4me2 was saying is to type this in your terminal window:

VBoxManage getextradata $vm1 enumerate and then
VBoxManage getextradata $vm2 enumerate

Look at the output and see if you can see the difference.
Thanks, perryg.

The difference is in my original post, but it's hard to see. Here's what I see:

$vm1:
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort, Value: 2222
Key: GUI/SaveMountedAtRuntime, Value: yes
Key: GUI/LastWindowPostion, Value: 10,259,720,422

$vm2:
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort, Value: 2223

I assume that the HostPort value differences are enough? But....

Thanks,
ge


... Maybe I'll try to figure out how to use bridge mode!! ;-)
Post Reply