How to redirect COM
port in Virtual Machine - 2019 full guide



Virtualization gives us an easy and efficient way to use multiple operating system environments on the same computer. By running a virtual machine on your current OS, you get the ability to test out other operating systems, access software or applications designed for them, create OS backups, etc. What’s convenient is that you only need one set of physical resources, like CPU and RAM and hard drive space.

If you have a serial printer, modem or any other COM-based peripheral attached to your local PC and need to connect this device to your virtual machine, you can do this via a virtual serial port. Want to know how to enable a COM port in a virtual machine? Well, it all depends on the virtualization software you use. Some virtualization apps let you connect to your host’s serial devices after you just make some additional configurations, while other solutions offer no access to physical serial ports of the host computer unless you use a dedicated third-party tool working over the network.

In this article, I’ll describe several common methods to enable COM port redirection in a virtual machine.

Contents

  1. How to access remote serial ports in a virtual machine
  2. RS232 in a virtual machine: configuring COM ports in popular
    virtualization apps.
  3. What is virtualization and when is it useful?
  4. Software tools for redirecting COM ports to a virtual machine

The simplest way to access serial ports from a virtual machine


Serial to Ethernet Connector is a powerful network solution which makes it possible to work with remote serial ports in a virtual machine. This app is designed to create virtual copies of real serial ports. With the help of the software, you can establish a client connection from your guest OS to a serial port of any computer connected to your network. The app will create a virtual serial port in your virtual machine and link it to the real COM port over LAN or the Internet. Now, once a serial device is attached to the hardware port, the device will appear in your guest system like it was connected physically.

To get started, simply download Serial to Ethernet Connector and install it on both your host and guest operating systems. Create and share a virtual serial port in virtual machine (Hyper-V, VMware, Citrix XenDesktop, etc.) as though it were a real COM interface.
Sec logo

Serial to Ethernet Connector

Access remote serial port over IP Network for Windows
4.9 Rank based on 52+ users, Reviews(86)
Download 14-day fully-functional trial period
Serial over Network Connector

How to access serial port in Virtual Machine


Here’s what you should do if you want to access your local COM port peripheral from a guest OS:

On your host computer:

  • Download Serial to Ethernet Connector, install it and start.
  • Go to the “Server connection’ tab and specify the host’s COM port, to which the device is attached, as well as a TCP port to listen on.
  • Click “Create server connection”.

On your guest operating system:

  • Install the software, launch it and head to the “Client connection” tab.
  • Specify the host’s IP address and the TCP port you selected for the “server connection”.
  • Choose the name for your virtual machine’s COM port and enable the “Create as virtual serial port” option.
  • Click “Create client connection.

This is it! Once you create a client connection, the app links your virtual serial port to the real COM interface of the host system. As a result, you can access a serial device connected to this port right from your virtual machine.

RS232 in a virtual machine: configuring COM ports in popular virtualization apps.


The ability to redirect serial port data to a virtual environment allows increased utilization of the physical server's resources. Below, you’ll find the instructions on how to add a COM port to Hyper-V virtual machine or set up serial communication in VMware, VirtualBox, and Citrix XenDesktop
virtualization apps.

COM port access in VMware


As I have already mentioned, one of the easiest ways to forward your serial peripheral data to a guest OS is a dedicated app like Serial to Ethernet Connector, which is tailored for precisely this purpose. There are also some native methods to access a serial device in VMware. When you configure COM port communication in VMware, you can select a hardware serial port of the host machine, a file for the output data, or a named pipe for your connection.

serial port in VMware

Here are the simple steps to follow when you need to work with a serial port in VMware:

  1. Open Settings in your guest OS;
  2. Go to the “Hardware” tab and click “Add”;
  3. Follow the wizard and choose a COM port;
  4. Then, choose where the serial port will redirect the output data. In case it’s a named pipe, configure it;
  5. Enable the “Connect at power on” option, if you want to connect to the selected port when the virtual machine turns on;
  6. Click “Finish” and a remote serial port will be added to your VM.

Adding a COM port in the vSphere Client


vSphere virtual machines can work with up to 4 virtual COM ports. Most commonly virtual interfaces are used for connecting to the host’s hardware serial ports. Also, you may send output to a file on the host computer or establish connections over the network using the Virtual Serial Port Concentrator (vSPC).

