Creating a backup email server on RHEL 4

Q I've got a dedicated server running Red Hat Enterprise Linux 4, which is used to host my company's website and email. When I first got the server I decided to use Sendmail as I only host a single domain, and the Sendmail configuration worked straight out of the box. All I had to do was add my domain to /etc/mail/local-host-names and restart Sendmail. My business is growing quickly and I am becoming more and more reliant on the mail that gets sent through the server - so if my server ever dropped offline unnoticed I would lose significant business. I have a DSL line at home and a PC running Fedora - can you outline how I can use that machine as a backup mail server in the event that my dedicated server cannot accept mail?

A Let's say your domain is example.com. In DNS, add the following two MX lists which hosts will accept mail for a given domain):

example.com. MX             10
primary.example.com.
example.com. MX              20
secondary.example.com.

As primary.example.com has a lower priority (10), it will take precedence over secondary. example.com. However, if primary.example.com becomes unavailable, mail servers will attempt to contact secondary.example.com. Once the DNS record has been saved and the name service reloaded, try to dig the domain to see if both MX records are visible. As you are already receiving mail for example.com on the dedicated server, there is no need to adjust the Sendmail configuration there. On your Fedora PC, all you need to do is create /etc/mail/relay-domains containing your domain example.com. Once you save the file, restart Sendmail. Ensure the domain is not added to /etc/local-host-names on secondary.example.com, as this will cause mail to get delivered locally. Now, I suggest testing your configuration by stopping Sendmail on the dedicated server and sending records (Mail Exchanger: yourself a message from a third-party mail server. If DNS is set up correctly, you should see the message hitting the Fedora box by running tail on /var/log/maillog. Don't be alarmed by the deferred message - that's actually Sendmail trying to get the message back out to primary.example.com. The Sendmail instance on your Fedora PC should try to resend the mail every hour, so it might take a while after primary.example.com comes back online before it receives the mail queued by secondary.example.com.

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar