Sto cercando di connettermi da un sistema 10.04 a un sistema 12.04 tramite SSH. Stranamente le regole resolv.confsembrano avere effetto solo in modo selettivo, il che mi lascia perplesso. Osservare:
[2] user@mach:~$ ssh pangolin
ssh: Could not resolve hostname pangolin: Name or service not known
[2] user@mach:~$ host pangolin
pangolin.subdomain.domain.tld has address 172.16.7.12
subdomain.domain.tldè in searchlinea /etc/resolv.confe l'utilizzo hostdel nome è cercato correttamente date queste regole. Tuttavia, con il client SSH sshricevo l'errore riprodotto sopra. Come può essere? Ho sempre avuto l'impressione che le regole di risoluzione dei nomi si resolv.confapplichino a system-global.
Nota: /etc/hostsnon dichiara affatto il nome pangolin. Il pacchetto openssh-serverè configurato sul computer di destinazione. La domanda è puramente perché la risoluzione dei nomi non è coerente tra questi due programmi.
Un'altra nota: il comando funziona benissimo quando inserisco il nome di dominio completo, vale a dire pangolin.subdomain.domain.tld.
Nel frattempo ho riavviato il computer client (10.04) e il problema persiste. Un demone di cache DNS non è installato, quindi credo che non avrebbe dovuto essere comunque un problema.
Le informazioni richieste nel commento:
$ grep host /etc/nsswitch.conf
hosts: files dns
/etc/resolv.conf, Ho trasformato i nomi di dominio in modo coerente:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 172.16.1.1
nameserver 172.16.1.5
search subdomain.domain1.com domain1.com domain2 domain3.com domain2.ccTLD domain3.net dev.domain1.com sdk.dev.domain1.com
... e il pieno /etc/nsswitch.conf:
$ cat /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat
group: compat
shadow: compat
hosts: files dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
... e /etc/network/interfaces, che è la fonte per resolv.confin 12.04:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 172.16.1.234
netmask 255.255.0.0
gateway 172.16.255.254
dns-nameservers 172.16.1.1 172.16.1.5
dns-search domain1.com. domain2. domain3.com. domain2.ccTLD. domain3.net. dev.domain1.com. sdk.dev.domain1.com. subdomain.domain1.com.
dns-domain subdomain.domain1.com.
Nota: la trasformazione dei nomi di dominio è stata eseguita con sed, quindi è coerente tra i vari file riprodotti.
Non c'è ~/.ssh/config, ma ecco quello globale ( /etc/ssh/ssh_config), ridotto per brevità:
$ grep -v '^#' /etc/ssh/ssh_config |grep -v '^[[:space:]]*$'
Host *
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
$ mtr pangolin
Name or service not known: Success
mtr pangolin?
/etc/resolv.confe l'output di questo comandogrep host /etc/nsswitch.conf?