[Unit] Description=Small DNS server to resolve everything to the AP interface. BindsTo=sys-subsystem-net-devices-ap0.device After=sys-subsystem-net-devices-ap0.device Before=network.target Wants=network.target # check existence of configuration file ConditionPathExists= /etc/wpa_supplicant/wpa_supplicant-ap0.conf ConditionPathExists=!/etc/wpa_supplicant/wpa_supplicant-wlan0.conf [Service] ExecStart=/usr/sbin/dnsmasq -k --conf-file=/etc/dnsmasq.conf ExecReload=/bin/kill -HUP $MAINPID Restart=on-failure RestartSec=5 [Install] WantedBy=sys-subsystem-net-devices-ap0.device