LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   "nc -v somehost.example.com 22" returns "nc: getaddrinfo: Name or service not known" (http://www.linuxquestions.org/questions/linux-newbie-8/nc-v-somehost-example-com-22-returns-nc-getaddrinfo-name-or-service-not-known-846272/)

kenneho 11-24-2010 10:16 AM

"nc -v somehost.example.com 22" returns "nc: getaddrinfo: Name or service not known"
 
Hi.


I have this issue: "nc -v <ip-address> 22" works fine, but "nc -v <fqdn> 22" fails with error message "nc: getaddrinfo: Name or service not known". However, "host <fqdn>" works fine, so name resolution works. So I have a working name resolution, but nc (netcat) doesn't seems to be using it or something. Same kind of issue with "ping <fqdn>".

Does anyone know how come name resolution works, but utilities such as nc and ping doesn't?


- kenneho

AlucardZero 11-24-2010 10:32 AM

Open /etc/nsswitch.conf. Make sure the hosts line has "dns" in it. e.g.:
Code:

hosts:      files dns

kenneho 11-25-2010 02:58 AM

Quote:

Originally Posted by AlucardZero (Post 4169570)
Open /etc/nsswitch.conf. Make sure the hosts line has "dns" in it. e.g.:
Code:

hosts:      files dns

Thanks for your reply. I got it working now, by replacing the line "hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4" with "hosts: files dns". Seems like the mdns4_minimal thing breaks name resolving, but I'm not quite sure what this mdns4 thing is. Semes to have something to do with multicast DNS, which again I'm not quite sure what actually does. :)


All times are GMT -5. The time now is 04:55 PM.