Re: [exim] Noobie: configuration for smart host

Top Page
Delete this message
Reply to this message
Author: Carlo Wood
Date:  
To: Haines Brown
CC: exim-users
Subject: Re: [exim] Noobie: configuration for smart host
On Thu, Apr 26, 2007 at 01:26:06PM -0400, Haines Brown wrote:
> I'm not sure to what interface you refer. In my /etc/hosts I have:
>
> 127.0.0.1    localhost.localdomain localhost
> 127.0.1.1    teufel.hartford-hwp.com    hartford-hwp.com teufel


teufel.hartford-hwp.com does not exist and hartford-hwp.com
has IP 64.227.154.66 (as seen from the outside).

The bottom line therefore makes little sense. It's presence
would only serve one purpose: If YOU (on that very machine)
use the name "teufel" or "teufel.hartford-hwp.com" or
whatever you list on that line, your machine with use the IP
listed on that line instead of doing a DNS lookup (provided
'files' is listed first over 'dns' in /etc/nsswitch.conf).

Since 127.0.1.1 doesn't exist on your local machine (the
only things that exist are returned by 'ifconfig -a') it
makes no sense.

What you should do is pick IP numbers that you want to
use whenever you use that particular name. In particular,
if you use a FQDN in exim's config, it will "resolve" to
this IP (that is, I think it uses /etc/hosts -- I am not
100% sure though. It may always do a dns lookup).

> On my older machines I always gave my machine an IP address as if I
> were on a network:
>
> 127.0.0.1     localhost.localdomain localhost
> 192.168.1.1      teufel.hartford-hwp.com teufel


Personally, I don't use my real domain for 192.168.* IP's either.
My /etc/hosts file on ansset (the firewall where exim runs)
looks like:

127.0.0.1       localhost
#192.168.2.2    ansset.localdomain ansset
192.168.2.1     alinoe.localdomain alinoe
192.168.2.3     taryn.localdomain taryn


# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts


Note that I commented out ansset. The reason for this is
that run also a caching nameserver on that machine (thus, one
that isn't used by the outside world!) and since I have
"search alinoe.com" in /etc/resolv.conf, looking up 'ansset'
results in looking up ansset.alinoe.com, which is resolved
to 192.168.2.2 by my name server. The "advantage" is that
a reverse lookup also works (giving ansset.alinoe.com).
Actually, I don't think that this is relevant for exim.

> but the new Etch installation never asked me for it and so I'm using
> 127.0.1.1, which I hope suffices.
>
> I tried to telnet to 127.0.1.1, but telnet hangs, and exim4's mail log
> says
> "lookup of host 'brownh@???' failed in smarthost router"


I don't get that. Since 127.0.1.1 doesn't exist (it doesn't show up in
ifconfig -a), telnet won't succeed to connect to anything; therefore
nothing can be written to the mail log as a result of trying.

> An embarassing question: I understand that my ISP mail server is a
> smart host, but is this saying my local host is a smart host as well?
> Am I running a mail server?


A smart host is for outgoing mail. You probably should sent all your
mail to your ISP's smart host if they provide one (sending it directly
might be refused because your IP might be in a dynamic IP range for
example). Your local machine would only be called a 'smart' host
when you send all your mail to it, letting it handle it. For outgoing
mail that makes little sense (you might as well send that directly to
the ISP's smart host). So no, I don't think your local mail server is
a smart host.

> I'm using a hardware firewall, and so when I do # ipconfig -a, my eth1
> interface is 192.168.111.2, which is the address I use with the
> firewall. Telnet can't find any hostname for that address,


'telnet' is not a lookup tool. Also 'host' or 'dig' wouldn't find it
in /etc/hosts (after you add it there) because they never do 'files',
only 'dns'.

If you want to test your exim (for incoming mail) with telnet, you should
telnet to 192.168.111.2 port 25 if that is the interface that is connected
to your firewall. You probably also want to add 192.168.111.2 to
/etc/hosts with appropriate names, ie:

192.168.111.2    teufel.localdomain teufel


after which you can do: telnet teufel 25
as well.

> and exim4
> main log says: "rejected RCPT brownh@???: relay not
> permitted". Same thing happens when I telnet to my domain name.


If your exim is the destination for the domain hartford-hwp.com
then you should tell it so. If it doesn't know that hartford-hwp.com
is itself - it thinks you are trying to relay mail (if it accepted
it, it would have to send it to your ISP's smarthost for further
handling-- because it doesn't know what to do with it).

> Another embarassing question: my local host should not be set up for
> relaying, and so why am I getting "relay not permitted" error messages?


See above. My exim accepts mail for the domain alinoe.com because
I have "alinoe.com: taryn" in the file /etc/exim4/hubbed_hosts. That
file is debian specific by the way (I run debian). It is also probably
not what you want: what it does is pass all incoming mail to 'taryn'
(ie, taryn is acting as the "smarthost" for incoming mail sent to 'alinoe.com').

--
Carlo Wood <carlo@???>

PS Under debian (in case you don't use debian but DO want to route
incoming mail to another internal machine on your LAN) hubbed_hosts
is used in ./conf.d/router/150_exim4-config_hubbed_hosts as follows:

hubbed_hosts:
  debug_print = "R: hubbed_hosts for $domain"
  driver = manualroute
  domains = "${if exists{CONFDIR/hubbed_hosts}\
                   {partial-lsearch;CONFDIR/hubbed_hosts}\
              fail}"
  same_domain_copy_routing = yes
  route_data = ${lookup{$domain}partial-lsearch{CONFDIR/hubbed_hosts}}
  transport = remote_smtp


PS2 I noted that the MX record for hartford-hwp.com is
    inbound.registeredsite.com -- this confuses me. You aren't
    receiving mail directly it seems. Are you using your exim
    to RECEIVE mail at all? Or only to send it? How many machine
    do you have on your LAN? Just one?