0

I created an Ubuntu 20.04 virtual machine following this guide. I am able to ssh into the virtual machine using the IP address I wrote in the network-config file, i.e., 192.168.122.101, however, when running virsh domifaddr <domain> and virsh net-dhcp-leases default, both show nothing, no IP address.

This only happens with Ubuntu 20.04 cloud images, with earlier Ubuntu versions and all CentOS cloud images I can see the assigned IP addresses using the above commands.

Any thoughts on this?

0

You chose to reconfigure your new virtual machine with a manually configured IP address rather than to obtain it from DHCP, as is the default for cloud images. If you had left it configured to use DHCP, it would have just continued to work.

By default virsh domifaddr queries the DHCP server lease table to find the guest's IP addresses. With manually configured addresses in the guest, there is nothing to find here, so it can show nothing.

You can instead ask it to query the guest using the QEMU guest agent. This agent should be installed and running by default on cloud images that target the KVM hypervisor, e.g. focal-server-cloudimg-amd64-disk-kvm.img.

For example:

virsh domifaddr guestname --source agent

This returns a view of the network configuration from inside the guest, which will differ from the outside view, e.g. the guest network interface names will be shown instead of the host virtual interface names.

Compare:

# virsh domifaddr example-staging 
 Name       MAC address          Protocol     Address
-------------------------------------------------------------------------------
 vnet1      52:54:00:6b:3b:e4    ipv4         192.168.122.248/24

with:

# virsh domifaddr example-staging --source agent
 Name       MAC address          Protocol     Address
-------------------------------------------------------------------------------
 lo         00:00:00:00:00:00    ipv4         127.0.0.1/8
 -          -                    ipv6         ::1/128
 enp1s0     52:54:00:6b:3b:e4    ipv4         192.168.122.248/24
 -          -                    ipv6         fe80::72aa:277e:2feb:5e60/64
1
  • I tried creating an Ubuntu 20.04 virtual machine without specifying any networking configuration, but for some reason DHCP just won't work, the virtual machine just won't be assigned to any IP address. I created another question here regarding this issue. The problem only occurs with Ubuntu 20.04, CentOS works fine, no clue why. – azaroseu Jun 4 at 2:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.