So, to add a virtual COM port, do the following in the vSphere Client inventory:

  • right-click the VM you need and chose “Edit Settings”;
  • in the Hardware tab, click “Add”;
  • choose “Serial Port”, then hit “Next”;
  • specify the type of media that will be accessed by the port;
  • If you want to connect a serial port over the network, select “Use Virtual Serial Port Concentrator (vSPC)” and enter the location of the vSPC URI.
  • Finally, click “Finish” to complete the process.

Connecting a serial port to a named pipe


The vSphere Client lets you connect a virtual serial port to a named pipe. This means you can establish direct communication between two virtual machines like they were connected via a real serial cable. This option is especially useful for those who utilize a guest OS for remote debugging, etc.

To configure a COM port to map to a named pipe, take the following steps:

  • In the inventory panel of your vSphere Client, choose the VM that is going to be modified;
  • In the Commands box on the Summary tab, select Edit Settings and you’ll see the “Virtual Machine Properties” window. In this window, click “Add” in order to open the “Add Hardware” dialog;
  • There choose “Serial Port” and “Use Named pipe”;
  • Once done, specify the filename and path for the pipe. Use the following formats: “\\.\pipe\namedpipe” for Windows guests and “/tmp/socket” for Linux guests;
  • Configure the settings “For Near End” and “For Far End”;
  • Click “Finish”.

That’s it! The next time you start your virtual machine, it will recognize the new serial port.

With the help of the advanced serial to Ethernet software you can easily connect RS232, RS422, RS485 port devices to your virtual machine over the Internet or LAN. The program is completely compatible with VMware, Hyper-V and VirtualBox.

Sec logo

Serial to Ethernet Connector

Access remote serial port over IP Network for Windows
4.9 Rank based on 52+ users, Reviews(86)
Download 14-day fully-functional trial period
Serial over Network Connector


Serial port access in Hyper-V


Now let’s consider how to set up Hyper-V COM port passthrough. To be able to work a serial port in Hyper-V virtual machine, you should do as follows:

In Hyper-V Manager:

  • Right-click the required virtual machine and open its “Settings”;
  • Go to the “Hardware menu” and select the serial port you need
    (let it be COM1);
  • Click on the radio button “Named pipe”;
  • Now, type the pipe name (e.g. COM1);
  • Hyper-V will show the named pipe path (like \\.\pipe\COM1).
Microsoft Hyper-V

On the host machine:

  • Connect to the named pipe using the path you got earlier. A serial client (like Putty) will help you do this.
    Also, you may need to run As Admin for your terminal client.
  • To show a list of all named pipes that you currently use, run the following command in a PowerShell terminal:
    [System.IO.Directory]::GetFiles("\\.\\pipe\\")
  • To check if a certain named pipe exists, use:
    [System.IO.Directory]::GetFiles("\\.\\pipe\\").Contains("\\.\\pipe\\COM1")

PipeDream for Hyper-V - add a named pipe serial port to your virtual machine


PipeDream is a software solution that assists in creating connections between virtual machines and COM ports residing on the virtualization hosts. PipeDream offers Hyper-V's named pipe support, meaning that there’s no need to connect to the network. All you need to do is specify the pipe name in Hyper-V and use PipeDream to redirect a serial device to your guest OS.

How to add a COM port to Hyper-V virtual machine:

To access RS232 in Hyper-V, first of all, you should set up a virtual COM port for your guest system. (It’s recommended that you use a Generation 1 VM.)

  • Open Hyper-V Manager, go to Settings of the required virtual machine and choose COM1 or COM2 from the list of available hardware.
    The selected serial port will be used by your guest virtual machine for connecting to the host’s serial device.

Then, configure the virtual serial port to communicate through a named pipe:

  • click on “Named pipe” and type the name "PipeDream".

After that, just run PipeDream on the host computer to connect your serial device to the guest VM.

Working with serial ports in VirtualBox


VirtualBox

Let’s imagine a situation where you need to establish a communication between a program you use on a VirtualBox guest VM (let it be Linux) and a serial app running on the host computer (Windows, for example). Is it possible? Sure. To achieve this, you should create two virtual COM ports on the virtualization host, bridge these ports, and connect one of them to the guest VM’s application and the other one to the host’s app.

