postgresqldockernetwork-programmingubuntu-20.04netplan

can't connect to postgres in ipv6 using docker


My scenario is the following: I have a postgres 12 installed on ubuntu 20.04 server and a docker container running in another host with ipv6 enabled.

I can't reach postgres server from inside docker container using ipv6.

these commands works from within the container:

$ ping POSTGRES_SERVER_IPv4
$ ping POSTGRES_SERVER_IPv6
$ telnet POSTGRES_SERVER_IPv4 5432

but this does not work from inside the container (but it works from the docker host):

$ telnet POSTGRES_SERVER_IPv6 5432

i've already set listen_address = '*' and "host all all md5" in postgres pg_hba.conf.

EDIT:

i've realized that my network adapter is using two IPv6, the static one that I defined in netplan and another one that is within my network range, but I didn't assigned it.


Solution

  • In your netplan configuration, try to add:

    accept-ra: no

    example:

    network:
      version: 2
      ethernets:
        ens192:
          accept-ra: no
          addresses: ...