You are not logged in.

#1 2008-12-25 10:21:26

Gruntz
Member
From: Haskovo, Bulgaria
Registered: 2007-08-31
Posts: 291

Virutalbox, use the host OS as gateway.

Hi all.

I am not sure is this the place to post, but I will write here.

I want to use my host archlinux as dhcpd server for my virtual machines. I made it with bridged network, but now the virtual machines are as they are real systems on the network, getting IP from the my home router. I want to use my real machine as a gatway to the virtual machines, to use it as a jumpnode. I can use the NAT provided by the VirutalBox software, and it works, but I cannot ssh from my host machine to the virtual machines. I can use not dhcp, but static IPs, I do not care. I just want to make a small network from the virtual machies, inside my computer, and use the host machines as a jumpnode from outside.

Regards.

Offline

#2 2008-12-25 14:45:34

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: Virutalbox, use the host OS as gateway.

To be able to ssh to your virtual machines when you use nat (in virtualbox) you need to configure port forwarding in virtualbox (as you would do in a real router).
Try configuring port forwarding like this:

VBoxManage setextradata "virtualmachine_name" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/sshport/Protocol" TCP
VBoxManage setextradata "virtualmachine_name" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/sshport/GuestPort" 22
VBoxManage setextradata "virtualmachine_name" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/sshport/HostPort" port_on_host

port_on_host should be higher than 1024 I believe, because ports below 1024 need root privileges to be used.
Then to ssh to a virtual machine you would do

ssh host_ip -p port_on_host

I have never tried with ssh but I believe it should work, I have only tried doing port forward with direct port mapping as in 5000 <-> 5000 and never 22 <-> whatever but it should work.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

Board footer

Powered by FluxBB