How to host mutiple mail server on single IP address? [closed]

I have a setup of multiple mail servers on my LAN. For example i have two machines where

  • machine A handles mails for domainA.com and username first letter a-l***@domainA.com on IP 192.168.1.100 ,
  • machine B handles mails for m-z****@domainA.com on IP 192.168.1.101
  • machine C handles domainC.com on IP 192.168.1.110.

I have configured MX enteries for both domains as mail.myMailHandlerDomain.Com mapped on my public ip.

So now i have limitation of portforwarding to one machine. I can only port forward 25,465, 587, 993, 995 to either machine A or machine B or machine C.

I am running Ubuntu server with postfix/dovecot setup. Due to my limited expertise in the field i am looking for solutions, but unable to grasp different concepts of mail relay and Nginx reverse proxy. I am seeking solution fits to my problem. Thanks !!

Update 1

Machine C in this scenario is actually backup mail server for a remote mail server.

  • Which kicks in whenever main mail server goes down.
  • I have domain name update script to modify MX enteries whenever my observer machine detects a node failure, so my current ip will start reciving mails for domainC.com.
  • But the limitation for my current network is i dont want waste money on extra IP addresses, so i have single IP address.

And i am splitting mails for domainA.com for load balancing.

Answer

I assume using multiple internal servers is for load-balancing. (othervise at least postfix can handle all domains)

  • For incoming mail (MX) is simple use single input server and reroute mail to others if necessary. Or any of 3 svers can forvard not own messages to proper server, for LB. (For example with postfix: using mydestination, relay_recipient_maps, relay_domains, local_recipient_maps and/or virtual_mailbox_maps. May be useful parameters list is not complete. http://postfix.cs.utah.edu/STANDARD_CONFIGURATION_README.html)

  • With connections from external users (POP3/IMAP). I think some POP3/IMAP proxy nedeed which route user connections based on login. (For example as described http://wiki1.dovecot.org/HowTo/ImapProxy.)

Attribution
Source : Link , Question Author : DeepSidhu1313 , Answer Author : mmv-ru

Leave a Comment