From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter J. Holzer <hjp-pgsql@hjp.at>
Cc: pgsql-general@lists.postgresql.org, Jerry LeVan <jerry.levan@gmail.com>
Subject: Re: Psql wants to use IP6 when connecting to self using tcp...
Date: Thu, 24 Jun 2021 16:26:28 -0400
Message-ID: <2685746.1624566388@sss.pgh.pa.us> (raw)
In-Reply-To: <20210624154227.GA22620@hjp.at>
References: <E2F44383-6C51-4B0E-B26B-759ED4252BEF@gmail.com>
<20210623175127.GB27765@hjp.at>
<A1F5CBD0-64F7-469B-B971-AC316C52705F@gmail.com>
<2558211.1624494813@sss.pgh.pa.us>
<20210624154227.GA22620@hjp.at>
"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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, hjp-pgsql@hjp.at, jerry.levan@gmail.com
Subject: Re: Psql wants to use IP6 when connecting to self using tcp...
In-Reply-To: <2685746.1624566388@sss.pgh.pa.us>
References: <E2F44383-6C51-4B0E-B26B-759ED4252BEF@gmail.com> <20210623175127.GB27765@hjp.at> <A1F5CBD0-64F7-469B-B971-AC316C52705F@gmail.com> <2558211.1624494813@sss.pgh.pa.us> <20210624154227.GA22620@hjp.at> <2685746.1624566388@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox