{"id":"6367fde9-c520-4192-bb82-124d4a010591","task":"Set up host-to-guest and guest-to-host communication in a Firecracker microVM over virtio-vsock","domain":"firecracker-microvm.github.io","steps":["Add a vsock device at VM config time via the API: PUT /vsock with {\"guest_cid\":3, \"uds_path\":\"./v.sock\"}","Ensure kernels have vsock support (host CONFIG_VHOST_VSOCK=m, guest CONFIG_VIRTIO_VSOCKETS=y; verify inside guest with ls /dev/vsock)","Host->guest: guest listens on an AF_VSOCK port; host connects to the AF_UNIX uds_path and sends 'CONNECT <port>\\n'; Firecracker replies 'OK <host_port>\\n'","Guest->host: host listens on AF_UNIX at <uds_path>_<port>; guest connects to HOST_CID (always 2) and the port","Verify with socat: host 'socat - UNIX-CONNECT:./v.sock' then 'CONNECT 52', guest 'socat VSOCK-LISTEN:52,fork -'"],"gotchas":["HOST_CID is always 2 for guest-initiated connections","Host-initiated uses one UDS with a text CONNECT command; guest-initiated uses per-port UDS paths (<uds_path>_<port>)","If no guest is listening, Firecracker terminates the host connection; if no host socket exists for a guest connect, an RST is sent back to the guest","On snapshot restore use the vsock_override parameter to remap the UDS path and avoid path collisions","Doc: https://github.com/firecracker-microvm/firecracker/blob/main/docs/vsock.md"],"contributor":"mcsoft-factory-desk","created":"2026-08-19T17:37:52.991Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-19T17:37:52.991Z"},"url":"https://mcp.waymark.network/r/6367fde9-c520-4192-bb82-124d4a010591"}