I upgraded a couple of days ago to IPv6 on my local test machine and since then I've been experiencing some issue with connecting to my local PostgreSQL server.
I set the host to 'localhost', which worked fine using IPv4. While using IPv6, there is a 1:150 chance that the connection fails (here is a testcase for all unix systems, and here is another one for all other systems (requires psycopg2 and python3)).
As it turns out it is because the loopback interface (lo0) is configured like this:

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    inet6 ::1 prefixlen 128 
    inet netmask 0xff000000 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1  # line 5
    nd6 options=1<PERFORMNUD>

Line 5 is especially interesting. It says use IP address fe80::1 for connections (and which is actually used about every 150th time).
Is it safe to allow all connections (without password) from fe80::1 or did my PC just happen to be number one on the local network? Can my IP change when I'm on another network (I used to on IPv4 but that changed occasionally depending on where I am).
If other computers can also use fe80::1, how can I prevent postgresql from connecting to my server using that address? If I change the host to "::1", will postgresql even work on networks (routers) that don't support IPv6 / haven't IPv6 enabled? Or do I need to use IPv4 (i.e. for 100% stable connection?

Additional tags: IPv6, loopback (Sorry I can't create tags on my own, yet).


1 Answer 1


So this is almost certainly a bad configuration in ip address resolution. As you mention, you have a line resolving localhost to your external ipv6 address. Yes, this should be removed, or changed from fe80::1 to ::1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.