"Peter J. Holzer" <hjp-pgsql@hjp.at> writes:
> On 2021-06-23 20:33:33 -0400, Tom Lane wrote:
>> It's quite odd that nslookup isn't agreeing with glibc's name
>> resolution code.
> AFAIK nslookup uses only DNS. Glibc uses all methods in nsswitch.conf.
Ah, right. So looking at a Fedora 34 installation, I see in
/etc/nsswitch.conf:
...
hosts: files myhostname resolve [!UNAVAIL=return] dns
...
/etc/hosts is pretty innocuous:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
On the other hand, "man nss-myhostname" says
o The local, configured hostname is resolved to all locally
configured IP addresses ordered by their scope, or -- if none are
configured -- the IPv4 address 127.0.0.2 (which is on the local
loopback) and the IPv6 address ::1 (which is the local host).
so it might be that that's what is causing the weird behavior.
On this machine, with a recent PG build installed but no running
server, I see:
$ psql -h rpi3
psql: error: connection to server at "rpi3" (fe80::ba27:ebff:fe51:3b34), port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
connection to server at "rpi3" (192.168.1.61), port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
so indeed *something* is injecting an IPv6 address that I didn't
ask for. However, I see the same two addresses probed with the
fully-qualified machine name, so it's not quite like Jerry's result.
regards, tom lane