Similar to VMware Workstation, VirtualBox is a second type of hypervisor that needs an OS as a platform. This form is particularly appropriate for desktop use, owing to its intuitive nature and close integration with the base operating system. Such utilities enable the transfer of files to and from the host via drag & drop, and present individual applications on the host desktop through Seamless Mode.
Employing VirtualBox on the Server
Moreover, VirtualBox can also be used in settings typical for a type-1 hypervisor like ESXi or Hyper-V. These types of systems normally operate on a server that is controlled remotely, thus needing the remote display protocol in the VM. In such instances, Oracle VirtualBox runs in Headless mode as the GUI of the guest OS is generally not required on the server.
Firstly, it’s necessary to obtain the names along with their UUID of the VMs due to their requirement for the different commands used for controlling the VM:
VBoxManage list vms
To initiate a VM named Windows Server 2022 without showcasing it locally, input the subsequent command:
VBoxHeadless -s "Windows Server 2022"
Alternatively, you can also use the following command:
VBoxManage startvm "Windows Server 2022" --type headless
Starting a Virtual Machine in VirtualBox Headless
The same result can be achieved in the graphical console via Start > Start without GUI.
Install RDP Server
To transfer the guest operating system console from the remote VM to the client device, Oracle provides the VirtualBox Remote Display Protocol (VRDP) and the VirtualBox Remote Display Extension (VRDE). You have to download and install them separately.
The RDP server offers the advantage of accessing remote VMs without enabling the Remote Desktop feature in the guest OS. It doesn’t even need to be supported by the operating system. This mechanism is comparable to vmconnect in Hyper-V. VRDP is compatible with most RDP clients, including mstsc.exe on Windows.
Activate VRDE and configure ports
To activate the VRDP extension, switch to the installation directory of VirtualBox and call up the command-line tool VBoxManage.exe, which, in the following example, enables RDP access to a VM named Windows Server 2022:
VboxManage modifyvm "Windows Server 2022" --vrde on
The VRDP server can be turned off for the same VM with this command:
VBoxHeadless --startvm "Windows Server 2022" --vrde off
The VRDP server in VirtualBox is set to receive incoming connections on TCP port 3389 by default. However, when the VM isn’t running, you can modify this aspect in the following way:
VBoxManage modifyvm "Windows Server 2022" --vrde-port 5000,5010-5012
This change can be essential under certain circumstances, such as if RDP is already activated on the server. It’s due to TCP 3389 being also a default for that. The command provided above ensures that the VRDE server utilizes one of the ports from the list, which includes 5000 or any port ranging between 5010 and 5012 in the given example.
The settings of the VRDP server can also be adjusted on the Remote Control tab in the VM settings under Display.
Configure RDP Server via the Graphical Admin Console
Change the IP address of the VRDP Server
To display information about the started VM, including those about the VRDP server, use the following command:
VBoxManage showvminfo "VM Name"
Properties of the Switched On Virtual Machine
The IP address and the port used by the VRDP server can be found in the results under the VRDE property. To change its IP address, enter the following command:
VBoxManage modifyvm "VM Name" --vrdeaddress 10.0.20.10
Connecting to the VRDP Server, redirecting USB devices
In RDP clients, you do not use the IP address of the guest operating system but that of the VRDP server. If you have changed the port, you must specify it accordingly here.
Establishing an RDP Connection with a Remote VM under VirtualBox
The VRDP server can also access the USB devices of the client computer so that they are available to the user in the guest OS. The client being used must, of course, support this redirection.
Unlike a direct RDP connection with the guest OS, the VRDP server allows multiple simultaneous Windows VM access.