Talk:Dnsmasq (简体中文)
Usage with libvirt
Network-manager think if there is one running libvirt that he run this before. To fix conflicts between other dnsmasq, eg: used in libvirt, you must run it externally.
We do not want change our resolv.conf automaticly.
/etc/NetworkManager/NetworkManager.conf
[main] ... dns=none
We put it manually here.
/etc/resolv.conf.head
nameserver 127.0.0.1
The interface to bind and bind it even if there is second dnsmasq runned on computer.
/etc/NetworkManager/dnsmasq.d/bind-interface.conf
interface=lo bind-interface
This start service if interface is up. This service can start only once before stop which will be initiate by systemd on restart/shutdown.
/etc/NetworkManager/dispatcher.d/10_dnsmasq
#!/bin/sh if [ -n "$2" ] && [ "$2" = "up" ]; then # $INTERFACE is up systemctl start NetworkManager-dnsmasq.service fi
Systemd service.
/etc/systemd/system/NetworkManager-dnsmasq.service
[Unit] Description=A lightweight DHCP and caching DNS server After=network.target Documentation=man:dnsmasq(8) [Service] Type=dbus BusName=uk.org.thekelleys.dnsmasq ExecStartPre=/usr/bin/dnsmasq --test ExecStart=/usr/bin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file --conf-dir=/etc/NetworkManager/dnsmasq.d/ ExecReload=/bin/kill -HUP $MAINPID