Link to home
Start Free TrialLog in
Avatar of Xenmaster
Xenmaster

asked on

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

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?
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

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
Avatar of Xenmaster
Xenmaster

ASKER

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
> 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
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.
> 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
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.
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.
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?
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)                           = ?
Could you provde some information about your network infrustructure?
Thanks.

Wesly
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.
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?
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).
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,
Hi,

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

Wesly
ASKER CERTIFIED SOLUTION
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That's it. Thanks both of you. Whois was missing from /etc/services.
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
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. ;-)
> I couldn't trace this with his input
Oops. severe typo. ==> I couldn't trace this "without" his input.

Wesly