Binding to multiple IPs

Say you want to bind to multiple IPs assigned to your server, but not all IPs, and aren’t quite sure how?  As it turns out, this is easy.

In the Default Domain GUI you have your “Domain IP” to which you can then “Restrict connections to this IP”, which will bind MDaemon to a single IP address.

You can’t add multiple DomainIP lines to the INI file, but there is a trick you can use, we rely on the fact that each secondary domain can be bound to it’s own IP address, but those IPs will service requests for all domains as long as the user logs in using their full email address.

To bind 10.0.0.1 and 10.0.0.2 to MDaemon but not 10.0.03, bind 10.0.0.1 to your primary domain, then bind 10.0.0.2 to a secondary domain called mail-2.example.com (where example.com is your real domain, and mail-2.example.com is the DNS record assigned to 10.0.0.2), rinse and repeat for each additional domain.

Hope this helps.

CC BY-NC-ND 4.0 Binding to multiple IPs by Dave Warren (everything-mdaemon.com) is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

6 Replies to “Binding to multiple IPs”

  1. Hi guys. Im trying to configure two domains on mdaemon, but i need to send from diferent ips. Is this posible ?? Thanks

  2. matias,

    Why? There is no technical need to keep outbound sending from separate IPs.

    Anyway, if you enable outbound socket binding, it should be possible.

  3. And what if I want to bind 2 IP addressess to the same mail domain? I mean I have two external static Ips connected to the different gateways from different providers lets say 1.1.1.1 and 1.1.1.2. I’ve created additional MX record on DNS for 1.1.1.2 with priority 20 and same name domain.com (1.1.1.1 priority is 10). What I want to achieve is high avialibility of mail service – if one of the providers connection fail Mdaemon will continue to recieve and sort messages from another one provider’s channel. Is it possible, and if yes how I can do this in Mdaemon? Thanks!

  4. This isn’t really a problem, just don’t set the “Bind” option at all and MDaemon will bind to all IPs and answer requests on any IP.

  5. No, you can only list a single IP. However, if you uncheck “This domain recognizes only connections made to these IPs” MDaemon will bind to 0.0.0.0 and accept connections on all IPs. You don’t need to list the other IPs individually.

Leave a Reply

Your email address will not be published. Required fields are marked *

*