Re: Psql wants to use IP6 when connecting to self using tcp...

From: Jerry LeVan <jerry(dot)levan(at)gmail(dot)com>
To: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Psql wants to use IP6 when connecting to self using tcp...
Date: 2021-06-23 22:25:57
Message-ID: A1F5CBD0-64F7-469B-B971-AC316C52705F@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Jun 23, 2021, at 12:51 PM, Peter J. Holzer <hjp-pgsql(at)hjp(dot)at> wrote:
>
> On 2021-06-21 19:44:16 -0500, Jerry Levan wrote:
>> The below fails... the 'fe80....' is the ip6 address of big box.
>> [jerry(at)bigbox ~]$ psql -h bigbox
>> psql: error: FATAL: no pg_hba.conf entry for host "fe80::fe3f:dbff:fed1:f62e%enp7s0", user "lxxx", database "lxxx", SSL off
>
> This looks like a configuration error in your DNS. FE80:... is a
> link-local address, and you generally don't want them in DNS. Either
> remove that completely (as others have already suggested) or replace if
> with the global unicast (or at least unique local) IPv6 address (and
> then add that to pg_hba.conf).
>
> If the address isn't in DNS, check your /etc/hosts.
>

My dns is the Synology DNS that comes with their diskstation.

When I set it up I did NOT include any IP6 info so it is not returning
the IP6 address. The local name of my network is 'skynet'.

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..

I have three other machines running a postgresql database and I can use attach to them
using the long and short names with no problem from bigbox.

ie psql -h <foo> and psql -h <foo>.skynet all work.

So the question is: Why does using the short name evidently cause postresql to use the ipv6 address
and using the full name use the ipv4 address?

The problem has a workaround 1) disable the server from listening on ipv6
2) or add bigbox and bigbox.skynet to /etc/hosts

let me note that systemd-resolve { bigbox | bigbox.skynet } always returns the ipv4 address...

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rumpi Gravenstein 2021-06-23 22:31:40 Partitioned Table Index Column Order
Previous Message Vijaykumar Jain 2021-06-23 19:06:25 Re: Is there something similar like flashback query from Oracle planned for PostgreSQL