[libvirt-users] Automatically assign static ipv4 via dhcp to new VMs
Laine Stump
laine at laine.org
Wed Oct 30 09:25:56 UTC 2013
On 10/18/2013 12:31 AM, Tim wrote:
> Thanks for the hint with net-update, thats exactly that what I was
> looking for.
>
> Am 07.10.2013 13:10, schrieb Laine Stump:
>> Fortunately, in libvirt 0.10.0 and later (I think that is the version it
>> was added) you can use the "virsh net-update" command to add net static
>> host entries immediately without restarting the network; something like
>> this:
>>
>> virsh net-update MyGuest --live internet add \
>> ip-dhcp-host "<host mac='AA:BB:CC:DD:EE:FF' ip='192.168.122.2'
>> name='foobar'/>"
>>
I just happened across this message when going through the backlog and
noticed that I forgot to add "--config" to the above commandline -
without --config, the new entry will only survive until the network is
destroyed (e.g. the host is rebooted), after which it will be lost.
Assuming you've already added several hosts without using --config, you
can transfer them into the permanent network config like this:
virsh net-dumpxml MyGuest
....
virsh net-edit MyGuest
[cut-paste the <host> lines from the dumpxml output into the
configuration file]
Sorry for the omission (and any surprises it may have caused).
More information about the libvirt-users
mailing list