Discourse binding to IPv6...but not IPv4

I successfully installed Discourse on my server, and it’s accessible over ipv6, but not ipv4.

Ideally I’d like it to listen on both 6 and 4. This is what netstat presents.

netstat -tunpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1098/sshd
tcp6       0      0 :::80                   :::*                    LISTEN      28176/docker-proxy
tcp6       0      0 :::22                   :::*                    LISTEN      1098/sshd
tcp6       0      0 :::443                  :::*                    LISTEN      28164/docker-proxy
udp        0      0 0.0.0.0:68              0.0.0.0:*                           990/dhclient

Any help is appreciated.

Have you changed the sysctl net.ipv6.bindv6only from it’s default? Because if not, that IPv6 listening socket is also accepting IPv4 connections. Your problem, then, lies elsewhere – likely in firewall settings. Note, also, that by default docker will use iptables to redirect incoming connections, and those docker-proxy processes will not actually receive any connections, so it’s the listening sockets inside the container that will be receiving the connections.

5 Likes

Ah kay. That makes sense now. I ended up getting it working with that knowledge. Thanks!

3 Likes

Would you care to share your findings, in case someone has a similar problem in the future and stumbles across this topic?

2 Likes

I just setup DNS for it. Apparently Discourse acts as a Virtual Host (like Apache). Once I setup DNS, it all worked smoothly over 4 and 6.