Setting Up Tunneling With a VirtualBox Guest Machine
I regularly use VirtualBox, which allows you to set up and run virtual machines (VMs) on your own desktop. It's a very nifty bit of software, but one drawback is that by default, the guest VM is invisible to the host or any other machines on the network. You can't, for example, access the Web server on your guest from the host.
Happily, there is a way of proxying specific connections, using the VBoxManage tool. To forward ssh on one guest, I used the following commands:
VBoxManage setextradata "Debian Lenny" "
VBoxInternal/Devices/pcnet/0/LUN#0/Config/virtualssh/Protocol"
"TCP"VBoxManage setextradata "
Debian Lenny" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/virtualssh
/HostPort" 5000
VBoxManage setextradata "Debian Lenny"
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/virtualssh/GuestPort" 22
|
A couple of notes: Firstly, the guest must be switched off when you issue the commands. Secondly, presumably for security reasons, the forwarding doesn't appear to last between iterations of VirtualBox – each time you quit VirtualBox, you'll need to reissue the commands when you start it back up again. If you're doing this regularly, you'll want to put the lines above into a shell script and run that when required.
Juliet Kemp has been messing around with Linux systems, for financial reward and otherwise, for about a decade. She is also the author of "Linux System Administration Recipes: A Problem-Solution Approach" (Apress, 2009).
Read more on "Tips of the Trade" »

Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.