Networking
cancel
Showing results for 
Search instead for 
Did you mean: 

Odd resolution behavior on 11.31 vs. 11.23 HP-UX

SOLVED
Go to solution
Bryan Rooney
Frequent Advisor

Odd resolution behavior on 11.31 vs. 11.23 HP-UX

Occurs on all our servers on 11.31 w/ Sept 2009 QPKAPPS/QPKBASE.

Why would loopback and localhost behave differently during a ping when /etc/nsswitch is in control? One hangs momentarily and the other does not hang at all when pinged? Maybe nsswitch does not control resolution as I thought?

DNS resolves everything external to /etc/hosts quickly. It appears like when pinging loopback it is looking to DNS first, even though FILES is primary search as per nsswitch. How can DNS be primary search when FILES is set as primary in nsswitch?


# cat /etc/resolv.conf
domain foo.com
nameserver x.x.x.x
nameserver x.x.x.y

# cat /etc/nsswitch.conf
passwd: files ldap
group: files ldap
hosts: files [NOTFOUND=continue] dns ldap
networks: files ldap
protocols: files ldap
rpc: files ldap
publickey: files
netgroup: files ldap
automount: files
aliases: files
services: files ldap

# cat /etc/hosts
127.0.0.1 localhost loopback
x.x.x.t s1 s1.foo.com
x.x.x.u s2 s2.foo.com
x.x.x.x name1 name1.foo.com
x.x.x.y name2 name1.foo.com


# nslookup loopback
Using /etc/hosts on: s1
looking up FILES
Name: localhost
Address: 127.0.0.1
Aliases: loopback


# nslookup localhost
Using /etc/hosts on: s1
looking up FILES
Name: localhost
Address: 127.0.0.1
Aliases: loopback


# time ping localhost
PING localhost: 64 byte packets
64 bytes from 127.0.0.1: icmp_seq=0. time=0. ms
----localhost PING Statistics----
1 packets transmitted, 1 packets received, 0% packet loss
round-trip (ms) min/avg/max = 0/0/0
real 0.4
user 0.0
sys 0.0
#


# time ping loopback
PING localhost: 64 byte packets
64 bytes from 127.0.0.1: icmp_seq=0. time=0. ms
----localhost PING Statistics----
1 packets transmitted, 1 packets received, 0% packet loss
round-trip (ms) min/avg/max = 0/0/0
real 2.9
user 0.0
sys 0.0
#


If I use nslookup, there is no hang when resolving loopback or localhost.
When using the host command (force DNS use I think) I resolve localhost quickly and hang on loopback. This make sense as I found localhost listed on the DNS server as 127.0.0.1 and found no entry for loopback.

# time host localhost
localhost.idxedi.com has address 127.0.0.1
real 0.0
user 0.0
sys 0.0

# time host loopback
Host loopback not found: 2(SERVFAIL)
real 2.2
user 0.0
sys 0.0

This seems like an obvious DNS issue, but DNS seems to be resolving external addresses (not in /etc/hosts and is in DNS) without issue. When I try to resolve a hostname that is not is DNS I get the same behavior.
When telneting to the boxes we hang momentarily after the username/password entry

The same exact setup on HP-UX 11.23 v2 in the same network segment/DNS server does not exhibit this behavior.

Thank you for any ideas.

6 REPLIES
rick jones
Honored Contributor
Solution

Re: Odd resolution behavior on 11.31 vs. 11.23 HP-UX

You might consider taking a verbose tusc trace of commands you run to see when/if they do go to DNS. That would appear as AF_INET socket calls involving SOCK_DGRAM and port 53.

Other pseudo-random thoughts:

*) any chance the /etc/hosts file has some garbage (non-printing) bytes in it?

*) I wonder what the default for ipnodes is
there is no rest for the wicked yet the virtuous have no pillows
Bryan Rooney
Frequent Advisor

Re: Odd resolution behavior on 11.31 vs. 11.23 HP-UX

Rick -

Thank you for your suggestions.
I had checked /etc/hosts earlier via vi set list. That came up clear.
I had not thought to compare the v2 nsswitch against the v3 nsswitch. I found that our v3 boxes have no ipnodes entry. To be frank I've never used ipnodes and am unfamiliar with it's function.
After adding the ipnodes line into nsswitch.conf the v3 box now behaves like the v2 box, ...loopback pings quickly as expected.
I think I know why we are missing ipnodes on al lour v3 boxes. These boxes are all using LDAP. A quick search on few systems here shows the default ldap /etc/nsswitch.ldap files does not contain a ipnodes line on v2 or v3.

Is there an issue with using an ipnodes line within /etc/nsswitch.conf in an LDAP config'd HP-UX?

Thanks again for your help!
Bryan
rick jones
Honored Contributor

Re: Odd resolution behavior on 11.31 vs. 11.23 HP-UX

If my memory is serving correctly, ipnodes is the equivalent for "hosts" but when using the getaddrinfo/getnameinfo calls - with the "native" IPv6 support in 11iv3, chances are quite good that HP-provided 11iv3 applications (at least those in the base OS) will be calling getaddrinfo/getnameinfo rather than gethostbyname/gethostbyaddr. I would guess then if there is no ipnodes entry in nsswitch.conf, a default is taken that queries DNS.

FWIW, everyone's home-brew applications should be migrating to getaddrinfo/getnameinfo - the main impetus is to enable IPv6 support, but there are other benefits - which is why netperf uses them now, even for IPv4.
there is no rest for the wicked yet the virtuous have no pillows
Bill Hassell
Honored Contributor

Re: Odd resolution behavior on 11.31 vs. 11.23 HP-UX

I have been using the ipnodes line in all 11i versions (11.11-11.31) in anticipation of future changes to the resolver for IPv6. You might also check resolution using nsquery:

time nsquery hosts localhost
time nsquery hosts loopback


Bill Hassell, sysadmin
Bryan Rooney
Frequent Advisor

Re: Odd resolution behavior on 11.31 vs. 11.23 HP-UX

Anyone know why the ipnodes entry is missing from the ldap version of the nsswitch file (/etc/nsswitch.ldap)? It appears, at least on my systems, that both V2 and V3 are like this. I'm fairly certain the files came off the install DVDs like this for both versions. Is this a case of a missing entry or is there a reason why the ldap version excludes the ipnodes line from nsswitch?

Thanks for everyones input,
Bryan
Bill Hassell
Honored Contributor

Re: Odd resolution behavior on 11.31 vs. 11.23 HP-UX

As far as I know, these 'example' nsswitch files are not carefully designed but just examples. The first note about ipnodes seems to be in the release notes for 11.23 and references the enhancement package TOUR 2.0. It is mentioned in the 11i IPv6 release notes too.

Here's a note about ipnodes...
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=882565

But just to thoroughly confuse everything, from the nsswitch.conf man page (11.23 and 11.31):

"Obsolescence

The ipnodes directive may not be supported in future HP-UX releases. In order to minimize the impact to applications, it is recommended that you have the same configuration for the hosts and the ipnodes directives."

Go figure...


Bill Hassell, sysadmin