Skip to content

Instantly share code, notes, and snippets.

@andy722
Created February 1, 2011 23:30
Show Gist options
  • Select an option

  • Save andy722/806957 to your computer and use it in GitHub Desktop.

Select an option

Save andy722/806957 to your computer and use it in GitHub Desktop.
Port forwarding for VirtualBox VM
@echo off
set GUEST="Ubuntu 10.10 Server x86"
set MANAGE="C:\Program Files\Oracle\VirtualBox\VBoxManage.exe"
%MANAGE% setextradata %GUEST% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort"
%MANAGE% setextradata %GUEST% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort"
%MANAGE% setextradata %GUEST% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol"
@echo off
set GUEST="Ubuntu 10.10 Server x86 - 2"
set MANAGE="C:\Program Files\Oracle\VirtualBox\VBoxManage.exe"
%MANAGE% getextradata %GUEST% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort"
%MANAGE% getextradata %GUEST% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort"
%MANAGE% getextradata %GUEST% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol"
@echo off
set GUEST="Ubuntu 10.10 Server x86 - 2"
set MANAGE="C:\Program Files\Oracle\VirtualBox\VBoxManage.exe"
%MANAGE% setextradata %GUEST% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
%MANAGE% setextradata %GUEST% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
%MANAGE% setextradata %GUEST% "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP
@andy722

andy722 commented Feb 1, 2011

Copy link
Copy Markdown
Author

After executing vbox-fwd-set.bat, one can connect via ssh to localhost:2222 (from host machine) and get to VM:22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment