Como depurar o dnsmasq exigindo uma reinicialização do serviço para funcionar?

1

Em um servidor meu, eu tenho o setup do dnsmasq; é configurado como outro servidor, onde funciona (embora, com outro hardware e o / s).

Neste host específico, porém, o dnsmasq não funciona após a inicialização (os clientes não podem resolver nomes), mas funciona, se eu reiniciá-lo manualmente ( service dnsmasq restart ).

Não consigo descobrir nada dos registros, o que não mostra nenhum problema. Extrato do syslog, imediatamente após a inicialização:

15:Apr 13 12:31:39 <server_hostname> systemd[1]: Stopping dnsmasq - A lightweight DHCP and caching DNS server...
276:Apr 13 12:32:22 <server_hostname> systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
285:Apr 13 12:32:22 <server_hostname> dnsmasq[592]: dnsmasq: syntax check OK.
511:Apr 13 12:32:22 <server_hostname> dnsmasq[622]: started, version 2.75 cachesize 150
512:Apr 13 12:32:22 <server_hostname> dnsmasq[622]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify
513:Apr 13 12:32:22 <server_hostname> dnsmasq[622]: DNS service limited to local subnets
514:Apr 13 12:32:22 <server_hostname> dnsmasq[622]: warning: ignoring resolv-file flag because no-resolv is set
515:Apr 13 12:32:22 <server_hostname> dnsmasq-dhcp[622]: DHCP, IP range 192.168.166.2 -- 192.168.166.254, lease time 1h
516:Apr 13 12:32:22 <server_hostname> dnsmasq[622]: using nameserver 209.222.18.218#53
517:Apr 13 12:32:22 <server_hostname> dnsmasq[622]: using nameserver 209.222.18.222#53
518:Apr 13 12:32:22 <server_hostname> dnsmasq[622]: read /etc/hosts - 5 addresses
558:Apr 13 12:32:22 <server_hostname> systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
568:Apr 13 12:32:24 <server_hostname> dnsmasq-dhcp[622]: DHCP packet received on eth1 which has no address
575:Apr 13 12:32:27 <server_hostname> dnsmasq-dhcp[622]: DHCP packet received on eth1 which has no address
589:Apr 13 12:32:32 <server_hostname> dnsmasq-dhcp[622]: DHCPDISCOVER(eth1) 192.168.166.129 <client_mac>
590:Apr 13 12:32:32 <server_hostname> dnsmasq-dhcp[622]: DHCPOFFER(eth1) 192.168.166.129 <client_mac>
591:Apr 13 12:32:32 <server_hostname> dnsmasq-dhcp[622]: DHCPREQUEST(eth1) 192.168.166.129 <client_mac>
592:Apr 13 12:32:32 <server_hostname> dnsmasq-dhcp[622]: DHCPACK(eth1) 192.168.166.129 <client_mac> <client_hostname>

Entradas adicionadas após a execução de service dnsmasq restart :

625:Apr 13 12:33:39 <server_hostname> systemd[1]: Stopping dnsmasq - A lightweight DHCP and caching DNS server...
626:Apr 13 12:33:39 <server_hostname> dnsmasq[622]: exiting on receipt of SIGTERM
627:Apr 13 12:33:39 <server_hostname> systemd[1]: Stopped dnsmasq - A lightweight DHCP and caching DNS server.
628:Apr 13 12:33:39 <server_hostname> systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
629:Apr 13 12:33:39 <server_hostname> dnsmasq[875]: dnsmasq: syntax check OK.
630:Apr 13 12:33:39 <server_hostname> dnsmasq[885]: started, version 2.75 cachesize 150
631:Apr 13 12:33:39 <server_hostname> dnsmasq[885]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify
632:Apr 13 12:33:39 <server_hostname> dnsmasq[885]: DNS service limited to local subnets
633:Apr 13 12:33:39 <server_hostname> dnsmasq[885]: warning: ignoring resolv-file flag because no-resolv is set
634:Apr 13 12:33:39 <server_hostname> dnsmasq-dhcp[885]: DHCP, IP range 192.168.166.2 -- 192.168.166.254, lease time 1h
635:Apr 13 12:33:39 <server_hostname> dnsmasq[885]: using nameserver 209.222.18.218#53
636:Apr 13 12:33:39 <server_hostname> dnsmasq[885]: using nameserver 209.222.18.222#53
637:Apr 13 12:33:39 <server_hostname> dnsmasq[885]: read /etc/hosts - 5 addresses
638:Apr 13 12:33:40 <server_hostname> systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.

O servidor é um Ubuntu 16.04; A versão do dnsmasq é 2.75-1ubuntu0.16.04.4 .

A configuração (em /etc/dnsmasq.d/ ) é:

bind-interfaces
dhcp-range=eth1,192.168.100.2,192.168.100.254
server=<dns_server_1>
server=<dns_server_2>
no-resolv

Como posso depurar este problema? Qual é a causa possível?

    
por Marcus 13.04.2018 / 12:50

1 resposta

0

Esta é realmente uma condição de corrida entre systemd e dnsmasq, que também pode acontecer em Raspbian.

A solução é certificar-se de que as interfaces de rede estejam ativas antes de iniciar o dnsmasq:

sudo systemctl edit dnsmasq

E adicione:

[Unit]
After=network-online.target
Wants=network-online.target

Referência: link

    
por 14.04.2018 / 00:01