Skip to main content

Serial Ports between Ubuntu Guests on a Windows Host using VirtualBox

To establish a virtual serial connection between two Ubuntu virtual machines running on a Windows 7 host using VirtualBox. They should be able to exchange data over ttyS0 using a terminal emulation software like PuTTY. It like simulating two physical PCs both running Ubuntu, whose RS232 Ports are connected to each other using a null modem cable (TX to RX).

My setup:
Host OS: Windows 7 32 bit
Guest1 OS: Ubuntu 10.10 i386
Guest2 OS: Ubuntu 10.10 i386
VirtualBox: 4.1.16
(The following method should work on newer versions of VirtualBox and the Host and Guest OSes. Note that Ubuntu 10.10 is no longer supported, so it is better that you try this with a new version.)
  1. Setup the environment:

    1. Install VirtualBox on your Windows PC.
    2. Create a virtual machine on it for Ubuntu.
    3. Make sure to enable COM1 and COM2 for this machine under the serial ports option and leave them as disconnected before you install Ubuntu on it.
    4. Install the latest version of Ubuntu on it using the iso image available here:
    5. Install VirtualBox Guest Additions on Ubuntu and make sure that things like bidirectional clipboard copy work between Ubuntu and Windows.
    6. Install PuTTY on Ubuntu (sudo apt-get install putty).
    7. Turn off the Ubuntu virtual machine (VM) and clone it to end up with two similar virtual machines.
      Two Ubuntu Virtual Machines created on Windows 7 PC using VirtualBox
  2. Right click the first Ubuntu virtual machine and perform the following setting:
    Set Port type to "Host Pipe".
    Enter Path as "\\.\pipe\myserial".
    Check "Create Pipe"
  3. Right click the second (Cloned) Ubuntu virtual machine and perform the following setting:
    Set Port type to "Host Pipe".
    Enter Path as "\\.\pipe\myserial".
    Leave "Create Pipe" unchecked on this second VM
  4. Now start the first Ubuntu VM only. This one had the "Create Pipe" checked. Starting this VM before the other one will create the pipe and the other Ubuntu VM will connect to this pipe.
  5. Start the second Ubuntu VM and run PuTTY on both VMs.
  6. Now using PuTTY, open ttyS0 on both VMs. Try typing something in PuTTY window on one VM, it should show up on the other and vice versa. Since we are using pipes, the baudrate (Speed) on PuTTY's configuration page does not matter.
PuTTY config page

Great Success!


  1. My putty won't connect. Says:
    "Unable to open connection to:
    Unable to open serial port"

    Did everything as you said except with ubuntu 12.04. Advice?

  2. check if ls /dev shows ttyS0? if now then probably the linux VM wasnt able to detect the virtual serial port. You have to enable the serial port in virtual box before you install ubuntu on your virtual machine!.

    Create a new virtual machine, configure it to enable the com port, leave com port as disconnected, install ubuntu, shut down VM, clone it, then configure the VMs to have a pipe between their serial ports and then start the VMs and try.


Post a Comment