Home > software > Access VirtualBox VM behind NAT

Access VirtualBox VM behind NAT

November 3rd, 2010 Leave a comment Go to comments

VirtualBox uses NAT if not configured otherwise. Heres an example on how to configure VirtualBox to portforward port 2222 on the Host to port 22 on the VM-Client to access the ssh-server inside the vm-linux. The VirtualBox is called Ubuntu.10.10.32bit in the example:

VBoxManage setextradata Ubuntu.10.10.32bit "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
VBoxManage setextradata Ubuntu.10.10.32bit "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage setextradata Ubuntu.10.10.32bit "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP

Make sure that you actually use the pcnet driver – mine on my mac is e1000 – just look into the VBox.log to see which one is used.

Shutdown the VM and close VirtualBox for the changes to take effect.

List all set items with
VBoxManage getextradata Ubuntu.10.10.32bit enumerate

Deleting an item can be done with setting a property without giving a value, e.g.
VBoxManage setextradata Ubuntu.10.10.32bit "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort"

Categories: software Tags:
  1. No comments yet.
  1. No trackbacks yet.