1. Skip to Menu
  2. Skip to Content
  3. Skip to Footer>
Sunday Apr 28th     9:49 AM PDT                                  

Backup Mail Server (MX20)

PDF Print E-mail

Written by Greg King Saturday, 04 July 2009 13:19

A slave server will receive and hold mail destined for another mail server in the event that mail server is not available to receive mail on it's own.  It is important to note that a secondary mail server has to be defined in DNS and set up in the configuration of both email servers.  We are assuming you have access to a secondary email server either via your own network or a friend who will swap slave email services with you (you act as each other's backup server).


Slave Server Configuration / MX 20 Secondary Mail Exchanger

For example purposes, we are assuming the ip address of our local freebsd email server is called mail.ourdomain.com has an ip of 192.168.1.100 and that our domain is ourdomain.com.  Our friend's email and dns server is mail.friend.com , has an ip of 10.0.0.1 and we have root access to it.

Logon to mail.friend.com and su to root and add the Master server's IP to the access file:

# cd /etc/mail
# nano access

paste this into the nano screen around the area of other similar entries, or at the top if none exist.

192.168.1.100      RELAY

Save the file.  Then, re-make the access db to include the changes (# less /etc/mail/Makefile lists lots of options for 'make'):

# make all

Add the Slave Zone files to the named.conf file:

# cd /var/named/etc/namedb
# nano named.conf

paste the following into the nano screen around where the other secondary zones  are located (being respectful not to interfere with existing { } structures.

zone "ourdomain.com" {
    type slave;
    file "slave/ourdomain.com";
    masters { 192.168.1.100; };
    allow-query { any; };
    allow-transfer { none; };  
};

save the file

Reload named so that it will re-read it's named.conf file:

# rndc reload

Now, login to the Master server and add the Slave server's IP to 'allow-transfer' in each zone files:

# cd /var/named/etc/namedb/
# nano named.conf

find the area for master zones, and if you have not already created a zone for your domain, do so now.  If you already have a zone for your domain, just add the ip for mail.friend.com under the allow-transfer section.


zone "ourdomain.com" in {

          type master;

          notify yes;

          allow-query { any; };

          file "master/domain.com";

          allow-transfer {10.0.0.1;};

          };

Again, we need to reload named to re-read it's named.conf file

# rndc reload

For setting up a Secondary Mail Exchanger to use the newly created Slave Server, make your master zone file look like this:

# nano /var/named/etc/namedb/master/ourdomain.com

you should already have the MX 10 record.  We are showing it for clarity.

; Mail Exchangers
@                       MX      10 mail.ourdomain.com.         ; Primary Mail Exchanger
@                       MX      20 mail.friend.com.    ; Secondary Mail Exchanger


Note: see how we put the dot (.) behind the domain names above?  Without it, the system would append our domain name at the end and 20 mail.friend.com would be read as 20 mail.friend.com.ourdomain.com which obviously would not be found!

Don't forget to update your zone file's serial number so that bind knows to send the file to slave servers!

Now we restart named to re-read the new configuration.

# rndc reload

Now, we need to logon to the Slave Server (mail.friend.com) and tell it's Sendmail that it's okay to spool & forward mail to our Master (mail.ourdomain.com) by adding this to the mail/access file and doing 'make' to update the access.db file:

# cd /etc/mail
# nano access


192.168.1.100                 RELAY
mail.ourdomain.com    RELAY
ourdomain.com            RELAY

save the file. and then update the database :

# make maps

 

  Configuring an E-Mal Server
eXTReMe Tracker
Content View Hits : 404669