From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: Psql wants to use IP6 when connecting to self using tcp...
Date: Thu, 24 Jun 2021 17:42:27 +0200
Message-ID: <20210624154227.GA22620@hjp.at> (raw)
In-Reply-To: <2558211.1624494813@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>
On 2021-06-23 20:33:33 -0400, Tom Lane wrote:
> Jerry LeVan <jerry.levan@gmail.com> writes:
> > bigbox has a freshly installed Fedora 34 system and it runs postgresql 13.3
>
> > the following are being run ON bigbox
>
> > nslookup bigbox returns the correct ipv4 address
> > nslookup bigbox.skynet returns the correct ipv4 address
>
> > psql -h bigbox.skynet allows me to connect to the database
> > psql -h bigbox fails because the ipv6 address is returned and there is no hba entry..
>
> 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.
Typically that also includes "files", and at least on Debian/Ubuntu that
has higher priority than "dns", which is why I advised the OP to
check /etc/hosts. As Alan noted, mdns4_minimal is also often there and
might return spurious results.
> I suspect that the problem lies with systemd,
This is the next one, yes. On my Ubuntu laptop, the hosts line reads:
hosts:
files
mdns4_minimal [NOTFOUND=return]
resolve [!UNAVAIL=return]
dns
myhostname
mymachines
(wrapped for readability)
So glibc first looks in /etc/hosts, then does an MDNS (Avahi) lookup,
then asks systemd-resolved, and only then gets around to do a
traditional DNS lookup.
(And systemd-resolved does do some magic for the local hostname, so that
might indeed be the problem)
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
Attachments:
signature.asc (application/pgp-signature, 832B) download
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: hjp-pgsql@hjp.at
Subject: Re: Psql wants to use IP6 when connecting to self using tcp...
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>
* 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