How-To Setup NAT Forward SSH Access to VirtualBox Client

How-To Run Drupal on Windows XP
How-To Setup SSH Access to VirtualBox Client OS
How-To VirtualBox NAT Port Forwarding

We will configure NAT Port Forwarding so that we can use some cool tools to administer and manage our Virtual Computer.

This tutorial is now available in a Video Demonstration:
http://veedee-eyes.com/veedeeeyes/How-to+install+Microsoft+Loopback+Adap...

You will need these tools installed on your Windows XP Desktop to follow this Tutorial

    SSH Client Tools:

  • Putty
  • Tunnilier - This is quickly becoming my favorite SSH client for many reasons mainly easy of use and auto reconnection. You can download for personal use here

Windows File Sharing:
Requires that you configure a "Loopback Adapter"

mySQL Administrator:
This tool will allow you to access and develop the database server within the LAP-Tutorial VDI.
http://dev.mysql.com/downloads/gui-tools/5.0.html
Web Browser

RAR compression tool:
7-zip - Decompression Tool.

Windows File Sharing

Configuring VirtualBox virtual machine networking NAT Port Forwarding.
Opening forward a port in the virtual firewall can be done in one of two ways.

Using VboxManage tool:
The VBoxManage command line program can be used. More information can be found in the User Manual in section "6.4.1 Configuring port forwarding with NAT". There are three(3) command that must be entered for each port forwarded.
You must have the VirtualBox Manager CLOSED in order to make these changes to the configuration
Open a command Prompt
Change directorys to the installation directory of VirtualBox.
-Alternatly, modify the PATH to include folder where VBoxManage.exe exists. This will be useful in the future when using other VBoxManage commands
Enter the following three commands:

VBoxManage setextradata "LAMP_TUTOR" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
VBoxManage setextradata "LAMP_TUTOR" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22
VBoxManage setextradata "LAMP_TUTOR" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222

We are going to verify that the configuration changed worked

Restart VirtualBox
In the File menu of VirtualBox open Preferences.
In the Default Folders section. Notice the "Machines" file location.
Open windows explorer and go the the "Machines" directory from above.

Open the LAMP_TUTORIAL directory and open the "LAMP_TUTORIA.xml" file.
Near the very BOTTOM of this file, notice that there are three lines in the data reflecting the VBoxManage commands in the <ExtraDataSection> from above that look like this;

<ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" value="TCP"/>
<ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" value="22"/>
<ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" value="2222"/>

If you do NOT see these lines in the the LAMP_Tutor.xml file DO NOT PANIC!!

This is actually the second way that the changes can be made the chages.
You can past them in manually. MAKE A COPY of the LAMP_TUTOR.xml file first!!

(If you past the information in VirtualBox Crashes when your start the virtual machine there is something wrong with the file. This may be because your paste contained other characters. You can download this file. Copy the three lines to the LAMP_TUTOR.xml)

Restart the LAMP_TUTOR virtual machine
Login at the prompt
Restart the DHCP Client: "sudo dhclient"

Open Putty
enter the server to connect to as "127.0.0.1" port 2222
Click connect.
Here you should either get a prompt about authenticating a key, click YES

We have successfully configure the SSH connection to the LAMP_TUTOR Server.

Configuring SSH Tunnels using Tunnilier
We are going to set up tunnels for the following Client Tools

  • Webmin - port:10000
  • mySQL Administrator - port:3306
  • Web Server - port:8888

Start Tunillier
host:127.0.0.1
Port:2222
username:admin

Click on the "C2S Fwding" Tab
Click the "Add" button and add the following values on the line

  • Listen Interface:127.0.0.1
  • List. Port:10000
  • Destination Host:127.0.0.1
  • Dest. Port:10000
  • Comment:Webmin

Click the "Add" again and add the following values on the line

  • Listen Interface:127.0.0.1
  • List. Port:3306
  • Destination Host:127.0.0.1
  • Dest. Port:3306
  • Comment:mySQL Administrator

Click the "Add" again and add the following values on the line

  • Listen Interface:127.0.0.1
  • List. Port:8888
  • Destination Host:127.0.0.1
  • Dest. Port:80
  • Comment: Apache Web Server

Click the "Add" again and add the following values on the line

  • Listen Interface:10.10.10.10
  • List. Port:139
  • Destination Host:127.0.0.1
  • Dest. Port:139
  • Comment: Samba-Windows Share

Your setting should look something like this (the Samba listing is not shown in the Graphic yet);

Click on the "Save Profile" icon and save this configuration as "LAMP_TUTOR.tpl"
Click on Login
Enter password
You should see a SFTP GUI browser and a Terminal window open.

Comments

How-To Setup NAT Forward SSH Access to VirtualBox Client

Nice and very timely information for me. I did face the same issue that you just said in the topic. .... Anyhow thanks for everything. God bless You.

______________________________________________________
The best wedding ceremony music in town........