1. Installing sendmail
If you do not have sendmail installed, you can install it using your OS package manager. In this example, we use yum on CentOS:
yum install sendmail
2. Configuring the sendmail service
First off, we want to make sure it auto-starts upon reboot:
chkconfig sendmail on
By default, sendmail will only listen on localhost; for this example we will set it to listen on all interfaces instead:
1. Open /etc/mail/sendmail.cf
2. Find the line starting with DaemonPortOptions and then modify it so it looks like this:
DaemonPortOptions=Port=smtp,Addr=0.0.0.0, Name=MTA
3. Configuring sendmail to run as backup MX/backup mail server
First, we will need to modify the sendmail access file.
1. Open the access file:
vim /etc/mail/access
2. For every domain that you want to allow this sendmail instance to serve as a backup mail server for, add the following line (replace DOMAIN.com with your real domain name):
To:DOMAIN.com RELAY
3. Next, you will need to specify which mail route this sendmail instance will attempt to deliver mail to (replace DOMAIN.com with your real domain name):
DOMAIN.com smtp:mail.DOMAIN.com
4. Finally, we will recreate the database files:
makemap hash /etc/mail/mailertable.db < /etc/mail/mailertablemakemap hash /etc/mail/access.db < /etc/mail/access
5. Make sure to restart sendmail so that our new configuration is taken in to effect:
/etc/init.d/sendmail restart
4. Update DNS
Now that you have configured your sendmail service to act as a backup mail server, you will need to update your DNS so that other mail servers know that you have a backup MX.
If you have not already, create a DNS A record for the backup mail server, eg: mail-backup.DOMAIN.com
Next, create a new MX record that points to your DNS name for the backup mail server with a higher priority number than the primary mail server.
Remember, the higher the priority number, the less precedence it has, eg in order of preference:
DOMAIN.com MX 10 mail.DOMAIN.com
DOMAIN.com MX 50 mail-backup.DOMAIN.com
DOMAIN.com MX 50 mail-backup.DOMAIN.com
Now that you have configured sendmail and your DNS, you should now have a backup MX configured ! If you have any issues, questions or concerns, please comment and I will assist where I can.
No comments:
Post a Comment