Installing Debian Squeeze into VirtualBox

Install Debian Squeeze

  1. Install Debian Squeeze 6.0.4 into VirtualBox
  2. Login as root.
  3. Run
    apt-get update
    apt-get upgrade
    

VirtualBox Guest Additions

  1. Install bzip2, if not present:
    apt-get install bzip2
    
  2. Install dkms, if not already present
    apt-get install dkms
    
  3. Install Guest Host Additions from Virtual Box GUI Menu in host.

  4. Mount CD-ROM from Debian shell
    mount -t iso9660 /dev/cdrom /media/cdrom0   
    
  5. Execute Guest Additions installer:
    cd /media/cdrom
    ./VboxLinuxAdditions.run
    
  6. Restart the system
    shutdown -r now
    

Install sshd

  1. Run
    apt-get install ssh
    
  2. Shutdown the system, we will reconfigure VirtualBox settings now.

Reconfigure VirtualBox Network Settings [Single-Adapter Solution]

This solution is easy to setup, but when your IP address changes frequently (e. g. while migrating between various networks) your hosted system IP will change as well.

  1. In Settings, change Network settings. Switch Adapter 1 from NAT to Bridged Adapter and pick your default Network Card.

  2. Start Debian anew. Then check network settings:
    ifconfig
    

    You should see the acquired IP in the same network as your host computer.

  3. Make note of the IP address from ifconfig (see inet addr). For example
    inet addr:192.168.1.101
    
  4. From host system, try:
    ping 192.168.1.101
    
  5. Test the connection from Putty.

Reconfigure VirtualBox Network Settings [Two-Adapter Solution]

This solution is a little bit more complicated to set-up, however, it is better when you frequently migrate between multiple networks.

  1. Switch off the Debian.

  2. In Settings, change Network settings. Switch Adapter 1 from NAT to Host Only and pick VirtualBox Ethernet Adapter.

  3. On the Adapter 2 tab, enable the second adapter and switch it to NAT mode.

  4. Start Debian anew. You will see that outbound network connection will be disabled, in other words, you won’t be able to connect from Debian to the outside network. Luckily, this is only a temporary situation.

  5. View the /etc/network/interfaces file and edit it.
    nano /etc/network/interfaces
    
  6. Add the following lines
    # The secondary network interface
    allow-hotplug eth1
    iface eth1 inet dhcp
    
  7. Start the eth1 network adapter (corresponding to Adapter 2)
    ifup eth1
    
  8. Try to ping www.google.com
    ping www.google.com