cyrus-master does not listen on ipv4 port

I met a strange problem: cyrus-imapd service stopped for unknown reason and I could not receive emails. Even I restarted the service:

service cyrus-imapd start

I still could not receive emails. Telneting to the mail server showed the port was not open.

netstat -antp|grep 995
tcp        0      0 :::995                      :::*                        LISTEN      30491/cyrus-master

netstat says cyrus-master only listens on ipv6 address. On the mail server,

telnet ::1 995
Trying ::1…
Connected to ::1.
Escape character is ‘^]’.

telnet command connects to ipv6 local address ::1 and shows cyrus-master works normally for ipv6 address on port 995.

netstat -anp|grep 995
tcp        0      0 :::995                      :::*                        LISTEN      30491/cyrus-master
udp        0      0 0.0.0.0:995                 0.0.0.0:*                               661/portreserve

This command shows portreserve occupies port 995 for ipv4 address. Now stop the portreserve service

service portreserve stop

And restart cyrus-imapd service

service cyrus-imapd restart

This time, cyrus-imapd listens on port 995 for both ipv4 and ipv6 addresses:

netstat -antp|grep 995
tcp        0      0 0.0.0.0:995                 0.0.0.0:*                   LISTEN      32330/cyrus-master
tcp        0      0 :::995                      :::*                        LISTEN      32330/cyrus-master

It is interesting that portreserve only occupies udp port 995 for ipv4 address, why cyrus-master can not use tcp port 995 for ipv4 address? This might be a bug of cyrus-imapd.

Now everything is ok and I can receive my emails.

 

Posted in tips of hosting