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.

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 78+ users
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. 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 78+ users
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

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.

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.

Connect serial ports to VMware
30-day demo period

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 →

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

  • Rank 4.8 based on 78+ users
  • Requirements: Windows 7/8/10, Server 2008 R2/2012/2016/2019. 8.82MB Size.
  • Version 5.1.13941. (29 Jul, 2021).