Cookie
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.
Olga Weis Olga Weis Jul 15, 2022

COM Ports in Virtual Machines: Definitive Guide

Virtual environments offer many great benefits, however, there is one significant drawback – the access to the serial ports in virtual machines is often overly complicated if not impossible. What do you do if you need to transfer data for debugging purposes or use an external serial device in a virtual machine?

FlexiHub


Windows, macOS, Linux, Android 4.8 Rank based on 386+ Reviews
Share Serial over IP

In this article, you’ll find easy-to-follow guides on accessing a serial port in virtual machines for all popular virtualization environments. This will be specifically useful for the owners of serial port consoles, modems, or any other COM-based peripherals they need to redirect from a host PC to a virtual machine.

It can be very frustrating to attempt to connect a VM in VirtualBox to a serial port on a Linux or Windows PC. Native support for serial devices is lacking in virtualization solutions.

This article discusses methods of accessing serial ports in popular virtualization solutions like Hyper-V, VMware ESXi, and VirtualBox. We show you how to get the most from your serial-based peripherals when working with virtual machines.

Also, you’ll find out how to map a COM port from a physical to a virtual machine using a special-purpose software solution.

How to get a virtual machine to recognize COM ports

FlexiHub

Windows, macOS, Linux, Android
4.8 Rank based on 386+ Reviews
The easiest and the most convenient way to access serial ports in virtual machines is through the use of FlexiHub.
FlexiHub

With FlexiHub’s advanced functionality, you can create a virtual copy of a real serial port on any networked computer and then connect that COM port to the virtual machine’s guest OS via the network. After that, any serial device attached to the physical serial port will instantly show up in your VM’s guest system like it was connected to that virtual machine directly.

Above that, with FlexiHub you’ll have no trouble connecting to remote serial devices over all distances. This is particularly useful when you don’t have an opportunity to directly plug a device into your computer’s physical serial port. Thanks to the cutting-edge COM port virtualization technology, FlexiHub is ideal for COM port redirection to virtual machines all over the network.

How to redirect COM ports to virtual machines with FlexiHub - Video Guide

share serial ports over IP protocol

As FlexiHub works over the Internet, a COM port device’s physical location will make no matter at all. Once you install FlexiHub on the server machine with an attached serial device and the client computers, you’ll be able to connect virtual serial ports over IP and access COM devices in a virtual machine remotely.

How to set up COM port in VM with FlexiHub

1
Firstly, register a FlexiHub account to be able to access the COM port in a virtual machine and start a free demo.
 register a free demo
2
Install FlexiHub on the host machine, launch it and log in. You will see a list of devices connected to the computer.
 flexihub login
3
It’s time to install FlexiHub on the guest operating system and use the same login and password to log into the application.
 flexihub main screen
4
In the list of available devices select the one you need and click ‘Connect’.
 connect com port to virtual machine

The devices connected to the host’s serial ports will become accessible in a virtual machine. No further adjustments or setting configurations are required. You can manage serial ports from a virtual machine simply and conveniently. FlexiHub is compatible with all major virtualization software, including Hyper-V, VirtualBox, and VMWare.

Configuring COM ports for Hyper-V virtual machines

com ports in hyper-v

Now let’s have a look at the Hyper-V native method of setting up COM to VM passthrough. Here is what you need to do to configure a COM port for a virtual machine Windows 10:

  1. Go to your virtual machine’s settings (right-click the VM’s name and click “Settings" on the invoked menu).

  2. On the “Hardware” menu, find the COM port you’re going to redirect and select the “Named Pipe” radio button.

  3. Enter the pipe’s name in the text box, e.g. COM1, and copy the path to the pipe (it’ll be something like \\.\pipe\COM1).

Note: The name must be unique so it’s a good idea to check if the name is already in use by running this command in the PowerShell terminal:

[System.IO.Directory]::GetFiles("\\.\\pipe\\").Contains("\\.\\pipe\\COM1")

  1. Use that path to connect the pipe via the serial client of your choice (e.g. Putty). To do that, you may need to run as Admin for your terminal client.

After that, you’ll see that pipe in the list of all named pipes that you currently use.
To see the list, run this command in a PowerShell terminal:

[System.IO.Directory]::GetFiles("\\.\\pipe\\")

Now you can use the named pipe path to connect to Windows virtual machine COM ports on the Hyper-V host machine.

Redirect serial ports to Hyper-V
30-day demo period

For more detailed information, you can check out this guide: Hyper-V serial port passthrough →

How to configure a COM port for a virtual machine on VirtualBox

com ports on virtualbox

VirtualBox also has some built-in functionality you can use to access RS232 in virtual machines.

From the Settings tab or the VBox Manage command, you can configure the Port Mode and Port Number to create up to four virtual serial ports in each virtual machine. But to ensure compatibility with the guest OS, you’ll need to configure your virtual serial ports as a “standard UART device”.

VirtualBox COM port redirection
30-day demo period

This will allow you to send and receive serial data but the whole set-up process differs for each specific operating system and may require certain technical skills to perform.

Use the following steps to add a COM port to a VirtualBox VM.

  1. Make sure the serial device is physically connected to the port.
  2. Click on Server Connection.
  3. Create a connection with RAW Data Transfer.
  4. Start a VM from the app.
  5. Create a RAW client connection using virtual serial port COM1.
  6. Enter the IP address of the server machine.

You can now receive data from the connected serial device.

For the detailed setup description, please check out this comprehensive guide: VirtualBox serial port passthrough →

How to enable COM port passthrough in VMware Workstation

com ports in vmware

In VMware, you can create up to 4 virtual interfaces for each VM that can be used to redirect data to physical serial ports, files, or named pipes.

You can try this method to access a serial modem or some other COM-based peripheral during your next VMware Workstation session. On top of that, with its help, you can send debugging data to the host or another virtual machine.

Here is how you can add serial ports to VMware Workstation

  1. Go to the virtual machine’s Settings (VM must be shut down).
  2. On the "Hardware" tab, click “Add” to invoke the "Add Hardware" wizard and choose "Serial Port”.
  3. Click “Finish” and choose the destination of the serial port output.

And here is a much more detailed guide on setting up VMware serial port passthrough →

Connect serial ports to VMware
30-day demo period

Summing up

It’s up to you to decide which of the methods described here is best suited for your specific situation, needs, and level of competence. But to make the right choice, please note that using a purpose-designed software application has many significant advantages compared to all the native methods.

First and foremost, FlexiHub has no limit of serial ports you can redirect to each of your virtual machines. On top of that, it’s a truly universal solution that works on every platform and is compatible with all popular virtualization environments. And, the cherry on top, you won’t need any technical training to use the app as FlexiHub has a very self-explanatory user interface.

Top choice
FlexiHub
  • 4.8 overall rank based on 386+ Reviews
  • Requirements: Windows, macOS, Linux, Android and Raspberry Pi.
  • 10.45MB Size.
  • Version 6.1.15025. (19 Feb, 2024).