Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I wish to setup a local mail server for debugging purposes using fedora 15 I set up sendmail, but there is a problem.

When I'm not connected to the internet, the local mail server delivers correctly (to localhost). And in /var/log/mail I see that I correctly delivered a mail to adriano@PowersourceII.localdomain:

Jun 21 18:24:56 PowersourceII sendmail[6019]: p5LGOttt006019: from=adriano@PowersourceII.localdomain, size=328, class=0, nrcpts=1, msgid=<1308673495.4942.11.camel@PowersourceII.localdomain>, relay=adriano@localhost
Jun 21 18:24:56 PowersourceII sendmail[6020]: p5LGOuSV006020: from=<adriano@PowersourceII.localdomain>, size=506, class=0, nrcpts=1, msgid=<1308673495.4942.11.camel@PowersourceII.localdomain>, proto=ESMTP, daemon=MTA, relay=PowersourceII.localdomain [127.0.0.1]
Jun 21 18:24:56 PowersourceII sendmail[6019]: p5LGOttt006019: to=adriano@PowersourceII.localdomain, ctladdr=adriano@PowersourceII.localdomain (500/500), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30328, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (p5LGOuSV006020 Message accepted for delivery)

When I connect, networkmanager fills in /etc/resolv.conf with:

domain fastwebnet.it
search fastwebnet.it localdomain
nameserver 62.101.93.101
nameserver 83.103.25.250

Now sendmail does not work any longer and tries to send messages to my ISP domain, as seen in the log:

Jun 21 18:40:02 PowersourceII sendmail[6348]: p5LGe1LV006348: to=adriano@PowersourceII.localdomain, ctladdr=adriano@PowersourceII.localdomain (500/500), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30327, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (p5LGe10n006352 Message accepted for delivery)
Jun 21 18:40:02 PowersourceII sendmail[6354]: p5LGe10n006352: to=<adriano@PowersourceII.localdomain.fastwebnet.it>, delay=00:00:01, xdelay=00:00:00, mailer=esmtp, pri=120651, relay=mx3.fastwebnet.it. [85.18.95.21], dsn=5.1.1, stat=User unknown

As you can see, it tries to deliver a mail to adriano@PowersourceII.localdomain.fastwebnet.it, and fails

The setup is working under other ISPs. How can I avoid the fastweb ISP DNS relay? Thank you

share|improve this question

3 Answers 3

It sounds like your ISP is hijacking your DNS queries and "injecting" their own equipment/servers when a query would normally be unresolvable.

Adding "PowersourceII.localdomain" to your local hosts file should take case of the situation.

share|improve this answer
    
The entry "PowersourceII.localdomain" is already in /etc/mail/local-host-names and in /etc/hosts, but no joy. I've tried it under another wlan spot (and another ISP) and the setup works online, other than offline. So I'm sure its related to the fastweb ISP DNS... –  digital illusion Jun 22 '11 at 6:35
    
What is the actual entry in /etc/hosts? –  user48838 Jun 22 '11 at 7:09
    
127.0.0.1 PowersourceII.localdomain localhost.localdomain localhost –  digital illusion Jun 22 '11 at 7:37
    
Ok, after another look at your posting, it looks like it maybe your /etc/resolv.conf. Although the following link are man-pages for BSD, it should provide you the needed information on the /etc/resolv.conf.tail file to address your situation - openbsd.org/cgi-bin/man.cgi?query=resolv.conf&sektion=5. –  user48838 Jun 22 '11 at 9:48

I think what you need is a DNS conditional forwarder, so that anything sent to PowersourceII.localdomain would be sent internally and the rest would go to your ISP's DNS server.

share|improve this answer
    
Or local hosts. That'd do it too; leave it to me to find the hard way. –  Daniel Ball Jun 21 '11 at 17:47
    
Can you point me to a way to achieve this DNS separation? –  digital illusion Jun 22 '11 at 6:38
    
That won't work. Look carefully at what is being placed into resolv.conf. The domain a.example.fastwebnet.it. is always going to be looked up before the domain a.example.localdomain. when the unqualified name a.example is used. This is a Sendmail domain name canonicalization problem. It isn't solved with the DNS. It's solved by configuring Sendmail appropriately (or by switching to an MTS with less obtuse canonicalization mechanisms). –  JdeBP Jun 22 '11 at 12:51
    
I thought it only went to resolv.conf if BIND couldn't resolve initially? I do see that it's appending fastwebnet.it to the end of localdomain ... and ... oh. He's hitting an external DNS isn't he? The local hosts file would still work though wouldn't it? Isn't that queried before anything else? Or am I missing a point? –  Daniel Ball Jun 22 '11 at 14:24

See? Now you know why DNS wildcards are a bad thing in most cases. The DNS server on fastwebnet.it answers for any subdomains with its IPs. Thus, your sendmail thinks it can send mail to PowersourceII.localdomain.fastwebnet.it. The rough order of queries to find a server to send mail to is the following. Each of the queries is run agains the default DNS server (which is probably a recursor of your provider).

  1. PowersourceII.localdomain. »» Doesn't exist according to the knowledge of the configured DNS recursor.
  2. append the first search domain. PowersourceII.localdomain.fastwebnet.it. »» Authorative DNS server of fastwebnet.it claims it exists. (check with host -v PowersourceII.localdomain.fastwebnet.it)

Thus your sendmail happily continues to try to send the mail there. This is exactly what it's been built for. And this is also why messing with DNS (i.e. providing helpfull redirect for misspelled domains or typically DNS wildcards to ease life) leads to desastrous results when using mail. It absolutly requires the correct responses to non-existent domains.

Possible solutions to this issues would be to

  • remove the fasterwebnet.it search domain entries from your /etc/resolv.conf,
  • to include an explicit entry for PowersourceII.localdomain into your /etc/hosts, or
  • to setup a local DNS recursor with a special overriding rule for handling this domain.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.