This is how you do it:

  1. Create two virtual serial ports on the host machine with the help of dedicated software, Serial to Ethernet Connector.
  2. Get access to a COM port in VirtualBox. To set up VirtualBox port forwarding, make the following configurations:
    • Check the box next to “Enable Serial Port”, enter Port/File Path.
    • Flag “Create Pipe” check box, start your machine with this option enabled. If the box “Create Pipe” is not checked, you’ll get an error message.
Access to a COM port in VirtualBox

Provide access to a serial port in Citrix XenDesktop


Working in the Citrix XenDesktop environment, you may face the challenge of redirecting the host’s serial devices to your virtual session. To resolve this task, you can either use a specialized third-party solution called Serial to Ethernet Connector or try one of the native solutions offered by Citrix.

Client COM port mapping is what makes serial communication possible. In order to connect to a hardware serial port, a driver of an operating system gives it a symboliс link name (COM1, COM2, COM3, etc.), which can be then used by serial apps for accessing a real port.

There are three possible ways to get access to a COM device in Citrix:

  • you can map a client COM port to your Citrix session using Studio policies;
  • using the command prompt of the Citrix Virtual Delivery Agent;
  • or with the help of the Citrix Remote Desktop Configuration tool.

What is virtualization and when is it useful?


Linux and Mac users sometimes need to run programs that work only on Windows, and Windows users, especially programmers, often need to run Linux-based applications or use several versions of Windows at a time.

The most obvious way to accomplish this task is to purchase one more computer. However, it doesn’t seem cost-effective to buy an expensive new PC when all you want to do is run a copy of software designed for another OS.

So, you can try another available option that is to install two (or more) Windows versions side-by-side on the same PC and choose between them at boot time. Such an installation can break everything, but if you succeed, you will be able to choose the operating system to boot at the computer start.

There is also the third way: virtualization.

Virtualization describes a technology that allows the creation of isolated environments within a single piece of hardware. Each environment looks like a separate computer with its own characteristics, such as the CPU's memory, I/O, network traffic, etc. Such an environment is called a set of logical resources or a virtual machine.

Thanks to virtualization, you can run multiple operating system images on your computer at the same time. The emulated equivalent of a computer system that runs on top of another system is called a guest operating system.

The virtual machine’s emulation engine, known as a hypervisor, handles the virtual hardware, including a CPU, memory, hard drive, network interface, and other devices. The hypervisor provides isolation of operating systems from each other and divides resources between operating systems running on the host machine.

Depending on the type of virtualization used, the hypervisor can run guest virtual machines directly on a system's hardware, or on top of the main operating system.

Software tools for redirecting serial ports to a virtual environment


As you can see, using a virtual machine is really beneficial for both ordinary users and big enterprises. Virtualization is especially useful when you have the ability to connect from your virtual machine to the host’s hardware serial ports and devices attached to them. Even better, if you can access COM port devices connected to remote computers. Except for Serial to Ethernet Connector, this advanced capability is offered by the following software solutions:

TCP/Com


TCP/Com

To enable COM port redirection in a virtual machine, you can use a friendly and functional software app called TCP/Com. This program lets you forward serial port data over the TCP/IP or UDP network. With TCP/Com, you’ll be able to connect from your Windows-based serial app to any remote RS232 port and exchange data with COM ports located on other computers in your network.


Advanced Virtual COM port


Advanced Virtual COM Port

Advanced Virtual COM Port is another powerful utility, with which you can have a VM serial port connected over the network. The software gives you a way to share real COM ports over the network. It lets you create virtual serial interfaces as well. Virtual RS232 ports will be exact copies of hardware ports, so your host and guest operating systems will treat them like real ones.

Conclusion

Virtual machines are undoubtedly one of the most useful things for any computer user. They offer a range of options that make the work more efficient and flexible. But when it comes to remote access to serial peripherals, most often you rely on some additional tools. Serial to Ethernet Connector software seems to be the optimal solution to provide a reliable connection to any local or remote serial port from a guest operating system.

Serial to Ethernet Connector

Requirements for Windows (32-bit and 64-bit): XP/2003/2008/ Vista/7/8/10, Windows Server 2012
Requirements for Linux: Kubuntu 9.10 “Karmic Koala”, openSUSE 11.2 , 4.66MB size
Version 7.1.876 (27th Jan, 2017) Release notes
Category: CommunicationApplication