
Nowadays there isn’t as much use for COM ports as it once was. And yet, they still can find their practical application and do you a great deal of good.
For example, you’ve got to have at least one serial port or you won’t be able to interact with the vast majority of the kernel debugging tools. In actual practice, it doesn’t have to be a physical COM-port. With the right software tool, you might as well do kernel debugging through a virtual serial port on a virtual machine.
This tutorial will show you how to redirect a serial port from the host to a guest VM in VirtualBox and how to create virtual serial ports in VirtualBox.
FlexiHub
FlexiHub offers users a simple path to enable serial ports in VirtualBox or any other virtualization platform by redirecting serial port devices to guest virtual machines over the network.
FlexiHub works by creating virtual connections and redirecting serial port data over a network to the VirtualBox virtual machines. There are no complex parameters to configure. With FlexiHub, you can add a VirtualBox serial port with just one click.
From this point on, serial devices connected to the VirtualBox serial ports will be redirected to the virtual environment without any extra configuration.
Another method of setting up COM port forwarding on VirtualBox can be done with capabilities built into the platform. Virtual serial ports are enabled with the guest OS presented with a standard UART device to ensure compatibility. The connection is configurable and provides the ability to send and receive data. Configuration details vary based on the host OS being used.
VirtualBox serial port setup can be accomplished through the Settings tab or the VBox Manage command. This allows you to create up to four virtual serial ports in each virtual machine. You are required to configure the Port Mode and Port Number.
You should use standard values when defining the Port Number as it describes the serial port that the virtual machine will use. You also have the option of creating a user-defined serial port by providing an IRQ and I/O base address.
Port Mode defines how the virtual port is connected. The Port Mode options are:
Windows
|
Windows
|
The data gets transmitted through a named pipe. The pipe name needs to be registered with the following format \\.\pipe\<name> where <name> is used as a machine identifier. It can be a user-defined name chosen for simplicity or any reason. |
macOS
|
macOS
|
The connection is made through a local domain socket. Using tmp as the socket filename is a common practice that provides the VirtualBox user with privileges such as writing to the pipe. |
Linux
|
Linux
|
Linux users can make use of multiple tools that establish a connection to a local domain socket. One that is widely used and available in many Linux distros is Socat.
VirtualBox operates under the premise that the socket or pipe it references exists.
When you are implementing a direct connection between two virtual machines, one machine creates a pipe or socket and the second VM attaches to it.
|
You can configure four serial ports on each machine and multiple port numbers can be chosen.
We hope the details in this guide demonstrate how to share a COM port in VirtualBox. FlexiHub may present the simplest way to add COM ports in VirtualBox, but as you can see there are other options. Once configured, you can enjoy the full functionality of serial devices from within a virtual session as if you were directly connected to the peripheral equipment.
FlexiHub