pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jerry LeVan <jerry.levan@gmail.com>
To: 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: Wed, 23 Jun 2021 17:25:57 -0500
Message-ID: <A1F5CBD0-64F7-469B-B971-AC316C52705F@gmail.com> (raw)
In-Reply-To: <20210623175127.GB27765@hjp.at>
References: <E2F44383-6C51-4B0E-B26B-759ED4252BEF@gmail.com>
	<20210623175127.GB27765@hjp.at>



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






view thread (9+ messages)  latest in thread

Message-ID: <A1F5CBD0-64F7-469B-B971-AC316C52705F@gmail.com>
Permalink:  ../A1F5CBD0-64F7-469B-B971-AC316C52705F@gmail.com/
Also on:    postgresql.org/message-id/A1F5CBD0-64F7-469B-B971-AC316C52705F@gmail.com

 · 

reply

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: jerry.levan@gmail.com, hjp-pgsql@hjp.at
  Subject: Re: Psql wants to use IP6 when connecting to self using tcp...
  In-Reply-To: <A1F5CBD0-64F7-469B-B971-AC316C52705F@gmail.com>
  References: <E2F44383-6C51-4B0E-B26B-759ED4252BEF@gmail.com> <20210623175127.GB27765@hjp.at> <A1F5CBD0-64F7-469B-B971-AC316C52705F@gmail.com>

* 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