How to Setup SSH access between VirtualBox Host and Guest VMs

Discussion in 'Desktop Operation' started by corpus, Nov 19, 2011.

  1. corpus

    corpus Member

    Hello
    wanted to install a test virtual machine on my Desktop pc for server and ispconfig proposes. Test new things, new software etc.
    The problem was that the clipboard between host and virtual machine does not works if you haven't set up X. So i google it for the solution and i wrote a simple tutorial.

    INSTALL ORACLE VIRTUALBOX

    Go to
    http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html
    download virtual box for your machine
    Debian 6.0 (Squeeze) virtualbox-4.1_4.1.6-74713~Debian~squeeze_amd64.deb
    and Oracle VM VirtualBox Extension Pack
    For use with Version 4.1.6 only
    All Platforms (Windows, Mac OS X, Solaris and Linux) Oracle_VM_VirtualBox_Extension_Pack-4.1.6-74713.vbox-extpack

    after go into your download folder and run as root

    Code:
    dpkg -i virtualbox-4.1_4.1.6-74713~Debian~squeeze_amd64.deb
    after installation open the
    Oracle_VM_VirtualBox_Extension_Pack-4.1.6-74713.vbox-extpack
    with virtualbox (double click)
    to install the Oracle VM VirtualBox Extension Pack

    it will also ask you the root password during the installation

    to have usb support between the the host and the guest machines edit /etc/fstab and add

    Code:
    usbfs /proc/bus/usb usbfs defaults,devmode=666 0 0
    then do a

    Code:
    mount -a
    as root from your terminal

    now
    open virtualbox
    go to File-->Preferences-->Network and click on the "Add Host-only network (Ins)
    it will create automatically a "vboxnet0" network
    Click to OK to save changes

    Add a new virtual machine and proceed with installation. I installed Debian 6.
    After installation boot the new v.machine and then power off it.

    Now go with your mouse on your virtual machine
    Right-click --> Settings
    Go to Network -- click on the second tab "Adapter 2"
    check the "Enable Network Adapter" and choose from the drop-down Attached to: Host-only Adapter
    It will automatically choose the "vboxnet0" in the Name field
    Click to OK to save changes

    Now open a terminal on your host maschine and execute

    Code:
    ifconfig
    you will see something like this

    Code:
    vboxnet0  Link encap:Ethernet  HWaddr 0a:00:27:00:00:00  
              inet addr:192.168.56.1  Bcast:192.168.56.255  Mask:255.255.255.0
    keep in mind the 192.168.56.1

    Bootup your virtualmachine
    login as root and run

    Code:
    pico /etc/network/interfaces
    add these lines in the bottom

    Code:
    auto eth1
    iface eth1 inet static
    address 192.168.56.10
    netmask 255.255.255.0
    the address 192.168.56.10 is based in the ifconfig results on you host machine

    after this close and save
    run in terminal

    Code:
    ifup eth1
    Now go to your root machine's console and login with ssh to your guest machine

    Code:
    ssh [email protected]
    Those tested on a debian 6 host and also a debian 6 guest

    Thanks
     

Share This Page