IP Address From QEMU Guest Agent

On a KVM host, it’s fairly easy to get a guest’s IP from the internal network to the host.

[jhooks@kvm2 ~]$ sudo virsh domifaddr Tower
 Name       MAC address          Protocol     Address
-------------------------------------------------------------------------------
 vnet0      52:54:00:e7:01:55    ipv4         192.168.122.149/24

However if you you have the guest on a full bridge or macvtap interface you won’t see anything. To get that information you need to add the QEMU guest agent.

On CentOS it’s simply called qemu-guest-agent.

With this installed you can now query the guest’s address by passing --source agent:

[jhooks@kvm2 ~]$ sudo virsh domifaddr Tower --source agent
Name       MAC address          Protocol     Address
------------------------------------------------------------------------------
lo         00:00:00:00:00:00    ipv4         127.0.0.1/8
-          -                    ipv6         ::1/128
eth0       52:54:00:fc:77:18    ipv4         10.1.30.14/24
-          -                    ipv6         fe80::5054:ff:fefc:7718/64
vnet0      52:54:00:e7:01:55    ipv4         192.168.122.149/24

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s