ZNC doesn't listen on v4 #380

Closed
opened 2026-10-05 04:16:49 +02:00 by adam · 11 comments
Owner

Hello,

I restarted my vServer today and since then ZNC doesn't listen on 0.0.0.0/0:1337 anymore, just :::1337.
IPv4 and IPv6 are active in znc.conf. The kernel version is 3.16.1-1-ARCH and the ZNC version is 1.4.
This is the config snippet:

AllowIRC = true
AllowWeb = true
IPv4 = true
IPv6 = true
Port = 1337
SSL = true

Starting znc with -D doesn't show any errors.
It shows "[ .. ] Binding to port [+1337]...
[ >> ] ok
" though.

Regards,
Thermi

Hello, I restarted my vServer today and since then ZNC doesn't listen on 0.0.0.0/0:1337 anymore, just :::1337. IPv4 and IPv6 are active in znc.conf. The kernel version is 3.16.1-1-ARCH and the ZNC version is 1.4. This is the config snippet: <Listener listener0> AllowIRC = true AllowWeb = true IPv4 = true IPv6 = true Port = 1337 SSL = true </Listener> Starting znc with -D doesn't show any errors. It shows "[ .. ] Binding to port [+1337]... [ >> ] ok " though. Regards, Thermi <!-- github-sync-id:41047761 -->
adam closed this issue 2026-10-05 04:16:49 +02:00
Author
Owner

This is the output of ss -plnt4
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 :22 : users:(("sshd",pid=355,fd=3))

Obviously, there should be ZNC somewhere. But there isn't. It's listening on the v6 address though:
ss -plnt6
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 :1337 :::* users:(("znc",pid=13531,fd=7))

This is the output of ss -plnt4 State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 <public IPv4>:22 _:_ users:(("sshd",pid=355,fd=3)) Obviously, there should be ZNC somewhere. But there isn't. It's listening on the v6 address though: ss -plnt6 State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 <public IPv6>:1337 :::\* users:(("znc",pid=13531,fd=7)) <!-- github-comment-id:53455813 -->
Author
Owner

Since I have no ideas at all: Could you start znc with the --debug flag and see if it says anything useful while setting up the listeners?

Since I have no ideas at all: Could you start znc with the `--debug` flag and see if it says anything useful while setting up the listeners? <!-- github-comment-id:53496729 -->
Author
Owner

Hello psychon,

Using --debug didn't say anything about setting up v4 or v6.
However, I could fix the issue by setting up a second listener for IPv6 and then editing the first one to only listen on v4.
This is how it looks like now:

AllowIRC = true
AllowWeb = true
Host =
IPv4 = true
IPv6 = false
Port = 1337
SSL = true

AllowIRC = true AllowWeb = true Host = IPv4 = false IPv6 = true Port = 1337 SSL = true

This is the output of ss -plnt:
LISTEN 0 128 :1337 : users:(("znc",pid=5319,fd=7))
LISTEN 0 128 :1337 :::* users:(("znc",pid=5319,fd=8))

Regards,
Thermi

Hello psychon, Using --debug didn't say anything about setting up v4 or v6. However, I could fix the issue by setting up a second listener for IPv6 and then editing the first one to only listen on v4. This is how it looks like now: <Listener listener0> AllowIRC = true AllowWeb = true Host = <DNS-NAME HERE> IPv4 = true IPv6 = false Port = 1337 SSL = true </Listener> <Listener listener1> AllowIRC = true AllowWeb = true Host = <DNS-NAME HERE> IPv4 = false IPv6 = true Port = 1337 SSL = true </Listener> This is the output of ss -plnt: LISTEN 0 128 <PUBLIC IPv4>:1337 _:_ users:(("znc",pid=5319,fd=7)) LISTEN 0 128 <PUBLIC IPv6>:1337 :::\* users:(("znc",pid=5319,fd=8)) Regards, Thermi <!-- github-comment-id:53608391 -->
Author
Owner

Did you try to connect to ZNC via IPv4 when it was listening on both 4 and 6 using one listener? It creates one v6 socket which also accepts v4 connections.

