virtualbox networking
just a quick guide for virtualbox networking using nat. i wanted to ssh to a guest box. in order to achieve this i had to do some port forwarding stuff:
VBoxManage setextradata guestname "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222 VBoxManage setextradata guestname "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22 VBoxManage setextradata guestname "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP
where guestname is the name of the guest box. as you can see i ‘m using the pcnet network adapter (i guess you can change it with the one you use). ssh on the above commands is just a name. you can make several rules as long as you change that name. for instance:
VBoxManage setextradata guestname "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/HostPort" 8888 VBoxManage setextradata guestname "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/GuestPort" 80 VBoxManage setextradata guestname "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/Protocol" TCP
now on my host machine i can just do:
ssh user@localhost -p 2222
you can see all the options you ‘ve already set with the following command:
VBoxManage getextradata guestname enumerate
and delete them by just leaving blank the last option:
VBoxManage setextradata guestname "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/HostPort"





Open-Source engineer, Informatics teacher, Digital-Rights activist, free mind :)







