Setting up internal Bind DNS for Zimbra mail server on Amazon EC2 CentOS & RHEL Servers

Zimbra Collaboration server needs to resolve MX records of a domain while installing. Amazon EC2 instances are behind NAT so we need to have an working internal DNS server to do the MX resolution.

1. Install Bind

yum install bind9 -y

2. Add required changes on bind configuration file. Need to change forwarder and add zone for the domain.

vi /etc/named.conf

Find and replace the forwarders with the below (it is a google DNS servers we are using)

forwarders { 8.8.8.8; };

Add zone information in named.conf (replace mail.example.com with your domain)

zone "mail.example.com" in {
        type master;
        file "mail.example.com";
};

Save the file and exit from editor.

3. Creating the zone file. (replace mail.example.com with your email domain and 10.10.10.10 with your servers internal IP)

vi /var/lib/named/mail.example.com

;
;       Addresses and other host information.
;
@       IN      SOA     mail.example.com. hostmaster.mail.example.com. (
                               10118      ; Serial
                               43200      ; Refresh
                               3600       ; Retry
                               3600000    ; Expire
                               2592000 )  ; Minimum
;       Define the nameservers and the mail servers
        	     IN      NS      10.10.10.10
example.com.         IN      MX      10  mail.example.com.
mail.example.com.    IN      A       10.10.10.10

Bind setup is done, just restart bind.

/etc/init.d/named restart

4. DNS setup is done, now we need to tell the server to use internal bind server for resolution. (replace mail.example.com with your email domain and 10.10.10.10 with your servers internal IP)

vi /etc/resolv.conf

Replace it with the below

search mail.example.com
nameserver 10.10.10.10

Save the file. Now proceed to zimbra installation. It should resolve MX record for your domain properly.

Leave a Reply

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