4.6. Adding Mail Servers to dnsmasq
Problem
You have some local mail servers that you want your LAN hosts to know about. How do you do this with dnsmasq?
Solution
dnsmasq has a special record type for mailservers. You need these three lines:
mx-host=alrac.net,mail.alrac.net,5 mx-target=mail.alrac.net localmx
The mx-host line needs the
domain name, server name, and MX priority. The mx-target line is the server name. localmx means all local machines should use
this server.
Discussion
A priority number of 5 means the server is higher priority than servers with larger numbers, typically 10 and then multiples of 10. If you have only one mail server, you should still give it a priority to keep clients happy.
See Also
man 5 dhclientdnsmasq.conf is also a great help resource
dnsmasq home page (http://www.thekelleys.org.uk/dnsmasq/doc.html) is where you'll find mailing list archives and excellent help documents
Chapter 24, "Managing Name Resolution," in Linux Cookbook, by Carla Schroder (O'Reilly)
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access