From: | "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Psql wants to use IP6 when connecting to self using tcp... |
Date: | 2021-06-24 15:42:27 |
Message-ID: | 20210624154227.GA22620@hjp.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 2021-06-23 20:33:33 -0400, Tom Lane wrote:
> Jerry LeVan <jerry(dot)levan(at)gmail(dot)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(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-06-24 20:26:28 | Re: Psql wants to use IP6 when connecting to self using tcp... |
Previous Message | Adrian Klaver | 2021-06-24 14:32:22 | Re: OSX: migrating Postgres db from one Mac to another |