> On Jun 23, 2021, at 12:51 PM, Peter J. Holzer <hjp-pgsql@hjp.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@bigbox ~]$ psql -h bigbox
>> psql: error: FATAL: no pg_hba.conf entry for host "fe80::fe3f:dbff:fed1:f62e%enp7s0", user "lxxx", database "lxxx",
SSLoff
>
> 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...