Serial port between two VMs?

Tom Moyer

New Member
Jun 1, 2019
11
0
1
40
Is it possible to connect the serial ports of two virtual machines on Proxmox? I am working on a project that requires me to debug the kernel over a serial cable. I see a lot of documentation on connecting the physical host to a guest via serial but I need specifically guest to guest serial connections.
 
PVE (and even QEMU itself AFAIK) doesn't directly support it, but you can emulate it by creating a serial connection to the host for both VMs and then connecting them together via socat.

E.g., assuming your VMs have ID 101 and 102:
Code:
# add the serial ports
qm set 101 -serial0 socket
qm set 102 -serial0 socket

# start both VMs
qm start 101
qm start 102

# connect the two serial ports on the host
socat UNIX-CLIENT:/var/run/qemu-server/101.serial0 UNIX-CLIENT:/var/run/qemu-server/102.serial0

You can test the connection by simply echo-ing some text into /dev/ttyS0 on one VM while cat-ing /dev/ttyS0 on the other. Keep in mind that socat has to keep running on the host, lest the VMs will be disconnected.
 
  • Like
Reactions: Moayad

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!