Aim:
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.)
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.)
- Setup the environment:
- Install VirtualBox on your Windows PC.
- Create a virtual machine on it for Ubuntu.
- 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.
- Install the latest version of Ubuntu on it using the iso image available here: http://www.ubuntu.com/download/desktop
- Install VirtualBox Guest Additions on Ubuntu and make sure that things like bidirectional clipboard copy work between Ubuntu and Windows.
- Install PuTTY on Ubuntu (sudo apt-get install putty).
- 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 - 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" - 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 - 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.
- Start the second Ubuntu VM and run PuTTY on both VMs.
- 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! |
My putty won't connect. Says:
ReplyDelete"Unable to open connection to:
Unable to open serial port"
Did everything as you said except with ubuntu 12.04. Advice?
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!.
ReplyDeleteCreate 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.