How to Zimbra Split DNS with dnsmasq

When you install Zimbra on a server behind NAT, your public IP is not configured in the server, instead, it gets routed to the server using NAT gateway. Zimbra wants the IP address of your MX record present in the server.

To solve this problem, we can use Split DNS. When you check the IP of the MX record from the server, it resolves to the internal IP address of the server. For everyone else, the MX record resolves to the public IP Address of the server.

IMPORTANT: Do not install Zimbra dnscache (unbound) as it listens on port 53, which will cause conflict with Split DNS.

Disable systemd-resolved

On Ubuntu, local DNS resolving is done by systemd-resolved, you need it disabled.

Install dnsmasq

Install dnsmasq with command

Configure dnsmasq

Edit file


Restart dnsmasq

Edit /etc/hosts file


Edit /etc/resolv.conf


Remove any other name server entry, do all DNS requests go to dnsmasq.

At this point, if you do a nslookup/dig for MX record, you should see your internal IP address.

Back to Zimbra

Need help with Linux Server or WordPress? We can help!

Leave a Reply

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