On 09/26/2013 12:41 AM, Mihamina Rakotomandimby wrote:
Hi all,

Running Fedora 18 and the bundled libvirt and virt-tools. Desktop use.

As I like to access my guests with a hostname and not a numerical IP address, I fix the IP addressing in the network configuration: http://pastebin.com/rfMKn40j

Unfortunately, I cant find a way to add a host without loosing the whole networking, as when I add a ahost, I destroy and redefine the network.

Restarting libvirtd is not the solution.


How would you recommend to have networking UP after network redefinition?


When you modify the definition of a network with "virsh net-edit", you must net-destroy then net-start the network for those changes to take effect. This has the unfortunate effect of destroying the network's bridge device, and when it is re-created the guests' tap devices aren't reattached to the new bridge.

Rather than adding the new static dhcp host entries with "virsh net-edit", you can add them with "virsh net-update", and the changes will take effect immediately without restarting the network or disconnecting the guests.

Here is an example of adding a static dhcp host entry to the "default" network using virsh net-update:

   virsh net-update --config --live default add ip-dhcp-host \
         "<host mac='52:54:00:01:02:03' name='xyz.example.com' ip='192.168.122.25'/>"

(the --config option tells virsh to make the change permanent in the network's config (otherwise it would only remain in place until the network was taken down, and be gone the next time it was started), and "--live" tells it to make the change take effect immediately on the running network.)

virsh net-update was introduced in libvirt-0.10.2, so you must be running at least that version to use it.