Could be routing problem?

Cowles, Steve steve at stevecowles.com
Sat Mar 20 22:27:23 UTC 2004


Mark Neidorff wrote:
> Hi all,
> 
> I have a feeling that this is something dead easy, I'm just
> not seeing the problem.
> 
> My Redhat 7.3 system is the machine that I use as a mail
> server (yes, I have a static IP)and as my workstation.  I'm
> running sendmail as my mailserver.  My domain is registered.
> I do not have a dns server running on my system.
> 
> There are two symptoms to my problem.  First, whenever an
> e-mail arrives, it hops around in my computer.  My mail log
> fills with "too many hops 26 (25 max)" errors and each of
> these hops is written in the header of the e-mail that is
> received.
> The headers say:
> Received: (from root at localhost)
>         by mark.neidorff.com (8.11.6/8.11.6) id <e-mail ID is here>
>         for mark; <date and time are here>
> and is repeated about 25 times.

The "to many hops" error typically means a sendmail configuration problem.
Most likely, sendmail does not understand what domains are considered local.
i.e. when to select the local vs. esmtp mailers

1) First check to see how sendmail views your systems resolver lib configs. 

Type: sendmail -bt -d0.1 </dev/null

============ SYSTEM IDENTITY (after readcf) ============
      (short domain name) $w = voyager
  (canonical domain name) $j = mail.mydomain.com
         (subdomain name) $m = mydomain.com
              (node name) $k = voyager
========================================================

Note: In my printout above, my systems FQDN is voyager.mydomain.com. Yet, I
override this (canonical) in my sendmail.mc file to be mail.mydomain.com
which matches the MX record for my domain. This comes in handy for outbound
mail with certain remote MTA's that check the validity of the HELO
handshake.

2) Now check which mailer is selected by sendmail for your e-mail addresses
(ruleset 0). In your case, the "local" mailer should be selected. If not,
then you may have found your endless loop (barring any aliases or virtuals).
NOTE: After typing sendmail -bt you would enter what is shown at the >
prompt. Substitute for your domain. 

# sendmail -bt                                      
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked) 
Enter <ruleset> <address> 
> 3,0 scowles at mydomain.com 
canonify           input: scowles @ mydomain . com 
Canonify2          input: scowles < @ mydomain . com >  
Canonify2        returns: scowles < @ mydomain . com . >  
canonify         returns: scowles < @ mydomain . com . >  
parse              input: scowles < @ mydomain . com . >  
Parse0             input: scowles < @ mydomain . com . >  
Parse0           returns: scowles < @ mydomain . com . >  
ParseLocal         input: scowles < @ mydomain . com . >  
ParseLocal       returns: scowles < @ mydomain . com . >  
Parse1             input: scowles < @ mydomain . com . >  
Parse1           returns: $# local $: scowles 
parse            returns: $# local $: scowles

Note: In the above, I am invoking ruleset 3, then rulset 0. Ruleset 3 puts
each address into a form that simplfies tasks for other rulsets. In this
case, ruleset 0, which selects the mailer. 

The last line output above contains the mailer (local) and the mailbox in
this case.

As a frame of reference, I have removed "mydomain.com" from
/etc/mail/local-hosts-names. Notice that sendmail now selects the esmtp
mailer.

# sendmail -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> 3,0 scowles at mydomain.com
canonify           input: scowles @ mydomain . com
Canonify2          input: scowles < @ mydomain . com >
Canonify2        returns: scowles < @ mydomain . com . >
canonify         returns: scowles < @ mydomain . com . >
parse              input: scowles < @ mydomain . com . >
Parse0             input: scowles < @ mydomain . com . >
Parse0           returns: scowles < @ mydomain . com . >
ParseLocal         input: scowles < @ mydomain . com . >
ParseLocal       returns: scowles < @ mydomain . com . >
Parse1             input: scowles < @ mydomain . com . >
Mailertable        input: < mydomain . com > scowles < @ mydomain . com . >
Mailertable        input: mydomain . < com > scowles < @ mydomain . com . >
Mailertable      returns: scowles < @ mydomain . com . >
Mailertable      returns: scowles < @ mydomain . com . >
MailerToTriple     input: < > scowles < @ mydomain . com . >
MailerToTriple   returns: scowles < @ mydomain . com . >
Parse1           returns: $# esmtp $@ mydomain . com . $: scowles < @
mydomain . com . >
parse            returns: $# esmtp $@ mydomain . com . $: scowles < @
mydomain . com . >

BTW: Are you using any virtual addresses? How about your aliases file? Could
be that the local mailer is being selected, but then an alias kicks in to
forward to another system.

Long pause...
I'm sure the above looks complicated. Sorry! Sendmail is not the easist of
MTA's to configure. :-) But understanding which mailer is selected is
critical in undestanding how to resolve the to many hops errors. 

Think of this problem like this...

1) inbound e-mail arrives (either remotely or locally submitted).

2) Based on its configuration, sendmail selects whether or not the recipient
e-mail address is local or remote (the mailer).

3) if the remote mailer is selected (esmtp), sendmail forwards the inbound
e-mail to another MTA (using an MX record or a mailertable override)

4) The remote MTA receives this forwarded e-mail and checks its
configuration for whether or not the recipient e-mail address is local or
remote.

5) The remote MTA does not select the local mailer and determines it needs
to forward this e-mail back to your MTA. (using an MX record or a
mailertable override)

...and the loop continues.

Steve Cowles





More information about the redhat-list mailing list