IT nightmare: maxperip in courier-imap

This post is for those of you loooking to resolve a very tricky issue with your SOHO network (and not for anyone for whom the words in the posts title are totally foreign, excepting “nightmare”). I wish I’d found a similar post before I spent weeks going batty. Here’re the setup and the symptoms:

  • You manage a network that uses NAT, giving all computers on your network internal IP addresses (typically 192.168.x.x).
  • Your network has one external-facing IP address assigned by your provider, which is given to your network routing device (like a Linksys, D-Link, or Belkin; or, if you’re awesome, you’re using a Soekris device running m0n0wall).
  • Your e-mail provider runs *nux with QMail and Courier-IMAP as its mailserver
  • Mail clients on your network experience frequent, intermittent connection problems to your mail server. This problem is unrelated to web browsing or other internet use, and is not restricted to any particular machine.
  • Your stress levels and/or hairloss increases while your peer confidence levels decrease.

The issue, my troubled IT colleagues, lies in the imapd config file. Mine lived in /etc/courier-imap/imapd, though yours may be elsewhere. The issue is with the default value for the maxperip setting, which is only four. This means that the fifth mail client to connect to the mail server receives an unceremonious rejection. But, if you try again then you may get through once the other connections finish, which complicates the troubleshooting process.

To resolve it, simply open the imapd config file in your favorite text editor and locate the maxperip setting. It’ll look like this:

# Maximum number of connections to accept from the same IP address


Simply change the value 4 to something more reasonable for your network: I use the number fof computers in the office at any one time, plus 5 for good measure. Honestly, you can set it higher until the problem disappears.

I hope this saves someone out there some headaches (assuming Goolge indexes this post and gets found by those in need). If so, I’d love you to post a comment.

Leave a Reply

You must be logged in to post a comment.