Run dnsmasq with systemdΒΆ

Create /etc/systemd/system/dnsmasq@.service with these contents:

# '%i' becomes 'virbr10' when running `systemctl start dnsmasq@virbr10.service`
# Remember to run `systemctl daemon-reload` after creating or editing this file.

Description=DHCP and DNS caching server for %i.

ExecStart=/usr/sbin/dnsmasq -k --conf-file=/var/lib/dnsmasq/%i/dnsmasq.conf
ExecReload=/bin/kill -HUP $MAINPID


It is best to only start dnsmasq when the bridge is up. If using NetworkManager, create /etc/NetworkManager/dispatcher.d/99-virbr10 and make it executable.

# See the "DISPATCHER SCRIPTS" section of `man NetworkManager`.
# Remember to make this file executable!
[ "$1" != "virbr10" ] && exit 0
case "$2" in
        /bin/systemctl start dnsmasq@virbr10.service || :
        /bin/systemctl stop dnsmasq@virbr10.service || :

If using Debian, append two command options to /etc/network/interfaces.

auto virbr10
iface virbr10 inet static
    ... snipped ...
    up /bin/systemctl start dnsmasq@virbr10.service || :
    down /bin/systemctl stop dnsmasq@virbr10.service || :

Alternatively, just start dnsmasq at every boot.

# systemctl enable dnsmasq@virbr10.service
# systemctl start dnsmasq@virbr10.service