[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Getting Error: Servname not supported for ai_socktype -- getaddrinfo problems? Bind issues?

Posted on 2004-11-12
20
Medium Priority
?
13,842 Views
Last Modified: 2007-12-19
I have a server running RedHat Enterprise Linux ES 3.3 and I'm having some problems.

Whenever I try to do a whois from the server, or ping anything outside the server itself, I can't do it.

With whois, if I type in

whois google.com

I get:

[Querying whois.internic.net]
[whois.internic.net: Servname not supported for ai_socktype]
[Unable to connect to remote host]

I might expect bind to be the problem, but it is running and I don't have a problem connecting to sites via lynx or something like that.

But things like whois, ping and dig all refuse to work

I checked /etc/resolv.conf and it is set to two valid, currently working nameservers.

Just on the off chance, I tried changing it to another pair of nameservers that I know work and the problem doesn't go away.

Is this a problem with getaddrinfo() or bind itself?

Any ideas?
0
Comment
Question by:Xenmaster
  • 8
  • 8
  • 4
20 Comments
 
LVL 38

Expert Comment

by:wesly_chen
ID: 12572183
Hi,

> ping and dig all refuse to work
> I might expect bind to be the problem, but it is running
Could you provide
/etc/nsswitch.conf
/etc/resolv.conf
/etc/named.conf

   You didn't mention "/etc/nsswitch.conf" which should have a line in it like:
-----
hosts:   files dns       <==== dns is needed for querry DNS, if not there, please add it
----

Regards,

Wesly
0
 

Author Comment

by:Xenmaster
ID: 12575187
nsswitch.conf has the line you mention:

#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Legal entries are:
#
#       nisplus or nis+         Use NIS+ (NIS version 3)
#       nis or yp               Use NIS (NIS version 2), also called YP
#       dns                     Use DNS (Domain Name Service)
#       files                   Use the local files
#       db                      Use the local database (.db) files
#       compat                  Use NIS on compat mode
#       hesiod                  Use Hesiod for user lookups
#       [NOTFOUND=return]       Stop searching if not found so far
#
# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
#
# Example:  
#passwd:    db files nisplus nis
#shadow:    db files nisplus nis
#group:     db files nisplus nis

passwd:     files
shadow:     files
group:      files

#hosts:     db files nisplus nis dns
hosts:      files dns

# Example - obey only what nisplus tells us...
#services:   nisplus [NOTFOUND=return] files
#networks:   nisplus [NOTFOUND=return] files
#protocols:  nisplus [NOTFOUND=return] files
#rpc:        nisplus [NOTFOUND=return] files
#ethers:     nisplus [NOTFOUND=return] files
#netmasks:   nisplus [NOTFOUND=return] files
bootparams: nisplus [NOTFOUND=return] files

ethers:     files
netmasks:   files
networks:   files
protocols:  files
rpc:        files
services:   files

netgroup:   files

publickey:  nisplus

automount:  files
aliases:    files nisplus


resolv.conf:
nameserver 216.234.234.30
nameserver 12.96.160.115
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 12575211
> resolv.conf:
> nameserver 216.234.234.30
> nameserver 12.96.160.115
So the RHEL ES 3.0 upgrade 3 are not using it itself as DNS server from this setting.
Could your "ping 216.234.234.30" on youe RHEL box?
If not, then please check your default gateway.
# netstat -rn
And add a default gateway:
# route add default gw <gateway IP>

Wesly
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Xenmaster
ID: 12575299
No, both nameservers ping just fine and there is a gateway setup.
We have our NOC working on the server too for the past hour but so far, no luck.

I should mention that I did try shutting down the firewall we use and that didn't help either.
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 12575348
> I might expect bind to be the problem, but it is running
Where is bind running on? On RHEL ES or on 216.234.234.30?
Sorry, could you provde some information about your network infrustructure?

If your bind is running on RHEL ES, then /etc/resolv.conf should have
"nameserver 127.0.01" as the first nameserver.

If DNS is running on other machine (216.234.234.30), then RHEL ES has nothing to do with bind.
In this case, you need to work on (216.234.234.30).

Wesly
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12575389
It looks to me like the nameserver at 216.234.234.30 doesn't respond to queries, but the one at 12.96.160.115 does. To see if you get the same results try:

host -T whois.internic.net 216.234.234.30
--and--
host -T whois.internic.net 12.96.160.115

If only the second name server responds remove the first from resolv.conf and retry the whois.
0
 

Author Comment

by:Xenmaster
ID: 12575621
resolv.conf should not have 127.0.0.1, having that would be a security risk. Just on the off-chance however, we added localhost back to resolv.conf and that didn't help.

We tried it also using the server's own nameservers... no go.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12575755
resolv.conf would only contain 127.0.0.1 if the system were running Bind (i.e., it is a DNS server).

Have you tried what I suggested above yet?
0
 

Author Comment

by:Xenmaster
ID: 12575773
We do notice localization issues:

strace whois -v yahoo.com
execve("/usr/bin/whois", ["whois", "-v", "yahoo.com"], [/* 27 vars */]) = 0
uname({sys="Linux", node="omally.ds-omally.net", ...}) = 0
brk(0)                                  = 0x9d09000
open("/etc/ld.so.preload", O_RDONLY)    = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=18, ...}) = 0
old_mmap(NULL, 18, PROT_READ|PROT_WRITE, MAP_PRIVATE, 3, 0) = 0xbf7ff000
close(3)                                = 0
open("/lib/libsafe.so.2", O_RDONLY)     = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\30\20\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=19641, ...}) = 0
old_mmap(NULL, 18132, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xfc3000
old_mmap(0xfc7000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x3000) = 0xfc7000
close(3)                                = 0
munmap(0xbf7ff000, 18)                  = 0
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=42396, ...}) = 0
old_mmap(NULL, 42396, PROT_READ, MAP_PRIVATE, 3, 0) = 0xbf7f5000
close(3)                                = 0
open("/lib/tls/libc.so.6", O_RDONLY)    = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200X\1"..., 512) = 512
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xbf7f4000
fstat64(3, {st_mode=S_IFREG|0755, st_size=1568924, ...}) = 0
old_mmap(NULL, 1276876, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x111000
old_mmap(0x243000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x131000) = 0x243000
old_mmap(0x247000, 7116, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x247000
close(3)                                = 0
open("/lib/libdl.so.2", O_RDONLY)       = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260\32"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=14868, ...}) = 0
old_mmap(NULL, 12244, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xf9d000
old_mmap(0xf9f000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x1000) = 0xf9f000
close(3)                                = 0
set_thread_area({entry_number:-1 -> 6, base_addr:0xbf7f4b40, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
munmap(0xbf7f5000, 42396)               = 0
readlink("/proc/self/exe", "/usr/bin/jwhois", 4095) = 15
brk(0)                                  = 0x9d09000
brk(0x9d2a000)                          = 0x9d2a000
open("/etc/libsafe.exclude", O_RDONLY)  = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=32148976, ...}) = 0
mmap2(NULL, 2097152, PROT_READ, MAP_PRIVATE, 3, 0) = 0xbf5f4000
mmap2(NULL, 1097728, PROT_READ, MAP_PRIVATE, 3, 0x261) = 0xbf4e8000
mmap2(NULL, 4096, PROT_READ, MAP_PRIVATE, 3, 0x594) = 0xbf4e7000
close(3)                                = 0
open("/etc/jwhois.conf", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=23296, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xbf4e6000
read(3, "# This is jwhois.conf - an examp"..., 4096) = 4096
read(3, "\";\n\t}\n\t\"\\\\.coop$\" = \"whois.nic.c"..., 4096) = 4096
read(3, "esignated port. Default is to\n\t#"..., 4096) = 4096
read(3, "p\";\t# APNIC JPNIC-NET-JP\n\t\"210.2"..., 4096) = 4096
read(3, " escaped and should enclose the "..., 4096) = 4096
read(3, "net\\\\.vn\" {\n\t\thttp = \"true\";\n\t\th"..., 4096) = 2816
read(3, "", 4096)                       = 0
open("/usr/share/locale/locale.alias", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=2601, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xbf4e5000
read(4, "# Locale name alias data base.\n#"..., 4096) = 2601
read(4, "", 4096)                       = 0
close(4)                                = 0
munmap(0xbf4e5000, 4096)                = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/jwhois.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/jwhois.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/jwhois.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/jwhois.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/jwhois.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/jwhois.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xbf4e5000
write(1, "[Querying whois.internic.net]\n", 30[Querying whois.internic.net]
) = 30
open("/etc/nsswitch.conf", O_RDONLY)    = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=1686, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xbf4e4000
read(4, "#\n# /etc/nsswitch.conf\n#\n# An ex"..., 4096) = 1686
read(4, "", 4096)                       = 0
close(4)                                = 0
munmap(0xbf4e4000, 4096)                = 0
open("/etc/ld.so.cache", O_RDONLY)      = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=42396, ...}) = 0
old_mmap(NULL, 42396, PROT_READ, MAP_PRIVATE, 4, 0) = 0xbf4da000
close(4)                                = 0
open("/lib/libnss_files.so.2", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20\35\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0755, st_size=51920, ...}) = 0
old_mmap(NULL, 46716, PROT_READ|PROT_EXEC, MAP_PRIVATE, 4, 0) = 0x5d2000
old_mmap(0x5dd000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 4, 0xa000) = 0x5dd000
close(4)                                = 0
munmap(0xbf4da000, 42396)               = 0
open("/etc/services", O_RDONLY)         = 4
fcntl64(4, F_GETFD)                     = 0
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
fstat64(4, {st_mode=S_IFREG|0644, st_size=2348, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xbf4e4000
read(4, "# /etc/services:\n# $Id: services"..., 4096) = 2348
read(4, "", 4096)                       = 0
close(4)                                = 0
munmap(0xbf4e4000, 4096)                = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(1, "[whois.internic.net: Servname no"..., 61[whois.internic.net: Servname not supported for ai_socktype]
) = 61
write(1, "[Unable to connect to remote hos"..., 35[Unable to connect to remote host]
) = 35
munmap(0xbf4e5000, 4096)                = 0
exit_group(1)                           = ?
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 12575786
Could you provde some information about your network infrustructure?
Thanks.

Wesly
0
 

Author Comment

by:Xenmaster
ID: 12575842
This particular server is hosted at The Planet in Texas and is connected to their network via a single 10Mbit eathernet connection (eth0).

jlevie, we tried what you asked, and a number of other things and everything checks out OK, but whois still refuses to work. We also tried using TP's own nameservers. We have other servers at TP that aren't having this problem so it has to be a more localized issue.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12575864
There's something odd here. Towards the top of the strace you'll see:

open("/lib/libsafe.so.2", O_RDONLY)

and what's odd about that is that it isn't a part of a RedHat Enterprise 3.0 distribution. So it sounds to me that you aren't running a stock RHEL 3.0 ES system. What's been changed/added to this installation?
0
 

Author Comment

by:Xenmaster
ID: 12575910
What you see is libsafe 2.0.16. That was added long ago to the server and whois worked fine. So far as I am aware there haven't been any new additions or changes to the server other than what CPANEL may have added (and no, we don't have CPANEL itself set to auto update).
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12576035
Okay, so libsafe doesn't sound to be a part of the problem.

What I don't see in your strace, as compared to mine on a stock & fully up2date RHEL 3.0 system is any activity related to DNS lookups. The locale lib errors are normal, so that's not a part of the problem.  I'd expect to see some reads of /etc/services, /etc/resolv.conf, /etc/hosts /lib/libnss. /lib/libresolv, etc., which aren't in your strace. That says to me that whois isn't looking in DNS.

Given that this isn't a stock RHEL 3.0 ES system I'm not sure what might be causing this problem. But I'd guess it to be some change in one of the system libs,
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 12576176
Hi,

   Could you provide
# which whois
# ldd `which whois`

Wesly
0
 
LVL 38

Accepted Solution

by:
wesly_chen earned 2000 total points
ID: 12576365
Hi,

Here is my information for your comparison
# uname -r
2.4.21-20.EL
# which whois
/usr/bin/whois
# ldd `which whois`
        libc.so.6 => /lib/tls/libc.so.6 (0x00111000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00389000)
===============

jlevie points out one suspeciuos place which:
----
>read(4, "# /etc/services:\n# $Id: services"..., 4096) = 2348
>read(4, "", 4096)                       = 0
>close(4)                                = 0
>munmap(0xbf4e4000, 4096)                = 0     <=============== After this one
>open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
=======
should have something like the following
----
gettimeofday({1100390520, 269801}, NULL) = 0
getpid()                                = 12791
open("/etc/resolv.conf", O_RDONLY)      = 4      <=============
fstat64(4, {st_mode=S_IFREG|0644, st_size=105, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb73eb000
read(4, "search\tconcuity.com ehelathcontr"..., 4096) = 105
read(4, "", 4096)                       = 0
close(4)                                = 0
munmap(0xb73eb000, 4096)                = 0
open("/etc/hosts", O_RDONLY)            = 4     <================
=========

So could you check the /etc/services which has the following lines:
-------
# grep whois /etc/services
nicname         43/tcp          whois
nicname         43/udp          whois
whois++         63/tcp
whois++         63/udp
rwhois          4321/tcp                        # Remote Who Is
rwhois          4321/udp                        # Remote Who Is
----

Regards,

Wesly
0
 

Author Comment

by:Xenmaster
ID: 12576610
That's it. Thanks both of you. Whois was missing from /etc/services.
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 12576647
Hi,

   IMHO, you should grant some points to jlevie since I couldn't trace this with his input.
If you want to split the points, then you can ask jlevie to do it for you because he is the page editor.

   Anyway, I'm glad to hear your problem resolved.

Regards,

Wesly
0
 

Author Comment

by:Xenmaster
ID: 12576693
I left feedback. It would be nice if the person who "owned" the question could do that. :)

In any case, thanks to both of you. Your assistance was certainly of more value than my NOC's was. ;-)
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 12576740
> I couldn't trace this with his input
Oops. severe typo. ==> I couldn't trace this "without" his input.

Wesly
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month17 days, 17 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question