FlexiHub Team uses cookies to personalize your experience on our website. By continuing to use this site, you agree to our cookie policy. Click here to learn more.

VirtualBox COM Port Passthrough: Definitive Guide

Olga Weis Olga Weis Last updated Jun 17, 2022

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.

Access serial ports in VirtualBox


Windows, macOS, Linux, Android
4.8 Rank based on 386+ Reviews
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 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.

How to share COM ports to VirtualBox

Register a FlexiHub account and start a free demo evaluation.
 flexihub registration
Install FlexiHub on the VirtualBox host with a physical serial port that will be redirected. After that, install FlexiHub on the VirtualBox virtual machine that will connect to the host’s serial port.
 install flexihub
Launch the app both on the host and guest VM and log into your account.
 log into flexihub
The serial devices that are available for connection will be displayed in the FlexiHub’s interface.
 virtualbox com port to network
On the guest machine, click ‘Connect’ in the app’s interface to access a serial port in VirtualBox.
 access serial port in virtualbox

From this point on, serial devices connected to the VirtualBox serial ports will be redirected to the virtual environment without any extra configuration.

For the video instructions on how to share serial ports to VirtualBox, you can check out this brief guide:

share serial ports to VirtualBox

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

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:

  1. Disconnected;
  2. Connected to Host Device;
  3. Connected to Host Pipe;
  4. RAW file;
  5. TCP socket.
  • 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, the configuration must be done to connect the virtual port and a software pipe on the host operating system.
    virtualbox serial port
The specifics vary depending on the type of physical host on which VirtualBox is running.
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.
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 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.
  1. 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.

  2. 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.

    • 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.
    • 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.

How to forward ports in VirtualBox: A VirtualBox Port Forwarding Guide

VirtualBox allows users to create virtual machines via NAT network type by default. For users interested in running server software within a virtual machine, they must alter its network type—or forward ports through virtual NAT. We will try to explain how to configure port forwarding VirtualBox capabilities, allowing users to manage and run desired software inside their VB virtual machines/desktops.

Virtual machines usually don’t require being accessible from beyond the virtual machine. This is why default settings are fine for a majority of users. In fact, default settings can offer additional security, being that it isolates the virtual machine from inbound connections.

Thanks to the NAT network type, the host operating system handles all of the network address translation. Virtual machines share the host machine’s IP address without receiving any traffic from outside. Users have the option of activating the bridged networking mode, which allows virtual machines to appear as separate devices on a network—as well as having their own IP addresses.

Alter a virtual machine’s network type in VirtualBox by:

Step 1: Right-clicking the desired virtual machine and choose the Settings option. If the Settings option isn’t available, users must turn off the virtual machine prior to making any further changes.

Settings option

Step 2: From within the Networks setting section, choose the Bridged adapter network mode.

Step 3: Hit OK.

Bridget adapter

Serial port forward VirtualBox configurations for virtual machines

For users who’d rather use NAT network mode, VirtualBox port forwarding can also be executed via the virtual machine’s NAT.

Please note: Only one of these steps is required. Users do not need to forward ports if they’ve already enabled bridged networking (as shown in the previous steps).

There was a time when VirtualBox users were forced to use the VBoxManage command to forward ports. However, now, VirtualBox contains a simple and user-friendly port-forwarding window.

To establish port forwarding with the VBoxManage command instead of the modern GUI (Graphical User Interface), follow these instructions to do so — located in VirtualBox’s user manual.

Forward ports in VirtualBox by:

Step 1: Selecting the Settings option (located in the menu as shown below) to open a virtual machine’s settings window.

Step 2: Navigate to the Network pane in the virtual machine’s configuration window.

Step 3: Expand the Advanced section, then hit the Port Forwarding button.

Please note: This button is only active for those using a NAT network type—users must only forward ports when using a NAT.

forward ports

All in all, it’s much easier (and recommended) to use VirtualBox’s Port Forwarding Rules window. Users aren’t required to specify any IP addresses, as those specific fields are considered optional.

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, macOS, Linux, Android and Raspberry Pi.
Size: 10.4MB
Version: 6.0.14865 (31 May, 2023)
User rating: (4.8 based on 386+ reviews)