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).
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:
- To check if a certain named pipe exists, use:
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
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:
- Create two virtual serial ports on the host machine with the help of dedicated software, Serial to Ethernet Connector.
- 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.
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:
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 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.
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.