• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 280
  • Last Modified:

can I put a mx entry in my /etc/hosts ?

I want to set up 2 postfix servers for giggles.

I want 2 "email clients" per server and want to be able to email from / to any of the four clients.  

I know I need a mx record to send mail, I just so not want to set up a dns server just for that.

1 Solution
Jon BrelieSystem ArchitectCommented:
Hrmm... The only thing I can think of will only work because you are only using two mail servers:

Configure each server to allow relays from the other.  Then configure postfix on each server to relay mail through the other.  The other server should recognize messages destined for local delivery.  Since this is a closed environment, that should do the trick.

Overriding DNS for the email clients is not needed, as they can be configured per-case to use the correct postfix server.

Overriding DNS for the postfix servers is not necessary either, as you can work around the problem by using the transport table, as per postfix's transport man page: http://www.postfix.org/transport.5.html

So all in all
1. Set up the two servers to listen locally on ports 2501 and 2502 (or choose your own), and handle mail for giggle1.com and giggle2.com respectively.

2. Edit /etc/postfix/transport and add lines like:

# Route giggle1.com through postfix via SMTP at port 2501
giggle1.com      smtp:localhost:2501
# Route giggle2.com through postfix via SMTP at port 2502
giggle2.com      smtp:localhost:2502

3. Create the DB file by running the command
postmap /etc/postfix/transport

The above solution is flexible enough to perform other interesting things. See the man page that I mentioned for more info.

TIMFOX123Author Commented:

Wow, that made me giggle :)

Thanks so much.


Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now