Running VirtualBox on Synology NAS

Home / Running VirtualBox on Synology NAS

Some types of Synology are able to run VirtualBox as a hypervisor. With a hypervisor you are able to run a virtualized computer as if it was a physical computer. The Package Center resource http://spk.diablos-netzwerk.de offers a package for Synology DistStations with the following architecture: x86, cedarview, bromolow, evansport, avoton and braswell. If you want to know what architecture your DiskStation has, you can find it out here. Your DiskStation also has to have at least DSM version 5.2-5644. Finally you have to have your web services operational on your DiskStation. This post describes the steps I took to let VirtualBox run on my DiskStation.

Installation

If your DiskStation meets all the requirements mentioned above, you can add the address http://spk.diablos-netzwerk.de to the repositories of your Package Center. You also have to enable the option to see beta packages in your Package Center; the VirtualBox package is still beta. When you finished this VirtualBox will show up in the available packages list of your Package Center. Just click the install button of VirtualBox and complete the wizard. Make sure you select the option to always authenticate when you logon to the management interface phpvirtualbox. This will be published on your web server you might have made available to the internet. If you select not to authenticate everyone has access to your management console and your virtual machines(!). The installation takes a while. It probably downloads additional files. When the installation is done you have to install the VirtualBox Extension pack

VirtualBox Extension pack

The extension pack installs support for USB 2.0 and USB 3.0 devices, VirtualBox RDP and PXE boot for Intel cards. The extension pack has to have the same version number as VirtualBox. If you installed VirtualBox version 5.0.16 you have to download version 5.0.16 of the Extension pack. The version of your VirtualBox is shown in the package center of your DuskStation. In this post version 5.0.16 is used in the examples.

All downloads can be found at http://download.virtualbox.org/virtualbox/. As you can see this folder has a all the history of VirtualBox. Change to the directory of the required version to find the Extension pack of your version. You are now able to reconstruct the URL of the file you need. The following steps guides you to the installation procedure of the extension pack:

  1. Stop all the running virtual machines in the management console of your VirtualBox installation.
  2. Stop VirtualBox in the Package Manager on your DiskStation.
  3. Open an SSH connection to your DIskStation as user ‘root’.
  4. Execute tho folowing commands in the SSH Terminal:
    cd /opt/VirtualBox
    wget http://download.virtualbox.org/virtualbox/5.0.16/Oracle_VM_VirtualBox_Extension_Pack-5.0.16.vbox-extpack
    ./VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-5.0.16.vbox-extpack
  5. Start VirtualBox in the Package Manager on your DiskStation.

This completes the installation tasks.

Configuration

You have to accomplish a couple of configurations before you should start using VirtualBox. The following paragraphs will show you what to configure.

Change admin password

The management interface is a web interface that can be accessed on http://[ip address or host name of your diskstation]/phpmyadmin. If the installation was successful you have to authenticate here with the default username/password combination admin/admin. As you can see this is an obvious combination that can be guessed or be found by everyone. The least you have to do is to change this accounts password to a strong one. Even better is to create a new administrator account with another username and a strong password and delete the default ‘admin’ account. You also want to consider a regular non-admin account for daily use of the phpmyadmin.

Secure the web interface

The management web interface phpmyadmin is a regular page that can be accessed from everywhere on the world if you made your webserver public accessible. It’s highly unlikely you want everybody having access to your virtual machines, because they also might gain access to your data. To avoid that you have to restrict the access to the management web interface. The first step was forcing to logon every time you want to access the management web interface.

Unfortunately the logon page is accessed through an unsecured http-session. This implies that the username and password you provide in the logon page is send in plain text to the webserver. This is vulnerable to eavesdropping. You can try to force the logon page to a secure https-session, but in my case this leads to errors. This makes why you don’t want to have the management web console accessible from the internet at all.

To deny the access from the internet you can use a .htaccess file in the folder on your webserver that hosts the VirtualBox management console. To do this you have to find the location where the management console is stored and create a textfile in this folder named .htaccess. (Be aware of the leading period in the filename.) The example below is a network based restriction. This means that all hosts from the given network have access, all other will be denied. A host with the ip address 192.168.1.100 will have access to the web management console, 192.168.1.24 too but all others outside the 192.168.1 network haven’t. Put the following lines in the just created .htaccess file and save the file. (Don’t use Windows Notepad.)

order deny,allow
deny from all
allow from 192.168.1.0/24

Now the management console is not accessible from the internet anymore. (Unless you use a VPN.) Now you can start creating virtual machines in VirtualBox. Be aware that Virtual machines are memory and cpu power consuming. A DiskStation is not primary designed to act as a full blown server. Don’t expect miracles from it when it comes to performance.

Guests

This section is not about how to install a guest operating system in VirtualBox. There are plenty sites elsewhere that describes just that. Besides that it is quiet intuitive to install a guest operating system. This section has some paragraphs on how to install the VirtualBox Guest Additions with drivers and software to let the guest operating system optimal as a guest system in VirtualBox. The web management console is not as mature a the management console you have when you install VirtualBox on a Windows system. Below are the descriptions per operating system I used. All descriptions are based on the VirtualBox Guest Additions ISO-file that can be downloaded from the same location as you downloaded the Extension Pack described earlier in this post. (For the example version of this post the location will be http://download.virtualbox.org/virtualbox/5.0.16/VBoxGuestAdditions_5.0.16.iso. Make sure you use the version that fits with your VirtualBox installation and save it somewhere where you can find it back; you’ll need this for almost every new guest operating system you install.)

In all cases connect the ISO file as a DVD to the guest operating system you want to install the VirtualBox Guest Additions to through the web management console before you start.

Debian/Ubuntu

  1. Open a TTY session in the virtual machine;
  2. Gain root access by typing the su command and pressing enter;
  3. Enter the root password and press enter;
  4. Update your APT database with apt-get update;
  5. Install the latest security updates with apt-get upgrade;
  6. Install required packages with apt-get install build-essential module-assistant;
  7. Configure your system for building kernel modules by running m-a prepare;
  8. run mount /media/cdrom if the ISO isn’t already mounted.
  9. Run sh /media/cdrom/VBoxLinuxAdditions.run, and follow the instructions on screen.