[fedora-virt] how to edit dhcp configuration

Cole Robinson crobinso at redhat.com
Mon Oct 19 13:39:44 UTC 2009


On 10/19/2009 06:37 AM, Pavel Lisy wrote:
> Hello
> 
> I want to set fixed IP for host (from MAC address) in dhcp. How can I do
> it through libvirt configuration? 
> 
> There is not possibility set it in virt-manager. I can edit manually
> ldapnet.xml (ldapnet is name of my network) but: 
> 
> 1. question:
> Where is right place to edit it:
> /etc/libvirt/qemu/networks/ldapnet.xml
> or
> /var/lib/libvirt/network/ldapnet.xml
> (after reboot one file replaces other but which direction but I didn't
> find which direction)
> 

The 'right' place is to use 'virsh net-edit <network name>'. Editing the
files in place provides no error checking and can require a libvirtd
restart. The user shouldn't have to know where the files are kept.

> 2. question:
> How can I propagate this changes?
> 
> Neither 
> /etc/init.d/libvirtd reload
> /etc/init.d/libvirtd restart
> changes dnsmasq settings. It is done only during reboot, why?
> 

Before you make the changes, do 'virsh net-destroy <net name>'. This
will shutdown the network (dnsmasq), but NOT delete it in any way. Then
use 'virsh net-edit <net name>' as mentioned above to make your changes.
Finally, use 'virsh net-start <net name>' which will start a new dnsmasq
process.

- Cole

> 3. I've found this workaround: 
> * kill dnsmasq process for this settings
> * start dnsmasq with new settings, ex.
>    .... --dhcp-host 52:54:00:22:a7:76,ldap-m1.ldapnet.tmapy.cz,192.168.241.101
> Is it way how to do it through libvirt utility?
> 
> Pavel 




More information about the virt mailing list