[libvirt-users] how to make dhcrelay service use libvirt's interfaces?

Laine Stump laine at laine.org
Thu Nov 5 19:01:15 UTC 2015

On 11/05/2015 09:33 AM, lejeczek wrote:
> hi everybody
> in my libvirtd I use bridge with route forward mode,
> Problem for me is dhcrelay.service on host which is starting before 
> libvirtd thus not listening on libvirt interface.
> OS is RHEL7.
> I wonder if you know how to fix it, besides restarting dhcrelay that is.

You could make that happen automatically with a libvirt "network hook":


You would want to create a hook script in /etc/libvirt/hooks/network 
that takes action (restarts dhcrelay) when $1 is the network in 
question, and $2 is "started" (you may also want to take action when $2 
is "stopped" just for symmetry). You'll be able to learn the name of the 
bridge device by examining the XML of the network that your script will 
receive on stdin. Searching for "network" on the above page will give 
more details about what is possible.

More information about the libvirt-users mailing list