Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On Linux, how do I fake an MX record for a domain? [closed]

I'm testing two mail servers that live on two (virtual) machines with made up domain names for emails. When one of the servers needs to send an email to the other one, it seemingly performs a DNS lookup for the recipient domain's MX record, which doesn't point the sender server to the correct IP, no matter what IP/domain mapping I put in /etc/hosts.

So should I install a DNS server and create a custom MX record for the recipient domain? How do I do this on Ubuntu or is there an easier way?

like image 704
Desmond Hume Avatar asked Nov 19 '12 19:11

Desmond Hume


1 Answers

Assuming that present day Ubuntu servers typically use Postfix as the message transfer agent, it is possible to tell Postfix to disable DNS lookups for SMTP with disable_dns_lookups configuration parameter. Add the following line

disable_dns_lookups = yes

to the Postfix's configuration file located at /etc/postfix/main.cf. This will make Postfix look into /etc/hosts when it tries to resolve the domain address of a mail recipient.

like image 68
Desmond Hume Avatar answered Oct 05 '22 05:10

Desmond Hume