Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwRUy-0006SH-Rj for pgsql-general@arkaria.postgresql.org; Thu, 24 Jun 2021 15:42:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lwRUx-0004pA-BT for pgsql-general@arkaria.postgresql.org; Thu, 24 Jun 2021 15:42:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwRUx-0004p1-2R for pgsql-general@lists.postgresql.org; Thu, 24 Jun 2021 15:42:35 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwRUr-0002YV-Ih for pgsql-general@lists.postgresql.org; Thu, 24 Jun 2021 15:42:34 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id 1F7264F0A; Thu, 24 Jun 2021 17:42:27 +0200 (CEST) Date: Thu, 24 Jun 2021 17:42:27 +0200 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: Psql wants to use IP6 when connecting to self using tcp... Message-ID: <20210624154227.GA22620@hjp.at> Mail-Followup-To: pgsql-general@lists.postgresql.org References: <20210623175127.GB27765@hjp.at> <2558211.1624494813@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="+HP7ph2BbKc20aGI" Content-Disposition: inline In-Reply-To: <2558211.1624494813@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2021-06-23 20:33:33 -0400, Tom Lane wrote: > Jerry LeVan writes: > > bigbox has a freshly installed Fedora 34 system and it runs postgresql = 13.3 >=20 > > the following are being run ON bigbox >=20 > > nslookup bigbox returns the correct ipv4 address > > nslookup bigbox.skynet returns the correct ipv4 address >=20 > > 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.. >=20 > 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=3Dreturn] resolve [!UNAVAIL=3Dreturn] 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 --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --+HP7ph2BbKc20aGI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmDUp94ACgkQ8g5IURL+ KF1iKhAAsHr/mKZiVGZm1rdyUrN7dlKgRnK9w9rba+KaeAqwjoPNyyqCnbwUG7N/ cWaPRo8iCMAyxm224ZFBzfIP0FEU4Cv/ra72ncW7/ELClCIkh55JxtsN6Up/lEKn 8Wc4eoaCTGvJ1Z+MgVH1ec4zXFZmPmYMnqlEiNNM0PmIT/WDZ4Oi4vxhGCXovrG+ E4v8HSQX1gfIX76KSYpcQjC0xR5ymotkE1d1hr2h6ya7NLAJkmkEswLBdskEjpfj 1UUnhmQlCozCaMCLqdIIrYmWCQFkk+6DqZaqGtXxcTmgM0g1Bay1Y0pdjBWW5XDi C17jG+ghvcQQ8Bxl9TsBHDrcXdSzdnb/9ER2EdEa7IAjJby1F1nn4bAnQmRoFSlW By13ujggXS/YQ7OadMcojJgVB7y7z9ExSGuPYv3vxHDbC2/S3F8NcgGY3u7OUVmd +ETDiJYtMoU3Nn9zZmRSoFkJqIu64TKcpA9RX0FdwUP1iD01FEBmF/4HQC5AUL9K OsAa1cXwpjaPhdwGz9mSwfG3T2i49IQb6M00F3SQ11AJP5LBXou7U5TyS5cABCWR yN1IuFBHsrl8mjok4s/V3n0DkX1K60xohLjFV8ZycKe5OoX+xtxN3D3Gv/qvc1Tq bw1lvwCD9sXC2rnU3Uo2L8vZx5WTi9Q58N9Xr9GMS3GYPNps5Zo= =ErEH -----END PGP SIGNATURE----- --+HP7ph2BbKc20aGI--