On Sun, Nov 09, 2025 at 09:13:13PM +0800, Robert Hoo wrote:
> On 11/6/2025 10:32 PM, Stefano Garzarella wrote:
> > On Fri, Oct 10, 2025 at 09:00:21PM +0800, Robert Hoo wrote:
> > > Hi,
> > > 
> > > Does vsock support communication between guests?
> > > From man page, and my experiment, seems it doesn't.
> > > But why not?
> > > 
> > 
> > It depends, vhost-user vsock device, supports it.
> > See 
> > https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-vsock#sibling-vm-communication
> > 
> > The vhost-vsock in-kernel device doesn't support it.
> > 
> > The main problem is that vsock is designed for host<->guest
> > communication, so implementing a guest<->guest communication is
> > possible, but requires more configuration (e.g. some kind of firewall,
> > etc.) and also an extension to the address (see the required
> > `.svm_flags = VMADDR_FLAG_TO_HOST` in the link).
> > 
> > The easy way to do that with vhost-vsock, is to use socat in the host to
> > concatenate 2 VMs (some examples here:
> > https://stefano-garzarella.github.io/posts/2021-01-22-socat-vsock/)
> > 
> > Cheers,
> > Stefano
> > 
> Nice, thanks Stefano. It sounds ideal for my VM <--> VM communication
> requirement. I'll read the doc carefully later.
> 

Though not as convenient as socat, VSOCK also supports sockmap which can
do this in-kernel (bpf), there are a few test cases for this in
selftests/bpf.

Best,
Bobby

Reply via email to