How to determine IP address of guest operating system in qemu

dhcpkvm-virtualizationnetworkingqemuvirtualization

After I boot a Windows XP in qemu it gets an IP assigned from DHCP server. My question is – how do I determine the IP that Windows XP got assigned, so that I can connect to Windows XP?

Here are more details about my setup:

I run dnsmasq on tun0 interface. I've set it up to give IPs from range 10.10.10.0/24. I use -net tun for qemu. I run multiple Windows XP guest installations so I can't use static IP addresses.

Best Answer

Just assign a static IP in Windows XP and you can use that to connect to your VM.

Another alternative is that you can tell Dnsmasq to allocate a static IP address to the VM's MAC address.

Dnsmasq stores its DHCP leases into file specified with the -l or --dhcp-leasefile option. One can parse that file for IP address information.