10.2.2. Setting up Communication between Guest Agent and Host


The host machine communicates with the guest agent through a VirtIO serial connection between the host and guest machines. A VirtIO serial channel is connected to the host via a character device driver (typically a Unix socket), and the guest listens on this serial channel. The following procedure shows how to set up the host and guest machines for guest agent use.

Note

For instructions on how to set up the QEMU guest agent on Windows guests, refer to the instructions found here.

Procedure 10.1. Setting up communication between guest agent and host

  1. Open the guest XML

    Open the guest XML with the QEMU guest agent configuration. You will need the guest name to open the file. Use the command # virsh list on the host machine to list the guests that it can recognize. In this example, the guest's name is rhel6:
    # virsh edit rhel6
  2. Edit the guest XML file

    Add the following elements to the XML file and save the changes.
    <channel type='unix'>
       <source mode='bind' path='/var/lib/libvirt/qemu/rhel6.agent'/>
       <target type='virtio' name='org.qemu.guest_agent.0'/>
    </channel>
    
    
    Copy to clipboard

    Figure 10.1. Editing the guest XML to configure the QEMU guest agent

  3. Start the QEMU guest agent in the guest

    Download and install the guest agent in the guest virtual machine using yum install qemu-guest-agent if you have not done so already. Once installed, start the service as follows:
    # service start qemu-guest-agent
You can now communicate with the guest by sending valid libvirt commands over the established character device driver.
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat, Inc.