[libvirt-users] Assigning static ip address in libvirt

Laine Stump laine at laine.org
Wed Aug 3 15:47:14 UTC 2016


On 08/02/2016 09:00 AM, harish.shastry at gmail.com wrote:
> Hello
>
> Is there way to assign static ip address to lxc and KVM guests with 
> libvirt?
>
> I saw some snippets here 
> https://libvirt.org/formatdomain.html#ipconfig but unable to get it to 
> work.

That method only works for lxc (only the IP address of the *host* side 
of the tap device can be configured for qemu guests), and only if your 
libvirt is at least version 1.2.12.

Another method is to add a static host entry to the dhcp configuration 
for the network used to connect the guest. If the guest interface is 
connected to a libvirt virtual network, you can just do what is 
described here:

http://wiki.libvirt.org/page/Networking#virsh_net-update

Otherwise, if the guest is connected via a bridge (or macvtap) directly 
to an external network, you'll need to configure the dhcp server for 
that network (which is outside the scope of libvirt)




More information about the libvirt-users mailing list