VirtualBox COM port passthrough - a detailed how-to guide

Last updated

Some of the many advantages of using virtual environments are increased server utilization, improved recovery time following a disaster, and resource consolidation. A single physical server can share resources such as serial port connection, memory, and storage space for multiple virtual operating systems. The ability to access serial ports in VirtualBox enhances the efficiency of a virtual environment.

Unfortunately, it can be compacted to enable VirtualBox COM port passthrough due to the lack of serial port support built into virtualization platforms. Therefore, other methods must be employed to provide a VirtualBox session with COM port connectivity. Here are several ways that it can be done.

Enabling serial port passthrough in VirtualBox


Windows, macOS, Linux, Android
4.8 Rank based on 78+ users
A very easy method of implementing VirtualBox serial port passthrough is with the software tool FlexiHub.

FlexiHub offers users a simple path to enable serial ports in VirtualBox or any other virtualization platform.

FlexiHub works by creating virtual connections and performing redirection of serial port data over a network to your VirtualBox instances. There are no complex parameters to configure. With FlexiHub, you can add a VirtualBox serial port using just one click.

Here is how to add serial ports in VirtualBox with FlexiHub:

  1. Register for a FlexiHub account and choose a plan that gives you the number of connections that you need.
  2. Install FlexiHub on the host computer that is connected to a serial device that you want to share.
  3. Now, install FlexiHub on the VirtualBox virtual machine that will receive the data stream from the redirected serial port.
  4. Launch the app and log into your account. The serial devices that are available for connection will be displayed by the program.
  5. Click ‘Connect’ to establish communication with the desired device.

You’re done! From this point on, serial devices connected to the host’s interfaces can be accessed in your virtual environment without any extra configuration. Flexihub allows you to efficiently manage serial ports in Hyper-V, VirtualBox, VMware, and other virtual environments.

How to configure a virtual serial port on VirtualBox

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 the way in which the virtual port is connected. The Port Mode options are Disconnected, Connected to Host Device or Connected to Host Pipe.

  • Disconnected indicates that the virtual session can see the device but cannot use it. It is as if there is no cabled connection to the peripheral.
  • The Host Device Connection requires establishing a physical connection between the virtual port and the hardware port on the host machine. On a Windows system, this will usually be a name such as COM1. Conversely, on a Linux machine, you will be connecting to /dev/ttyS0 or something similar. VirtualBox will then redirect all data transmitted through the virtual port to the physical device.
  • When using a Host Pipe connection to enable VirtualBox to share COM ports, configuration must be done to connect the virtual port and a software pipe on the host operating system. The specifics vary depending on the type of physical host on which VirtualBox is running. virtualbox serial port
    1. On Windows systems data is 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.
    2. On Mac machines, 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.
    3. 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 actually 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.
  • Raw File: The output of a virtual serial port can be directed to a file. This can be useful when gathering diagnostic or troubleshooting information. Any file can be used as long as the VirtualBox user has the required level of permission to create and write to it.
  • TCP Socket: A TCP socket can act as a TP client or server and facilitates sending VirtualBox COM port traffic to networks using the TCP/IP protocol. This method enables a remote machine to be directly connected to a guest serial port over a TCP network.
  1. TCP Server: The current Pipe/Socket checkbox needs to be deselected on the TCP server and the address/path field is used to specify the port number. This number can be 23 or 2023, and on UNIX systems needs to be more than 1024.
  2. TCP Client: The "Connect to Existing Pipe/Socket" box needs to be checked to put the TCP socket into client mode. When creating a virtual null-modem cable connection the other end connects over the TCP network by designating the hostname’s port in the Path/Address field.

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.


Requirements: Windows 7/8/10, Server 2008 R2/2012/2016/2019
Size: 7MB
Version: 4.4.13219 ()
User rating: (4.8 based on 78+ users)