ping me diz que não é possível resolver alguns nomes de host ("ping: host desconhecido domain.company.local") em uma URL, mas quando eu uso host ou nslookup no mesmo computador no comando linha, as resoluções funciona bem (ou seja, é rápido e confiável).
O que poderia estar causando isso?
Mais testes: o Firefox, wget e ping têm o mesmo problema. Ping no endereço IP funciona.
OS: Linux (Ubuntu 13.04)
EDITAR Meu /etc/resolv.conf diz:
nameserver 127.0.1.1
search domain.company.local
netstat relatórios:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN -
então algo está sendo executado nessa porta ( nslookup também informa que usa 127.0.1.1 como servidor DNS).
Não há /etc/*inetd.conf , por isso não tenho certeza de qual aplicativo atende a essa porta.
Parece que dnsmasq é usado:
/usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces
--pid-file=/var/run/NetworkManager/dnsmasq.pid --listen-address=127.0.1.1
--conf-file=/var/run/NetworkManager/dnsmasq.conf --cache-size=0 --proxy-dnssec
--enable-dbus=org.freedesktop.NetworkManager.dnsmasq
--conf-dir=/etc/NetworkManager/dnsmasq.d
Todos os arquivos e pastas de configuração estão vazios. Como nslookup diz que usa 127.0.1.1#53 , meu palpite é que dnsmasq funciona mesmo sem uma configuração. Mas como ele sabe qual DNS pai deseja consultar?
EDIT2 Desativar dnsmasq como sugerido por harrymc não ajudou. Então eu corri strace ping que me deu essa saída estranha (apenas as partes interessantes):
open("/etc/host.conf", O_RDONLY|O_CLOEXEC) = 4
read(4, "127.0.0.1\tlocalhost\n#127.0.1.1\ta"..., 4096) = 613
...
open("/lib/libnss_mdns4_minimal.so.2", O_RDONLY|O_CLOEXEC) = 4
read(4, "7ELFhosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
nameserver 127.0.1.1
search domain.company.local
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN -
/usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces
--pid-file=/var/run/NetworkManager/dnsmasq.pid --listen-address=127.0.1.1
--conf-file=/var/run/NetworkManager/dnsmasq.conf --cache-size=0 --proxy-dnssec
--enable-dbus=org.freedesktop.NetworkManager.dnsmasq
--conf-dir=/etc/NetworkManager/dnsmasq.d
open("/etc/host.conf", O_RDONLY|O_CLOEXEC) = 4
read(4, "127.0.0.1\tlocalhost\n#127.0.1.1\ta"..., 4096) = 613
...
open("/lib/libnss_mdns4_minimal.so.2", O_RDONLY|O_CLOEXEC) = 4
read(4, "7ELFhosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%>%pre%%pre%%pre%%pre%%pre%\f%pre%%pre%%pre%%pre%%pre%%pre%"..., 832) = 832
...
mmap(NULL, 2105560, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0x7f7829b00000
...
socket(PF_FILE, SOCK_STREAM, 0) = 4
fcntl(4, F_GETFD) = 0
fcntl(4, F_SETFD, FD_CLOEXEC) = 0
connect(4, {sa_family=AF_FILE, path="/var/run/avahi-daemon/socket"}, 110) = 0
fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
fstat(4, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f782a4f8000
lseek(4, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
write(4, "RESOLVE-HOSTNAME-IPV4 domain.com"..., 44) = 44
read(4, "-15 Timeout reached\n", 4096) = 20
%pre%%pre%%pre%%pre%%pre%>%pre%%pre%%pre%%pre%%pre%\f%pre%%pre%%pre%%pre%%pre%%pre%"..., 832) = 832
...
mmap(NULL, 2105560, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0x7f7829b00000
...
socket(PF_FILE, SOCK_STREAM, 0) = 4
fcntl(4, F_GETFD) = 0
fcntl(4, F_SETFD, FD_CLOEXEC) = 0
connect(4, {sa_family=AF_FILE, path="/var/run/avahi-daemon/socket"}, 110) = 0
fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
fstat(4, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f782a4f8000
lseek(4, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
write(4, "RESOLVE-HOSTNAME-IPV4 domain.com"..., 44) = 44
read(4, "-15 Timeout reached\n", 4096) = 20
Portanto, ping procura /etc/hosts , o que faz sentido. Em seguida, ele carrega e mmap() s /lib/libnss_mdns4_minimal.so.2 , o que também faz sentido.
Mas então fala com avahi !?
O que me levou a este post no fórum: ping não faz um pedido de DNS .
Meu /etc/nsswitch.conf também contém esta linha:
%pre%
Se eu ping um endereço de trabalho, vejo que o processo também carrega /lib/libnss_mdns4_minimal.so.2 , mas, em seguida, ele faz uma consulta DNS pela porta 53.
Então, meu palpite é de que /lib/libnss_mdns4_minimal.so.2 está de alguma forma percebendo que o endereço IP termina com .local e não com .com e, em seguida, o [NOTFOUND=return] é acionado.
Como corrijo isso?