Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have set up a few soon-to-be production VMs running on QEMU-KVM on Ubuntu 10.04 LTS.

As for networking, I chose the "NAT" option in Virt-Manager and each VM now gets an IP address 192.168.122.x from QEMU's internal DHCP server.

I've restarted the VMs several times and the IP addresses are always the same. I've given each VM a network adapter with a unique MAC address.

So can I rely on that QEMU's internal DHCP server will give out the same IP addresses? Or is the safest option to set static IP addresses from within each VM?

share|improve this question
add comment

1 Answer

Seems my question is answered in the libvirt manual. One needs to specifically ensure that the same IP is handed out via DHCP each time. Here's how this can be specified:

<network>
  …
  <ip address="192.0.2.1" netmask="255.255.255.0">
    <dhcp>
      <range start="192.0.2.128" end="192.0.2.254">
      <host mac="01:23:45:67:89:ab" name="foo.example.com" ip="192.0.2.64">
    </dhcp>
  </ip>
</network>

Alternatively, static IP is a viable option.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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