[libvirt-users] Can libvirt set or change the IP address of guest machine

Michal Privoznik mprivozn at redhat.com
Mon Mar 19 15:26:07 UTC 2012


On 18.03.2012 03:24, Harold Fei wrote:
> To Whom It May Concern:
> 
> I use libvirt over one month, I
> need a function to set the ip address of the guest machine. One can
> change the guest ip address will be a great appreciation. However, I did
> not find such a feature in the process of learning libvirt. The purpose
> of this mail is to ask the experts whether libvirt provide such a
> feature. If there is no, how can I implement such functionality.

You can create static leases based on interfaces MACs:

http://www.redhat.com/archives/libvir-list/2009-February/msg00373.html

However, libvirt lacks API for changing guest's interface IP on the fly
since qemu-ga lacks such feature too. Therefore when implementing this
functionality - qemu-ga part needs to be done firstly so you can build
on stable interface. This may be your inspiration:

http://lists.gnu.org/archive/html/qemu-devel/2012-02/msg04173.html

> 
> Additionally, I already know NAT based network and Routed network can
> use DHCP, but I want to use an existing host bridge.

I think this is what you are looking for:

http://libvirt.org/formatnetwork.html#examplesBridge

Michal




More information about the libvirt-users mailing list