Networking with VirtualBox

VBoxTuntl Tool

The VBoxTuntl tool is included with VirtualBox; basically, this is the well-known tunctl tool.

Make the start script executable and enter it as the Enabling Program in the VirtualBox configuration GUI using a sudo combination such as gtksudo startscript (Figure 5).

Figure 5: The VirtualBox Host Interface bridging variant gives users two input boxes for starting and stopping the virtual interface. The scripts seem to be working well here.

If you do not have a graphical interface, you can do this instead:

VBoxManage modifyvm "VMName" -tapsetup1 "gtksudo startscript"

Listing 2 shows the script for disabling the TAP interface. Again, you must enter the path to the executable script in the VirtualBox input field, preferably in combination with a sudo command in Disabling Program.

In this case, an alternative command-line approach uses VBoxManage with the -tapterminate1 option.

After the virtual machine has booted, it calls the enabling script to create a TAP interface and prompts you for the root password because of the call to gtksudo. When the guest is shut down, the second script removes the TAP interface.

Listing 2

Disabling a TAP Interface


Remote Desktop

The commercial variant of VirtualBox can redirect screen output to another computer via the Remote Desktop Protocol (RDP), letting users on the machine access the virtual machine's desktop directly over the network, no matter what network configuration you set up for the virtual machine. This makes VirtualBox suitable for servers without a GUI.

To enable what the manufacturer refers to as the Remote Display, you first need to specify the port number VirtualBox will use to offer the service on the host. To avoid the virtual machine's desktop being open to public viewing, it also makes sense to specify an authentication method.

External means that users must log on to the host using the host's standard method; Guest means logging on to the guest system. Null completely disables authentication.

After saving the new settings, restart the virtual machine at the command line by typing VBoxVRDP -startvm. Users can then launch rdesktop or any other RDP client to view the virtual machine's desktop at their workplaces.

Difficult, Stable, and Fast

All three connection types that VirtualBox offers for networking the virtual machine have advantages and disadvantages, and the optimum solution really depends on circumstances.

If you just need to access the Internet from the virtual machine, NAT mode is a useful option, but one that makes remote access impossible. For a server in a sandbox, your only option is the complex host interface configuration with bridging tools.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Virtual Box

    Many popular virtualization tools are either too expensive or too complicated. If you’re looking for another option, try the no-cost and user-friendly VirtualBox.

  • phpVirtualBox

    Putting all virtualization tasks on a separate server saves significant resources on the client. phpVirtualBox makes it possible to create, configure, manage, and use remote VMs in a browser window.

  • Virtual Windows 8.1 on Linux

    For occasional Windows users, a virtual machine is the ideal solution. But will Windows 8.1 work in VirtualBox and VMware?

  • Virtualizing Windows 8

    How does the latest Windows work in a virtual machine? We tried out Windows 8 as a guest system in vMware Workstation and virtualBox on Linux.

  • VirtualBox Introduces New Features, Some Experimental

    The free virtualization product VirtualBox has released a new version 2.1 that not only supports 3D graphics, but the full VMDK and VHD formats from VMware and Microsoft.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More