And wtf is "Host = " without value? How did you get this in config?

Did you try to _connect_ to ZNC via IPv4 when it was listening on both 4 and 6 using one listener? It creates one v6 socket which also accepts v4 connections. And wtf is "Host = " without value? How did you get this in config? <!-- github-comment-id:54381329 -->
Author
Owner

DarthGandalf: I removed it for testing purposes, to see if it had something to do with PTR entries in the DNS system. Before, it had the DNS name of my server in it.
And yes, I tried to connect to it over IPv4, when I just had one listener, but I couldn't. Because there was no process listening on the IPv4 address and port 1337:

DarthGandalf: I removed it for testing purposes, to see if it had something to do with PTR entries in the DNS system. Before, it had the DNS name of my server in it. And yes, I tried to connect to it over IPv4, when I just had one listener, but I couldn't. _Because there was no process listening on the IPv4 address and port 1337_: <!-- github-comment-id:54745018 -->
Author
Owner

If "host" is presented, ZNC resolves it to one address (A or AAAA), and uses it. IPv4 and IPv6 flags affect which one address will be selected if it resolves to both families. Probably this behavior should be changed.

If "host" is not presented, ZNC listens on all addresses, specified by IPv4/IPv6 flags. In case when both flags are set, IPv6 socket is created, but with option IPV6_V6ONLY=0, which makes it to listen on IPv4 too; so it's not presented in list of IPv4 sockets opened on system.

ZNC never resolves PTR entries, only A and AAAA.

If "host" is presented, ZNC resolves it to one address (A or AAAA), and uses it. IPv4 and IPv6 flags affect which one address will be selected if it resolves to both families. Probably this behavior should be changed. If "host" is not presented, ZNC listens on all addresses, specified by IPv4/IPv6 flags. In case when both flags are set, IPv6 socket is created, but with option IPV6_V6ONLY=0, which makes it to listen on IPv4 too; so it's not presented in list of IPv4 sockets opened on system. ZNC never resolves PTR entries, only A and AAAA. <!-- github-comment-id:54749771 -->
Author
Owner

I think the problems started when I added my dns name as bindhost. That caused ZNC to listen on only v6 then and not v4, as it preferred AAAA entries.

I think the problems started when I added my dns name as bindhost. That caused ZNC to listen on only v6 then and not v4, as it preferred AAAA entries. <!-- github-comment-id:54754702 -->
Author
Owner

Hi, I'd like to mention, that I'm affected by this as well using znc 1.6.2

I'm using a Host directive, which has DNS entries for both IPv4 and IPv6. znc will only open a v6 socket and I'm not able to connect using v4. I'd like to be able to connect using both protocols. IPv6 has proven to be more reliable for me, but unfortunately is not available everywhere (not on my 3G network for example), so I'd like to still be able to connect via v4.

Hi, I'd like to mention, that I'm affected by this as well using znc 1.6.2 I'm using a `Host` directive, which has DNS entries for both IPv4 and IPv6. znc will only open a v6 socket and I'm not able to connect using v4. I'd like to be able to connect using both protocols. IPv6 has proven to be more reliable for me, but unfortunately is not available everywhere (not on my 3G network for example), so I'd like to still be able to connect via v4. <!-- github-comment-id:169504376 -->
Author
Owner

If you just remove the Host, it will start listening on both.

If you just remove the `Host`, it will start listening on both. <!-- github-comment-id:169504631 -->
Author
Owner

I just hit this problem except there was no "host" set in my listener config.

I've worked around it by making two listeners, one IPv4 specific and one IPv6 specific, like @Thermi did in https://github.com/znc/znc/issues/640#issuecomment-53608391

I just hit this problem except there was no "host" set in my listener config. I've worked around it by making two listeners, one IPv4 specific and one IPv6 specific, like @Thermi did in https://github.com/znc/znc/issues/640#issuecomment-53608391 <!-- github-comment-id:367598210 -->
Author
Owner

I have this issue as well.

I have this issue as well. <!-- github-comment-id:1079833434 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#380