VirtualBox

(Last Updated On: )

In this post I will just walk through a couple settings that you may need to configure. For these examples I am using Ubuntu 16.04.

Networking

If you want your virtualbox os to have it’s own IP on the network and accessable outside the vm then use “Bridged Adapter”.

  • Select “Enable Network Adapter”
  • Attached to: Bridged Adapter
  • Expand Advanced
  • Promiscuous Mode: Allow All
  • Select Cable Connected
  • Adapter Type: Desktop adapter.

If you want to just forward a port to localhost then use “NAT”.

  • Select “Enable Network Adapter”
  • Attached to: NAT
  • Expand Advanced
  • Adapter Type: Desktop adapter.
  • Click “Port Forwarding”
  • Add new Rule
    • Host IP: 127.0.0.1
    • Host Port: 22
    • Guest IP: Leave empty
    • Guest Port: 22

Shared Folders

If you want to share a folder from Host to Guest.

  • Click Add Share
  • Folder Path: Select folder from Host machine
    • I will us C:\data
  • Folder Name: What the share will be on the Guest
    • data
  • Turn on VM
  • Download https://download.virtualbox.org/virtualbox/5.2.12/VBoxGuestAdditions_5.2.12.iso
  • Mount VBoxGuestAdditions_5.2.12.iso
  • On the Guest Ubuntu server run
    • sudo mount /dev/cdrom /media/cdrom
  • Install build-essential
    • sudo apt-get install build-essential linux-headers-`uname –r`
  • Run VBoxGuestAdditions
    • sudo /media/cdrom/VBoxLinuxAdditions.run
  • sudo mkdir -p /mnt/data
  • sudo reboot
  • Mount Share
    • Ubuntu Server
      • sudo mount –t vboxsf data /mnt/data
    • Ubuntu Desktop
      • sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) data /mnt/data/
  • cd /mnt/data
    • Now we can share files between host and guest.