Hey all,
I’ve got two machines running, one for phoenix and the other for postgres. I decided to mix things up and wanted to connect to the database via IPv6 to try something new and I’ve been running into some issues that I just can’t seem to resolve.
The postgres machine has a local-link address of fe80::be24:11ff:fe58:5d65/64 on the eth0 interface and no matter what I put in the config I cant seem to get a successful connection.
*In all attempts I’ve included socket_options: [:inet6],*
I’ve tried with the following configurations:
hostname: “fe80::be24:11ff:fe58:5d65”
hostname: “fe80::be24:11ff:fe58:5d65%eth0”
hostname: {:inet6, ip, port, flowinfo, 2}
url: “ecto://postgres:postgres@fe80::be24:11ff:fe58:5d65:5432/my_app”,
url: “ecto://postgres:postgres@fe80::be24:11ff:fe58:5d65%eth0:5432/my_app”,
url: “ecto://postgres:postgres@[fe80::be24:11ff:fe58:5d65%eth0]:5432/my_app”,
url: “ecto://postgres:postgres@[fe80::be24:11ff:fe58:5d65%25eth0]:5432/my_app”,
I’ve also tried adding to the socket_options to add {:scope_id, 2} but that doesn’t seem to work.
I’ve done sanity checks and can confirm that If I run the following I can connect to the database from the phoenix machine. And if I use the IPv4 address things also run without issue.
psql “postgres://postgres:postgres@[fe80::be24:11ff:fe58:5d65%25eth0]:5432/my_app”
psql “host=fe80::be24:11ff:fe58:5d65%eth0 user=postgres password=postgres dbname=postgres”
From what I can tell it seems like maybe ecto doesn’t have support for ipv6 scopes (the %eth0 part of the ip address)
Has anyone had experience with this before and knows how to use an IPv6 link local address for a database connection.
I’m running with the following:
phoenix: “1.7.21”
phoenix_ecto: “4.6.5”
Any help or insights would be greatly appreciated!




















