Can I connect two VMs via a serial port?

   I have two legacy applications that communicate via Serial port.  Is it possible to have two VMs on the same physical machine connect via a virtual serial port in VMWare?  If so, how do I do this?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
AFAIK you can only map a physical serial port into the VM. So you need to physical serial ports, connected together, and one assigned to each VM.
Brett DanneyIT ArchitectCommented:
You simply edit the VM configuration and add a serial port. You will need to add rules to prevent these two connected VM's from migrating to other hosts, or you will need to add a connecting cable to each host and add a rule that these two VM's must always be kept on the same host.
pbenitoAuthor Commented:
Ok, but is this possible in VMWare....and if so, how is it done?
I¨m not sure, but VMWare server allowed to work also with named pipes. Try this one:

Steps involved:
Create the serial ports within the VM
Start the VM
Connect to the Special File on the VM host

Create the serial ports within the VM

1. With your virtual machine stopped and using the GUI vmware console click on the "add hardware" button
2. Add a serial port with the following parameters
* Connect at Power On: checked
* Use Named Pipe
* Output file is ./serial1
* This end is the server
* The other end is an application
3. You may want to add a second serial port now.

Note: At this point you have told vmware to create the file ./serial1 in the directory containing the other files for this VM. This file won't be created until you start the VM the next time.

Start the VM

1. Start the VM. As soon as the VM reaches the BIOS prompt it will have created the special file ./serial1 on the VMware host machine.

Connect to the Special File

VMWare calls this a "Named Pipe", but it's actually a Unix Domain Socket. A named pipe can be opened as a file, but a UDS cannot. Instead, I use this hackish command to get to the UDS.

socat -d -d -d /var/lib/vmware/Virtual\ Machines/vmtestcli5/serial2tcp4-listen:9988

This links the Unix Domain Socket to port 9988 on the local machine.

1. Using telnet open port 9988 on the vmware host machine. You will be able to communicate into and out of the serial port.
* Rather than "tcp4-listen:9988" you can use "stdio" to go directly to/from a shell on the vmware host server.
* Any control characters do not get passed through appropriately.


Perhaps helps...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.