Penguin
Note: You are viewing an old revision of this page. View the current version.

Sendmail? as a secondary MX

As far as I can tell, setting up sendmail to act correctly as a secondary MX is a bit of a drag. Sendmail seems to run into problems if it is a secondary MX, and it gets a message when all higher-priority MXes for the domain are down. Without special configuration, it will bounce the message with a "mail loops back to me (MX problem?)" error.

The very first steps to setting this up are:

Add MX records in DNS. For example

mydomain.com. MX 0 preferredmx.mydomain.com.

MX 10 secondarymx.otherdomain.org.

MXes with the lowest numbers are given the highest priority. I'm assuming that you already have a primary setup, and that part won't be explained here.

Now, on the secondary (this assumes you have /etc/mail/access and /etc/mail/mailertable):

  1. Add a line containing 'mydomain.com RELAY' to /etc/mail/access.
  2. Add a line containing 'mydomain.com smtp:[preferredmx.mydomain.com?' to /etc/mail/mailertable (this is the bit that seems to commonly not be mentioned).
  3. Run 'make' in /etc/mail. Check the timestamps of access.db and mailertable.db to be sure that they have just been regenerated. If they haven't, 'touch' access and mailertable and check your clock.
  4. If you don't have a makefile, run "makemap hash access.db < access; makemap hash mailertable.db < mailertable".
  5. Restart sendmail (probably "/etc/init.d/sendmail restart").
  6. Try sending a test message from a local address through the secondary to something@mydomain.com.

You should be all set. Try making the primary unreachable from the secondary, just to be sure, and repeat step 6. The easiest way to make it unreachable is 'preferredmx# route add secondarymx.otherdomain.org dev lo'. Do not do that if you are presently logged into preferedmx from secondarymx, and that is the only way you can reach preferredmx. By doing this you are (temporarily) adding a bad route between the two boxes.. if you don't understand the implications of that, you probably don't want to do it. Be sure to 'route del secondarymx.otherdomain.org dev lo' after you are done testing..

make in /etc/mail doesn't build sendmail.cf

So you just updated your /etc/mail/sendmail.mc, but when you run 'make', nothing happens. If you manually try to make sendmail.cf using 'm4', you get an error along the lines of:

sendmail.mc:10: m4: Cannot open /usr/share/sendmail-cf/m4/cf.m4: No such file or directory

If you run redhat, this means you need to install the sendmail-cf package.

Why there is a seperate package for people who want to actually configure sendmail, I don't know.