Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Configuring Exim for mail delivery

73 views
Skip to first unread message

mo

unread,
Sep 30, 2016, 4:30:05โ€ฏPM9/30/16
to
Hi fellow Debian users ;)

First off some information. (both, the pc and the server run Debian Jessie):

Distributor ID: Debian
Description: Debian GNU/Linux 8.6 (jessie)
Release: 8.6
Codename: jessie

Exim:
ii exim4 4.84.2-2+deb8u1
all metapackage to ease Exim MTA (v4) installation
ii exim4-base 4.84.2-2+deb8u1
amd64 support files for all Exim MTA (v4) packages
ii exim4-config 4.84.2-2+deb8u1
all configuration for the Exim MTA (v4)
ii exim4-daemon-light 4.84.2-2+deb8u1
amd64 lightweight Exim MTA (v4) daemon


I'm currently playing around with exim4... and to be honest i'm a little
lost here.
I want to do the following configuration:
Send and deliver local mails between my systems. Currently exim is
configured as a Internet Server (dpkg-reconfigure exim4-config).
In general i kinda ask myself how i would go about doing that?
I want to send mail from my server to my pc and vice versa, also i want
to be able to send mail "out" to other smtp servers.

Is Exim here the right choice? (I do think so at least)

To be honest i never played with a smtp server before... so my knowledge
is a bit foggy :P (Don't worry, i know what a MTA, MUA etc is)

Thank you all in advance for your help ;)

Btw: I will of course provide more information if needed ;)

Greets

mo

Liam O'Toole

unread,
Sep 30, 2016, 6:50:03โ€ฏPM9/30/16
to
If you run 'dpkg-reconfigure exim4-config' again, you will see a
question about "Other destinations for which mail is accepted". Here you
would enter something like '*.yourdomain.com', where your PC and
server belong to that domain. In that way exim4 will deliver email
directly to those hosts rather than relaying outside your network.

Regarding your second requirement, you probably want to choose the
second option on the first screen, ie, "mail sent by smarthost; received
via SMTP or fetchmail". You would then enter the name of your ISP's SMTP
when prompted later for the name of the smarthost.

--

Liam

Mark Fletcher

unread,
Sep 30, 2016, 10:00:05โ€ฏPM9/30/16
to
On Fri, Sep 30, 2016 at 10:22:10PM +0200, mo wrote:
> Hi fellow Debian users ;)
> I want to do the following configuration:
> Send and deliver local mails between my systems. Currently exim is
> configured as a Internet Server (dpkg-reconfigure exim4-config).
> In general i kinda ask myself how i would go about doing that?
> I want to send mail from my server to my pc and vice versa, also i want to
> be able to send mail "out" to other smtp servers.
>

Depending on your local setup, having Exim set as an Internet server may
not be the right answer, as Liam has already said.

I'm going to make some assumptions here and you can correct them if they
are wrong.

I'll assume you have a home network and are trying to connect to send
mails between machines on that network, and additionally be able to send
email to domains outside your network.

I'm also assuming that you don't have specific domains for your own
machines, so that when you send mail outside you want to use an email
provider such as gmail, or hover, etc.

For most home network situations, ISPs don't like you trying to send
email directly from your home network. They want you to use their (or at
least SOMEONE's) smarthost. That makes it less likely they will find
themselves accessories to spamming. Also, many mainstream destination
email addresses will not accept mail from just any old place; if you try
to send mail directly to them from behind your home network router, even
if your ISP allows you to do so, the other end may reject the mail
because they can't tell what machine it is coming from.

If my assumptions above are right, you want to use "smarthost" as the
configuration. If I am wrong and you have your own domain and the right
to set up mail servers in it, then you do want the "internet" setting,
but you still want to pay attention to the rest of this message as it
addresses local network delivery.

I just figured out how to get this working myself a week or two back, so
it's fresh in my mind. The key trick is the use of "hubbed hosts".

Exim configuration has the concept of "routers" and "transports".
Routers basically decide what to do with a message, and transports do
it. One of the routers configured by default in the Debian exim
configuration is for "hubbed hosts". What this means, is machines
capable of sending and receiving email ("hosts" in exim speak) that are
on the same LAN as this machine (connected by a "hub"). Note that this
"hub" could be your local home network router, and for these purposes
machines on WiFi and machines on a wired LAN would be considered on the
same hub, even though that isn't strictly true. The point is that
network packets can be addressed directly between the machines, they
don't require a router in between.

In Debian, this is achieved with Avahi. This is what allows you, if you
have MachineA and MachineB on your network, to do for example "ping
MachineA.local" from MachineB and expect MachineA.local to be resolved
into an IP address.

As far as I can tell, Avahi is installed by default when you install a
new Debian installation. I don't know how long that has been true, but
my experience is that it is now.

In /etc/exim4, create a file owned by root called hubbed_hosts. In the
file, each line maps a "domain" (the part after the @ sign in an email
address) to a "host" (the name of a machine on your network, as it can
be reached from this machine). Put the domain first, then a tab
character (spaces may also be OK) and then the host. So for example I
have a machine on my network called affinity, and so in the hubbed_hosts
file on the machine I am sitting in front of now, I have two lines, one
saying "affinity.local<TAB>affinity.local", and the other saying
"affinity<TAB>affinity.local" (no quotes in the file). This tells the
local exim installation that any email address with @affinity.local as
the domain should be forwarded on to a machine called affinity.local,
and any mail with @affinity as the domain should be forwarded on to a
machine called affinity.local. Exim4 will then say "Connect to
affinity.local!" with no attempt to translate that into an IP address,
and Avahi daemon will answer "that is IP address WW.XX.YY.ZZ!" to which
exim will say "very well, connect to WW.XX.YY.ZZ!" and the exim4 on
affinity will wake up and co-operate to deliver the mail.

If the target email domain is not present in hubbed_hosts, then a
default "smarthost" configuration will fall through the hubbed hosts
router and arrive at the smarthost router, which in my case then tries
to use my mail provider to send a mail to a local machine, which is
doomed to failure because the outside provider cannot see my individual
machines on my local network.

If you really should be using the "internet" configuration, you still
need hubbed_hosts for local mails because whereas the hubbed_hosts
option just leaves it to the local network to figure out what it is
talking about, an internet-configured exim will attempt to find and send
to the target machine. To do so, it will send out a DNS request to
resolve the ip address of the target host. Avahi won't catch this, and
unless you are running a DNS server locally on your network (most people
don't, and many home network routers don't include one) that request
will go out of your network to the DNS server provided by your ISP. That
DNS server, being outside your network, won't be able to resolve your
local machine names and so won't be able to give you back an IP address
to use, unless your target machines are publicly individually visible on
the Internet, which is unlikely if this is a home configuration we are
talking about here.

So the configuration you are after is local domains specified in
hubbed_hosts, and everything else falls through to either a smarthost or
a dns-based attempt to send outside your network.

Hope that helps, let us know if you need more help.

Mark

mo

unread,
Oct 1, 2016, 5:10:04โ€ฏAM10/1/16
to
First of all:
Thank you Liam for your help! :)
Thanks for the very nice and long explanation Mark! :)

I think i should elaborate a little more on my setup.. i guess i did not
make that very clear in the first place, sorry about that.

My network is consisting of the following systems:

Main PC - 192.168.23.11 (Running Debian Jessie)
Server - 192.168.23.200 (Running Debian Jessie)

The server is always online, the PC is only half of the day on.

What i want to do now is the following:

Sending mail from my Main PC to my Server and also the other way around,
from the Server to my Main PC.
The Server should also be able to send mail to the "outside" (Meaning to
other SMTP servers).
The second requirement is optional since i dont own a domain and all
this is sitting locally at my home. The most important thing for me is
to send and receive mail from both systems in my home network.
I hope this made my problem a little clearer :)

I'm a little ashamed to say that, but i could not totally follow your
explanations Mark... I'm quite a newbie when it comes to SMTP.. sorry :(

Thanks again for all your help ;)

Greets

mo

Brian

unread,
Oct 1, 2016, 6:10:04โ€ฏAM10/1/16
to
Assuming the server hostname is "server".

1. On Main PC use your editor to create /etc/exim4/hubbed_hosts. In it
put

server: 192.168.23.200

in it and restart exim4.

2. Send mail to user@server.

3. You can replace 'server: 192.168.23.200' with 'server: server.local'
if avahi-daemon is running on both machines.

--
Brian.

mo

unread,
Oct 1, 2016, 6:40:04โ€ฏAM10/1/16
to



> I'll assume you have a home network and are trying to connect to send
> mails between machines on that network, and additionally be able to send
> email to domains outside your network.

That is right ;)

> I'm also assuming that you don't have specific domains for your own
> machines, so that when you send mail outside you want to use an email
> provider such as gmail, or hover, etc.

Also true ;)


> I just figured out how to get this working myself a week or two back, so
> it's fresh in my mind. The key trick is the use of "hubbed hosts".

Did you follow a specific book or guide?

> Exim configuration has the concept of "routers" and "transports".
> Routers basically decide what to do with a message, and transports do
> it. One of the routers configured by default in the Debian exim
> configuration is for "hubbed hosts". What this means, is machines
> capable of sending and receiving email ("hosts" in exim speak) that are
> on the same LAN as this machine (connected by a "hub"). Note that this
> "hub" could be your local home network router, and for these purposes
> machines on WiFi and machines on a wired LAN would be considered on the
> same hub, even though that isn't strictly true. The point is that
> network packets can be addressed directly between the machines, they
> don't require a router in between.
>

As far as i do understand this is that only machines which are defined
as hubbed hosts can be send mail in the local LAN? Or am i
misunderstanding something here? :)

> In Debian, this is achieved with Avahi. This is what allows you, if you
> have MachineA and MachineB on your network, to do for example "ping
> MachineA.local" from MachineB and expect MachineA.local to be resolved
> into an IP address.
>

I'm not a friend of avahi to be honest, i much rather ignore it :D

> In /etc/exim4, create a file owned by root called hubbed_hosts. In the
> file, each line maps a "domain" (the part after the @ sign in an email
> address) to a "host" (the name of a machine on your network, as it can
> be reached from this machine). Put the domain first, then a tab
> character (spaces may also be OK) and then the host. So for example I
> have a machine on my network called affinity, and so in the hubbed_hosts
> file on the machine I am sitting in front of now, I have two lines, one
> saying "affinity.local<TAB>affinity.local", and the other saying
> "affinity<TAB>affinity.local" (no quotes in the file). This tells the
> local exim installation that any email address with @affinity.local as
> the domain should be forwarded on to a machine called affinity.local,
> and any mail with @affinity as the domain should be forwarded on to a
> machine called affinity.local. Exim4 will then say "Connect to
> affinity.local!" with no attempt to translate that into an IP address,
> and Avahi daemon will answer "that is IP address WW.XX.YY.ZZ!" to which
> exim will say "very well, connect to WW.XX.YY.ZZ!" and the exim4 on
> affinity will wake up and co-operate to deliver the mail.

I just did that and now mailing works flawlessly :D
Just one questions: Why do i need hubbed_host entries? Should it not be
fine alone to make a entry in /etc/hosts for the machines i want to send
mail to (I do not operate a dedicated DNS server).
This is something i dont really understand...

> If the target email domain is not present in hubbed_hosts, then a
> default "smarthost" configuration will fall through the hubbed hosts
> router and arrive at the smarthost router, which in my case then tries
> to use my mail provider to send a mail to a local machine, which is
> doomed to failure because the outside provider cannot see my individual
> machines on my local network.
>
> If you really should be using the "internet" configuration, you still
> need hubbed_hosts for local mails because whereas the hubbed_hosts
> option just leaves it to the local network to figure out what it is
> talking about, an internet-configured exim will attempt to find and send
> to the target machine. To do so, it will send out a DNS request to
> resolve the ip address of the target host. Avahi won't catch this, and
> unless you are running a DNS server locally on your network (most people
> don't, and many home network routers don't include one) that request
> will go out of your network to the DNS server provided by your ISP. That
> DNS server, being outside your network, won't be able to resolve your
> local machine names and so won't be able to give you back an IP address
> to use, unless your target machines are publicly individually visible on
> the Internet, which is unlikely if this is a home configuration we are
> talking about here.
>
> So the configuration you are after is local domains specified in
> hubbed_hosts, and everything else falls through to either a smarthost or
> a dns-based attempt to send outside your network.
>
> Hope that helps, let us know if you need more help.

Your explanation helped a lot ;)

> Mark
>


Greets

mo

mo

unread,
Oct 1, 2016, 6:40:04โ€ฏAM10/1/16
to
Hi Brian :)

>
> Assuming the server hostname is "server".
>
> 1. On Main PC use your editor to create /etc/exim4/hubbed_hosts. In it
> put
>
> server: 192.168.23.200
>
> in it and restart exim4.
>
> 2. Send mail to user@server.
>
> 3. You can replace 'server: 192.168.23.200' with 'server: server.local'
> if avahi-daemon is running on both machines.
>

It worked perfectly
...I just found out that "mail" does not support Maildir format, but
mutt does fine
I can now send and receive mail from and to my server. Thank you very
much for your help! (...And for the easy step by step guide )

Thanks again

Greets
mo

Brian

unread,
Oct 1, 2016, 7:30:04โ€ฏAM10/1/16
to
On Sat 01 Oct 2016 at 12:36:10 +0200, mo wrote:

> >I just figured out how to get this working myself a week or two back, so
> >it's fresh in my mind. The key trick is the use of "hubbed hosts".
>
> Did you follow a specific book or guide?

The manual for exim4-config_files is the first place to look.

> >Exim configuration has the concept of "routers" and "transports".
> >Routers basically decide what to do with a message, and transports do
> >it. One of the routers configured by default in the Debian exim
> >configuration is for "hubbed hosts". What this means, is machines
> >capable of sending and receiving email ("hosts" in exim speak) that are
> >on the same LAN as this machine (connected by a "hub"). Note that this
> >"hub" could be your local home network router, and for these purposes
> >machines on WiFi and machines on a wired LAN would be considered on the
> >same hub, even though that isn't strictly true. The point is that
> >network packets can be addressed directly between the machines, they
> >don't require a router in between.
> >
>
> As far as i do understand this is that only machines which are defined as
> hubbed hosts can be send mail in the local LAN? Or am i misunderstanding
> something here? :)

hubbed_hosts can send mail wherever you want. For example:

example.com: smtp.example.com

would send mail to someone at example.com through smtp.example.com
(which could be a smarthost).

> >In Debian, this is achieved with Avahi. This is what allows you, if you
> >have MachineA and MachineB on your network, to do for example "ping
> >MachineA.local" from MachineB and expect MachineA.local to be resolved
> >into an IP address.
> >
>
> I'm not a friend of avahi to be honest, i much rather ignore it :D

Let's hope your IP addresses do not change.

> >In /etc/exim4, create a file owned by root called hubbed_hosts. In the
> >file, each line maps a "domain" (the part after the @ sign in an email
> >address) to a "host" (the name of a machine on your network, as it can
> >be reached from this machine). Put the domain first, then a tab
> >character (spaces may also be OK) and then the host. So for example I
> >have a machine on my network called affinity, and so in the hubbed_hosts
> >file on the machine I am sitting in front of now, I have two lines, one
> >saying "affinity.local<TAB>affinity.local", and the other saying
> >"affinity<TAB>affinity.local" (no quotes in the file). This tells the
> >local exim installation that any email address with @affinity.local as
> >the domain should be forwarded on to a machine called affinity.local,
> >and any mail with @affinity as the domain should be forwarded on to a
> >machine called affinity.local. Exim4 will then say "Connect to
> >affinity.local!" with no attempt to translate that into an IP address,
> >and Avahi daemon will answer "that is IP address WW.XX.YY.ZZ!" to which
> >exim will say "very well, connect to WW.XX.YY.ZZ!" and the exim4 on
> >affinity will wake up and co-operate to deliver the mail.
>
> I just did that and now mailing works flawlessly :D
> Just one questions: Why do i need hubbed_host entries? Should it not be fine
> alone to make a entry in /etc/hosts for the machines i want to send mail to
> (I do not operate a dedicated DNS server).
> This is something i dont really understand...

I'd suggest you try it and look at the logs.

--
Brian.

Mark Fletcher

unread,
Oct 1, 2016, 7:40:03โ€ฏAM10/1/16
to
On Sat, Oct 01, 2016 at 11:06:07AM +0200, mo wrote:
>
> I think i should elaborate a little more on my setup.. i guess i did not
> make that very clear in the first place, sorry about that.
>
> My network is consisting of the following systems:
>
> Main PC - 192.168.23.11 (Running Debian Jessie)
> Server - 192.168.23.200 (Running Debian Jessie)
>
> The server is always online, the PC is only half of the day on.
>
> What i want to do now is the following:
>
> Sending mail from my Main PC to my Server and also the other way around,
> from the Server to my Main PC.
> The Server should also be able to send mail to the "outside" (Meaning to
> other SMTP servers).
> The second requirement is optional since i dont own a domain and all this is
> sitting locally at my home. The most important thing for me is to send and
> receive mail from both systems in my home network.
> I hope this made my problem a little clearer :)
>

Right. So you get mail going back and forth between your two machines,
server and PC, by creating and populating the hubbed_hosts file I
talked about in my previous mail, on both machines, pointing at each
other of course.

If you want to ping the server from the client, you should be able to do
"ping server.local" from your PC (obviously replace the actual name of
your server, which you didn't include in your mail, where I put server).
What is happening if you do that is your PC is saying "get me the
address of server.local!" and the Avahi daemon on your PC either already
knows that, or sends out a broadcast message to your network saying "is
there a server.local in the house???". The Avahi daemon running on the
server responds to that saying "yes, I'm here, and my IP address is
192.168.23.200!". The Avahi daemon on your PC responds to whatever did
the asking (ping in this case) with the required IP. Ping then requests
that packets be sent to IP address quoted. By this mechanism computers
on the same LAN can communicate with each other peer to peer without
fannying around with full-blown DNS, which is what Avahi is for. That is
installed by the Jessie installer by default as far as I can tell, so
both your machines should have it. It doesn't require any configuration,
so if you haven't touched it, it should work as I have described.
Although obviously, you have to substitute the real names for your
server and PC (but you *do* require the .local unless you have configured
Avahi to use something else)

If you used the default config of exim4 the hubbed_hosts router is set
up and waiting to be used. All you need to do to enable it is to
populate the hubbed_hosts file as I described. The other thing you need
to do is follow Liam's advice, except importantly what needs to be set
there is the "domain" of the local PC (on the local PC) or the server
(on the server) only. So the PC will accept mail for pc.local (or
whatever your pc is called) and the server for server.local (or whatever
the server is called). Then, you will be able to email yourself at the
server from the PC by sending a mail to m...@server.local, where I am
assuming your user name on the server is mo and the server's machine
name is server. Obviously you would substitute real names. And to go the
other way, from the server, you could send a mail to yourself on the PC
by mailing m...@pc.local.

Let's take a moment to go through what happens if you send a mail from
PC to server with everything set up as it should be.

On the PC you create a mail and address it to m...@server.local. Let's
imagine you use mutt to create it. And let's assume mutt is using its
default configuration to send the mail, which is to call sendmail. And,
since you have installed exim4, exim has overridden sendmail to actually
be calling exim4. So, when mutt sends a mail, exim4 running on your PC
gets handed the mail.

The first thing it does, is say is this mail for this domain. Hmmm. I am
pc.local. This mail is going to server.local. That ain't me. So not
local delivery. OK, next I will try hubbed hosts. Do I have any
hubbed_hosts? Let's look in the hubbed_hosts file. Yep, I do. Can i find
the @server.local domain in the hubbed_hosts file? Yes, I can. Right,
where do I send it then? Ah, I send it to a machine called server.local.
OK... Oi! Network! Gimme the address for server.local....... (this is
where Avahi does its thing)...Thanks! Right, Connect to 192.168.23.200
port 25!

At this point the exim4 running on your server gets a dig in the ribs,
wakes up, and responds to the connection. The two exim4s talk to each
other and the net result is the mail gets transferred from the exim4
running on the PC to the exim4 running on the server.

Then the exim4 running on the server goes through the same rigmarole,
except it finds that the mail IS addressed to a local address, so it
goes into delivery mode and the mail finds its way into the right
mailbox on that machine.

Now let's consider what would happen if you tried instead to send a mail
to the debian user mailing list from your PC (but the same would apply
to your server). You can't do this using m...@pc.local, because A) your
ISP most likely won't let you and B) most recipient domains will reject
that. Instead you have to use a "real" email address, ie one provided by
your ISP or something like a gmail account or similar. You'll have to
have configured exim4 in smarthost mode and you will have to have
configured exim4 to know what your outgoing mail server name is. For
example, for the specific case of sending to this mailing list, I use
gmail for outgoing mail and their server name is smtp.gmail.com if I
recall correctly. You'll also have had to put your email user name and
password into a file called passwd.client in your /etc/exim4 config
directory. Since this contains your email password, make sure the file
is owned by root and not world readable!

Then, any address that isn't local to the machine, and also isn't in the
hubbed_hosts file, will be treated as external and exim4 will connect to
the smarthost (your email provider's server) and pass on the message to
be delivered by it.

Net result -- you send an email from PC to Server, it gets delivered
directly by a conversation between the two exim4 instances. You send a
mail anywhere else, it gets handed off to your real-world (not that the
inside of your home is not "real"!) email provider for delivery.

Now, a word on exim4 config. Be sure to read the *DEBIAN* wiki etc on
configuring exim4, as the DEBIAN config is a bit different to what you
will find upstream. Let me save you a bit of time.

First, there are two ways to configure exim4, using one big config file
which is found in /var/lib/exim4, or using a config directory containing
a bunch of small config files each handling one small piece of the
configuration. Opinions abound on which is better, I have no opinion. By
default, exim4 on Debian will use the single file approach. Second,
Debian constructs the config file by using a TEMPLATE to be found in
/etc/exim4, and a second configuration file called
update-exim4.conf.conf (yes, the conf file for updating the conf
file......) You put your specific config in the update-exim4.conf.conf
file, then when you are done you run update-exim4.conf as root
(update-exim4.conf is actually a program, not a conf file...
update-exim4.conf.conf is a conf file...) and restart exim4. The
update-exim4.conf program combines the template with the specific info
in update-exim4.conf.conf and writes the result to
/var/lib/exim4/config.autogenerated which is the config exim4 on Debian
uses. This can also be done by running dpkg-reconfigure exim4.conf as
Liam suggested, but I think there are more things you can do with
update-exim4.conf.conf than the questions dpkg-reconfigure will ask you,
so it wouldn't hurt to get familiar with what is going on under the hood
when you do dpkg-reconfigure, but that's just my opinion.

If you need more specific help on how to get your local exim4 talking to
an external email provider, or for that matter if you need me to clarify
anything about getting local machine to local machine email working,
post back here.

Also, being able to receive replies to externally sent mails back into
your machine locally, needs another bit of setup. If you need that, let
us know and I'll help with that part too (it is where fetchmail comes
in). But, there is nothing to stop you using whatever mail client you
use today to read your email as you presumably do now, and you'll see
the mails you sent locally there in your sent mail (depending on the
precise behaviour of your provider's mail server)

Hope that helped clarify things. Sorry for the length of this but
someone has finally asked for help with something I know something
about, and I'm keen to help! :)

Mark

mo

unread,
Oct 1, 2016, 7:50:03โ€ฏAM10/1/16
to


Am 01.10.2016 um 13:22 schrieb Brian:
> On Sat 01 Oct 2016 at 12:36:10 +0200, mo wrote:
>
>>> I just figured out how to get this working myself a week or two back, so
>>> it's fresh in my mind. The key trick is the use of "hubbed hosts".
>>
>> Did you follow a specific book or guide?
>
> The manual for exim4-config_files is the first place to look.
>

I will look into the manual.
I also found a book about exim from O'Reilly, it's quite old (2001) but
i guess i can get some info out of it.

>>> Exim configuration has the concept of "routers" and "transports".
>>> Routers basically decide what to do with a message, and transports do
>>> it. One of the routers configured by default in the Debian exim
>>> configuration is for "hubbed hosts". What this means, is machines
>>> capable of sending and receiving email ("hosts" in exim speak) that are
>>> on the same LAN as this machine (connected by a "hub"). Note that this
>>> "hub" could be your local home network router, and for these purposes
>>> machines on WiFi and machines on a wired LAN would be considered on the
>>> same hub, even though that isn't strictly true. The point is that
>>> network packets can be addressed directly between the machines, they
>>> don't require a router in between.
>>>
>>
>> As far as i do understand this is that only machines which are defined as
>> hubbed hosts can be send mail in the local LAN? Or am i misunderstanding
>> something here? :)
>
> hubbed_hosts can send mail wherever you want. For example:
>
> example.com: smtp.example.com
>
> would send mail to someone at example.com through smtp.example.com
> (which could be a smarthost).
>

Got it, thanks ;)

>>> In Debian, this is achieved with Avahi. This is what allows you, if you
>>> have MachineA and MachineB on your network, to do for example "ping
>>> MachineA.local" from MachineB and expect MachineA.local to be resolved
>>> into an IP address.
>>>
>>
>> I'm not a friend of avahi to be honest, i much rather ignore it :D
>
> Let's hope your IP addresses do not change.
>

No changes here, static network configuration, so that should not pose
problems. (My network only has 4 machines, so DHCP is not needed, at
least atm i don't need it :) )

>>> In /etc/exim4, create a file owned by root called hubbed_hosts. In the
>>> file, each line maps a "domain" (the part after the @ sign in an email
>>> address) to a "host" (the name of a machine on your network, as it can
>>> be reached from this machine). Put the domain first, then a tab
>>> character (spaces may also be OK) and then the host. So for example I
>>> have a machine on my network called affinity, and so in the hubbed_hosts
>>> file on the machine I am sitting in front of now, I have two lines, one
>>> saying "affinity.local<TAB>affinity.local", and the other saying
>>> "affinity<TAB>affinity.local" (no quotes in the file). This tells the
>>> local exim installation that any email address with @affinity.local as
>>> the domain should be forwarded on to a machine called affinity.local,
>>> and any mail with @affinity as the domain should be forwarded on to a
>>> machine called affinity.local. Exim4 will then say "Connect to
>>> affinity.local!" with no attempt to translate that into an IP address,
>>> and Avahi daemon will answer "that is IP address WW.XX.YY.ZZ!" to which
>>> exim will say "very well, connect to WW.XX.YY.ZZ!" and the exim4 on
>>> affinity will wake up and co-operate to deliver the mail.
>>
>> I just did that and now mailing works flawlessly :D
>> Just one questions: Why do i need hubbed_host entries? Should it not be fine
>> alone to make a entry in /etc/hosts for the machines i want to send mail to
>> (I do not operate a dedicated DNS server).
>> This is something i dont really understand...
>
> I'd suggest you try it and look at the logs.
>

I will try that out, exim has a pretty nice logging format i think ;)

Greets

mo

Clive Menzies

unread,
Oct 1, 2016, 8:00:03โ€ฏAM10/1/16
to
Hi Mo

I tried to send this with a .pdf yesterday d'oh! Anyway, we've just
reinstalled our servers with mail and automated backup and updated our
notes. They're not finalised and hence not on the web yet but you can
access them here:
https://dl.dropboxusercontent.com/u/63603283/InstallationNotes2016.9.24.pdf

Bit's of it may help.

Regards

Clive

--
Clive Menzies
http://freecriticalthinking.org

mo

unread,
Oct 1, 2016, 8:10:04โ€ฏAM10/1/16
to
> Hi Mo

Hi Clive :)

> I tried to send this with a .pdf yesterday d'oh! Anyway, we've just
> reinstalled our servers with mail and automated backup and updated our
> notes. They're not finalised and hence not on the web yet but you can
> access them here:
> https://dl.dropboxusercontent.com/u/63603283/InstallationNotes2016.9.24.pdf
>
> Bit's of it may help.

It sure does! I quickly scanned over the pdf and the mail part is quite
interesting for me, thanks a lot! ;)

Btw: Nice setup you got there! :)

>
> Regards
>
> Clive
>

Greets

mo

Mark Fletcher

unread,
Oct 1, 2016, 8:10:04โ€ฏAM10/1/16
to
No colons as separators in hubbed_hosts, to my knowledge. Use spaces or tabs.

Mark

mo

unread,
Oct 1, 2016, 8:10:04โ€ฏAM10/1/16
to


Am 01.10.2016 um 13:36 schrieb Mark Fletcher:
> On Sat, Oct 01, 2016 at 11:06:07AM +0200, mo wrote:
>>
>> I think i should elaborate a little more on my setup.. i guess i did not
>> make that very clear in the first place, sorry about that.
>>
>> My network is consisting of the following systems:
>>
>> Main PC - 192.168.23.11 (Running Debian Jessie)
>> Server - 192.168.23.200 (Running Debian Jessie)
>>
>> The server is always online, the PC is only half of the day on.
>>
>> What i want to do now is the following:
>>
>> Sending mail from my Main PC to my Server and also the other way around,
>> from the Server to my Main PC.
>> The Server should also be able to send mail to the "outside" (Meaning to
>> other SMTP servers).
>> The second requirement is optional since i dont own a domain and all this is
>> sitting locally at my home. The most important thing for me is to send and
>> receive mail from both systems in my home network.
>> I hope this made my problem a little clearer :)
>>
>
> Right. So you get mail going back and forth between your two machines,
> server and PC, by creating and populating the hubbed_hosts file I
> talked about in my previous mail, on both machines, pointing at each
> other of course.

I created the hubbed_hosts file under /etc/exim4 and it now works fine,
i can send mail from my server to my pc and vice versa :)

> If you want to ping the server from the client, you should be able to do
> "ping server.local" from your PC (obviously replace the actual name of
> your server, which you didn't include in your mail, where I put server).
> What is happening if you do that is your PC is saying "get me the
> address of server.local!" and the Avahi daemon on your PC either already
> knows that, or sends out a broadcast message to your network saying "is
> there a server.local in the house???". The Avahi daemon running on the
> server responds to that saying "yes, I'm here, and my IP address is
> 192.168.23.200!". The Avahi daemon on your PC responds to whatever did
> the asking (ping in this case) with the required IP. Ping then requests
> that packets be sent to IP address quoted. By this mechanism computers
> on the same LAN can communicate with each other peer to peer without
> fannying around with full-blown DNS, which is what Avahi is for. That is
> installed by the Jessie installer by default as far as I can tell, so
> both your machines should have it. It doesn't require any configuration,
> so if you haven't touched it, it should work as I have described.
> Although obviously, you have to substitute the real names for your
> server and PC (but you *do* require the .local unless you have configured
> Avahi to use something else)

I'm currently not using avahi as a matter of fact, but it works all fine
without it ;)
(I have static entries in the /etc/hosts file for my server and for the
pc - on each system of course)
I have never really worked with avahi... i kinda ask myself why do i
need it if i can just use DNS or static entries in /etc/hosts.
/etc/nsswitch.conf is also configured to lookup the /etc/hosts file first.
I know this question is OT, but since you mentioned avahi maybe i can
ask you what kind of benefits avahi can offer me? :)
(I'm having a statically configured network with 4 machines)

> If you used the default config of exim4 the hubbed_hosts router is set
> up and waiting to be used. All you need to do to enable it is to
> populate the hubbed_hosts file as I described. The other thing you need
> to do is follow Liam's advice, except importantly what needs to be set
> there is the "domain" of the local PC (on the local PC) or the server
> (on the server) only. So the PC will accept mail for pc.local (or
> whatever your pc is called) and the server for server.local (or whatever
> the server is called). Then, you will be able to email yourself at the
> server from the PC by sending a mail to m...@server.local, where I am
> assuming your user name on the server is mo and the server's machine
> name is server. Obviously you would substitute real names. And to go the
> other way, from the server, you could send a mail to yourself on the PC
> by mailing m...@pc.local.

I have asked that before i believe, sorry if this question shows up
twice.... But why do i even need to set up hubbed_hosts?
I don't really understand why... Should exim not consider the /etc/hosts
file to resolve the ip of my pc or server (Which i have entered there)
Also i have seen (before it worked) in the log that i get a "destination
unreachable"... I just don't understand why exim needs to rely on the
hubbed_hosts being set up?
(I hope you can understand what i mean, if not i will try my best to
make it clearer :D )
Very great and detailed explanation, thank you very much! :)

> Now, a word on exim4 config. Be sure to read the *DEBIAN* wiki etc on
> configuring exim4, as the DEBIAN config is a bit different to what you
> will find upstream. Let me save you a bit of time.
>
> First, there are two ways to configure exim4, using one big config file
> which is found in /var/lib/exim4, or using a config directory containing
> a bunch of small config files each handling one small piece of the
> configuration. Opinions abound on which is better, I have no opinion. By
> default, exim4 on Debian will use the single file approach. Second,
> Debian constructs the config file by using a TEMPLATE to be found in
> /etc/exim4, and a second configuration file called
> update-exim4.conf.conf (yes, the conf file for updating the conf
> file......) You put your specific config in the update-exim4.conf.conf
> file, then when you are done you run update-exim4.conf as root
> (update-exim4.conf is actually a program, not a conf file...
> update-exim4.conf.conf is a conf file...) and restart exim4. The
> update-exim4.conf program combines the template with the specific info
> in update-exim4.conf.conf and writes the result to
> /var/lib/exim4/config.autogenerated which is the config exim4 on Debian
> uses. This can also be done by running dpkg-reconfigure exim4.conf as
> Liam suggested, but I think there are more things you can do with
> update-exim4.conf.conf than the questions dpkg-reconfigure will ask you,
> so it wouldn't hurt to get familiar with what is going on under the hood
> when you do dpkg-reconfigure, but that's just my opinion.

That sure is nice to know, i will have a look at the wiki page ;)
(This saves me quite a lot of time :D Thx!)

> If you need more specific help on how to get your local exim4 talking to
> an external email provider, or for that matter if you need me to clarify
> anything about getting local machine to local machine email working,
> post back here.

As far as i understood it i need to set up exim as a smarthost of i want
to send mail of to other smtp servers, for example gmail.
I guess i will try that out as a next step, so i can send myself mail to
my gmail or gmx account.... Well, since you asked:
Is it enough to run 'dpkg-reconfigure exim4-config" and use the
smarthost option from the curses menu?

> Also, being able to receive replies to externally sent mails back into
> your machine locally, needs another bit of setup. If you need that, let
> us know and I'll help with that part too (it is where fetchmail comes
> in). But, there is nothing to stop you using whatever mail client you
> use today to read your email as you presumably do now, and you'll see
> the mails you sent locally there in your sent mail (depending on the
> precise behaviour of your provider's mail server)
>
> Hope that helped clarify things. Sorry for the length of this but
> someone has finally asked for help with something I know something
> about, and I'm keen to help! :)
>

Your explanations sure helped me a lot, i can see clearer now, thx for
that and of course for the long mail ;) Thx! :)

> Mark
>

Greets

mo

mo

unread,
Oct 1, 2016, 8:10:04โ€ฏAM10/1/16
to
I have colones in the hubbed_hosts file... seems to work.
I just tested it: It works with or without the colon. Maybe this is
interesting to know ;)

> Mark
>

Mark Fletcher

unread,
Oct 1, 2016, 8:10:04โ€ฏAM10/1/16
to
Watch out, you may piss off your ISP if you repeatedly send emails it
can't deliver. They'll make their displeasure felt by not delivering
_any_ mails for you for a while. My suggestion is get local delivery
working first, then turn attention to mails outside.

Mark

mo

unread,
Oct 1, 2016, 8:10:04โ€ฏAM10/1/16
to
Thanks for the hint Mark :)
So far i only tried it twice, i think i'm save for the moment. :D haha

> Mark
>

rhkr...@gmail.com

unread,
Oct 1, 2016, 8:20:04โ€ฏAM10/1/16
to
On Saturday, October 01, 2016 05:06:07 AM mo wrote:
> My network is consisting of the following systems:
>
> Main PC - 192.168.23.11 (Running Debian Jessie)
> Server - 192.168.23.200 (Running Debian Jessie)
>
> The server is always online, the PC is only half of the day on.
>
> What i want to do now is the following:
>
> Sending mail from my Main PC to my Server and also the other way around,
> from the Server to my Main PC.
> The Server should also be able to send mail to the "outside" (Meaning to
> other SMTP servers).
> The second requirement is optional since i dont own a domain and all
> this is sitting locally at my home. The most important thing for me is
> to send and receive mail from both systems in my home network.
> I hope this made my problem a little clearer :)
>
> I'm a little ashamed to say that, but i could not totally follow your
> explanations Mark... I'm quite a newbie when it comes to SMTP.. sorry :(
>
> Thanks again for all your help ;)

Here is how I do something similar (I don't need to get all emails to both
systems), and some other alternatives:

What I do now:

* On my main desktop (which I normally use to send and receive emails), I
use kmail, which I consider a "Windows style" email client (because I don't
know what else to call it--it sends email via SMTP and receives email via
POP3--it (the PC) doesn't use anything like an MTA (e.g., postfix)) and is set
to delete emails from the server).

My email provider / server is Google (which I don't really like because of the
insecurity, but I started using it a long time ago and haven't bothered to
switch)--for really confidential emails I use encryption).

On the other PC, which I use only rarely to receive or send emails, I use a
browser to access my google mail account. Even though I set kmail on the
other PC to delete emails from the server, google keeps them in the "all mail"
file for something like 30 days. (Aside: I forget how emails sent from the
second PC get to the first--I'll have to test that--they do seem to get there.)

Other alternatives:

* Use, for example, kmail on both PCs, but use something like rsync to keep
the mail folders in sync on both PCs.

* <darn--getting old is a pain--I thought of a second alternative--I'll
post again if I remember... ;-) >

Mark Fletcher

unread,
Oct 1, 2016, 8:30:04โ€ฏAM10/1/16
to
On Sat, Oct 01, 2016 at 12:36:10PM +0200, mo wrote:
>
> Did you follow a specific book or guide?

Google "debian exim4 configuration". And look at the upstream
documentation in package exim4-doc-html.

>
> >Exim configuration has the concept of "routers" and "transports".
> >Routers basically decide what to do with a message, and transports do
> >it. One of the routers configured by default in the Debian exim
> >configuration is for "hubbed hosts". What this means, is machines
> >capable of sending and receiving email ("hosts" in exim speak) that are
> >on the same LAN as this machine (connected by a "hub"). Note that this
> >"hub" could be your local home network router, and for these purposes
> >machines on WiFi and machines on a wired LAN would be considered on the
> >same hub, even though that isn't strictly true. The point is that
> >network packets can be addressed directly between the machines, they
> >don't require a router in between.
> >
>
> As far as i do understand this is that only machines which are defined as
> hubbed hosts can be send mail in the local LAN? Or am i misunderstanding
> something here? :)
>

In essence yes you are right, because a local configuration of exim4
would determine that the addresses are not local and not in
hubbed_hosts, and tell you to eff off, while a smarthost configuration
would attempt to use the smarthost to send to the local machine, which
is doomed to failure, and the internet configuration would attempt to
use DNS to find the local machine, which is also doomed to failure.
Being in hubbed_hosts prevents exim4 for going looking for an MX record
for the receiving host, which is guaranteed to fail for a machine that
isn't registered to the world at large as an email server.

> >In Debian, this is achieved with Avahi. This is what allows you, if you
> >have MachineA and MachineB on your network, to do for example "ping
> >MachineA.local" from MachineB and expect MachineA.local to be resolved
> >into an IP address.
> >
>
> I'm not a friend of avahi to be honest, i much rather ignore it :D

All I can do here is echo Brian. But also, even if you aren't its
friend, ignoring it is fine, because it comes already configured and
will just do its job whether it gets any love from you or not. I just
assumed you'd like to know what is going on under the hood.

>
> >In /etc/exim4, create a file owned by root called hubbed_hosts. In the
> >file, each line maps a "domain" (the part after the @ sign in an email
> >address) to a "host" (the name of a machine on your network, as it can
> >be reached from this machine). Put the domain first, then a tab
> >character (spaces may also be OK) and then the host. So for example I
> >have a machine on my network called affinity, and so in the hubbed_hosts
> >file on the machine I am sitting in front of now, I have two lines, one
> >saying "affinity.local<TAB>affinity.local", and the other saying
> >"affinity<TAB>affinity.local" (no quotes in the file). This tells the
> >local exim installation that any email address with @affinity.local as
> >the domain should be forwarded on to a machine called affinity.local,
> >and any mail with @affinity as the domain should be forwarded on to a
> >machine called affinity.local. Exim4 will then say "Connect to
> >affinity.local!" with no attempt to translate that into an IP address,
> >and Avahi daemon will answer "that is IP address WW.XX.YY.ZZ!" to which
> >exim will say "very well, connect to WW.XX.YY.ZZ!" and the exim4 on
> >affinity will wake up and co-operate to deliver the mail.
>
> I just did that and now mailing works flawlessly :D
> Just one questions: Why do i need hubbed_host entries? Should it not be fine
> alone to make a entry in /etc/hosts for the machines i want to send mail to
> (I do not operate a dedicated DNS server).
> This is something i dont really understand...

hubbed_host entries apply only to exim4. I also suspect, but am not
sure, that they are a Debian extension to exim4 in the sense that the
*DEBIAN* exim4 comes configured for them out of the box, while the
upstream exim4 does not. IIRC there is no reference to hubbed_hosts in
the upstream documentation, only in the Debian docs.

They work because the debian config contains a router to handle hubbed
hosts. You can see what it is doing if you search
/var/lib/exim4/config.autogenerated for the text hubbed_hosts.

If the file is not populated this router is skipped and then exim4
requires either that the address is the local machine, or that there is
a smarthost configured that it can delegate to, or that it can find an
official MX entry for the target domain by doing a DNS lookup. All of
which will fail for a local box that isn't registered to the world as a
mail server.

Mark

mo

unread,
Oct 1, 2016, 8:30:04โ€ฏAM10/1/16
to


Am 01.10.2016 um 14:20 schrieb Brian:
> Please see exim4-config_files(5).
>

Just looked into the man page, indeed a colon is required there. ;)

Brian

unread,
Oct 1, 2016, 8:30:04โ€ฏAM10/1/16
to
On Sat 01 Oct 2016 at 14:09:19 +0200, mo wrote:

Please see exim4-config_files(5).

--
Brian.

mo

unread,
Oct 1, 2016, 8:40:03โ€ฏAM10/1/16
to


Am 01.10.2016 um 14:23 schrieb Mark Fletcher:
> On Sat, Oct 01, 2016 at 12:36:10PM +0200, mo wrote:
>>
>> Did you follow a specific book or guide?
>
> Google "debian exim4 configuration". And look at the upstream
> documentation in package exim4-doc-html.
>

I will do so ;)

>>
>>> Exim configuration has the concept of "routers" and "transports".
>>> Routers basically decide what to do with a message, and transports do
>>> it. One of the routers configured by default in the Debian exim
>>> configuration is for "hubbed hosts". What this means, is machines
>>> capable of sending and receiving email ("hosts" in exim speak) that are
>>> on the same LAN as this machine (connected by a "hub"). Note that this
>>> "hub" could be your local home network router, and for these purposes
>>> machines on WiFi and machines on a wired LAN would be considered on the
>>> same hub, even though that isn't strictly true. The point is that
>>> network packets can be addressed directly between the machines, they
>>> don't require a router in between.
>>>
>>
>> As far as i do understand this is that only machines which are defined as
>> hubbed hosts can be send mail in the local LAN? Or am i misunderstanding
>> something here? :)
>>
>
> In essence yes you are right, because a local configuration of exim4
> would determine that the addresses are not local and not in
> hubbed_hosts, and tell you to eff off, while a smarthost configuration
> would attempt to use the smarthost to send to the local machine, which
> is doomed to failure, and the internet configuration would attempt to
> use DNS to find the local machine, which is also doomed to failure.
> Being in hubbed_hosts prevents exim4 for going looking for an MX record
> for the receiving host, which is guaranteed to fail for a machine that
> isn't registered to the world at large as an email server.
>

Alright, i finally go it ;) Thanks for the explanation Mark! :)

>>> In Debian, this is achieved with Avahi. This is what allows you, if you
>>> have MachineA and MachineB on your network, to do for example "ping
>>> MachineA.local" from MachineB and expect MachineA.local to be resolved
>>> into an IP address.
>>>
>>
>> I'm not a friend of avahi to be honest, i much rather ignore it :D
>
> All I can do here is echo Brian. But also, even if you aren't its
> friend, ignoring it is fine, because it comes already configured and
> will just do its job whether it gets any love from you or not. I just
> assumed you'd like to know what is going on under the hood.

I sure appreciate to know the inner workings of it all :)
Good to know how avahi is involved here, this paints me a clearer picture :)
I will consult the Debian docs, currently reading over the wiki page of
exim :)

> If the file is not populated this router is skipped and then exim4
> requires either that the address is the local machine, or that there is
> a smarthost configured that it can delegate to, or that it can find an
> official MX entry for the target domain by doing a DNS lookup. All of
> which will fail for a local box that isn't registered to the world as a
> mail server.

I see, thanks for the info :)

> Mark
>

Thanks again Mark ;)

Greets

mo

Brian

unread,
Oct 1, 2016, 9:00:08โ€ฏAM10/1/16
to
On Sat 01 Oct 2016 at 21:23:33 +0900, Mark Fletcher wrote:

> On Sat, Oct 01, 2016 at 12:36:10PM +0200, mo wrote:
> >
> > I just did that and now mailing works flawlessly :D
> > Just one questions: Why do i need hubbed_host entries? Should it not be fine
> > alone to make a entry in /etc/hosts for the machines i want to send mail to
> > (I do not operate a dedicated DNS server).
> > This is something i dont really understand...
>
> hubbed_host entries apply only to exim4. I also suspect, but am not
> sure, that they are a Debian extension to exim4 in the sense that the
> *DEBIAN* exim4 comes configured for them out of the box, while the
> upstream exim4 does not. IIRC there is no reference to hubbed_hosts in
> the upstream documentation, only in the Debian docs.

Correct. I'll add: the upstream documentation spec.txt.gz covers
hubbed_hosts in sections 20.3 to 20.7. It is not obligatory to read it.

> They work because the debian config contains a router to handle hubbed
> hosts. You can see what it is doing if you search
> /var/lib/exim4/config.autogenerated for the text hubbed_hosts.

Fine.

> If the file is not populated this router is skipped and then exim4
> requires either that the address is the local machine, or that there is
> a smarthost configured that it can delegate to, or that it can find an
> official MX entry for the target domain by doing a DNS lookup. All of
> which will fail for a local box that isn't registered to the world as a
> mail server.

The thing for Mo to grasp is that exim *always* does an MX lookup, often
using the ISP's DNS server. user@server will fail (as has been found
out) because the domain "server" is not in the DNS.

/etc/hosts is not consulted when the lookup is done. exim can be made to
look at /etc/hosts but for such a simple setup it is not worth the
effort and would likely lead to a world of pain.

--
Brian.

Mark Fletcher

unread,
Oct 1, 2016, 9:00:09โ€ฏAM10/1/16
to
On Sat, Oct 01, 2016 at 02:33:27PM +0200, mo wrote:
>
>
>
> I sure appreciate to know the inner workings of it all :)
> Good to know how avahi is involved here, this paints me a clearer picture :)
>

I just want to correct one thing I said here, having read your other
posts. In one of them you mentioned you have static routing mappings set
up for your network machines in /etc/hosts. That is a perfectly valid
setup, albeit it is not the default "Debian way" (by which I mean only
that it is not how Debian comes configured out of the box, or more
accurately out of the .iso) and not how I do it. What a pain if you buy
a new computer to add to your network! But absolutely nothing invalid
about it.

In this case, Avahi is probably *not* involved because exim4 gets an
answer to the question of what IP the host name maps to, without having
to consult it. But it *would be* involved if you did not have static
mappings set up in /etc/hosts.

Mark

Mark Fletcher

unread,
Oct 1, 2016, 9:00:09โ€ฏAM10/1/16
to
No, it isn't. I don't use colons in my hubbed_hosts file.

Mark

mo

unread,
Oct 1, 2016, 9:00:09โ€ฏAM10/1/16
to


Am 01.10.2016 um 14:51 schrieb Mark Fletcher:
> On Sat, Oct 01, 2016 at 02:33:27PM +0200, mo wrote:
>>
>>
>>
>> I sure appreciate to know the inner workings of it all :)
>> Good to know how avahi is involved here, this paints me a clearer picture :)
>>
>
> I just want to correct one thing I said here, having read your other
> posts. In one of them you mentioned you have static routing mappings set
> up for your network machines in /etc/hosts. That is a perfectly valid
> setup, albeit it is not the default "Debian way" (by which I mean only
> that it is not how Debian comes configured out of the box, or more
> accurately out of the .iso) and not how I do it. What a pain if you buy
> a new computer to add to your network! But absolutely nothing invalid
> about it.

Well i'm using the static network config since quite some time, but i
had planned to change over to DHCP... But for now it works ;)
(The work is not so hard, adding a machine to the network is done
quickly with Debian ;) - My other machines use different Operating
Systems, got FreeBSD and OpenBSD here to on the LAN, works like a charm :) )

> In this case, Avahi is probably *not* involved because exim4 gets an
> answer to the question of what IP the host name maps to, without having
> to consult it. But it *would be* involved if you did not have static
> mappings set up in /etc/hosts.

Good to know ;)

> Mark
>

Thanks Mark ;)

Greets

mo

mo

unread,
Oct 1, 2016, 9:10:03โ€ฏAM10/1/16
to
just out of curiosity:
What did i have to do to make exim honor the /etc/hosts file? :)
(I quite often find myself in the world of pain :D )

Greets

mo

mo

unread,
Oct 1, 2016, 9:10:03โ€ฏAM10/1/16
to
Both works actually. I Just tried it. But the man pages uses colons..
seems like it works fine with or without ;)

> Mark
>

Greets

mo

Mark Fletcher

unread,
Oct 1, 2016, 9:40:04โ€ฏAM10/1/16
to
On Sat, Oct 01, 2016 at 01:56:40PM +0100, Brian wrote:

> The thing for Mo to grasp is that exim *always* does an MX lookup, often
> using the ISP's DNS server. user@server will fail (as has been found
> out) because the domain "server" is not in the DNS.
>
> /etc/hosts is not consulted when the lookup is done. exim can be made to
> look at /etc/hosts but for such a simple setup it is not worth the
> effort and would likely lead to a world of pain.
>

With great respect I think that confuses the issue. A DNS lookup will
*not* explicitly get done by exim4 if the target domain is in
hubbed_hosts, or if exim4 has been told it is the local domain. The
point is one wishes to PREVENT a DNS lookup that is doomed to fail, and
one does so for machines that are not the machine-local domain by
putting them in hubbed_hosts, which will cause exim4 to throw out a
connection request for the local network infrastructure (starting with
the network infra on the local machine) to handle, without doing an
explicit DNS lookup. That is handled by /etc/hosts if it is populated,
and by Avahi if it is present and /etc/hosts is not populated, and no
doubt by a few other alternatives I am not familiar with as well. If
none of them succeed, the delivery will fail, because if I recall
correctly hubbed_hosts router config ends with no_more which prevents
other routers having a go.

However, for domains NOT listed in hubbed_hosts, if not in smarthost
mode, yes exim4's next move will be an explicit DNS lookup on the
domain. It is trying to find out what *machine* it should contact to
make the delivery to that domain. If it is in smarthost mode, it throws
its hands in the air and passes the problem to the smarthost to solve.

Mark

Teemu Likonen

unread,
Oct 1, 2016, 10:00:04โ€ฏAM10/1/16
to
mo [2016-10-01 12:36:10+02] wrote:

> I'm not a friend of avahi to be honest, i much rather ignore it :D

Avahi is great. My ethernet-connected printer uses DHCP to get IP
address and network configuration. The printer announces itself to the
network with <mac-address>.local name so a print server can use that
name to connect to it. CUPS print server also announces its printers by
names. No static IP address configuration needed anywhere. I think the
underlying technique is called multicast DNS.

--
/// Teemu Likonen - .-.. <https://github.com/tlikonen> //
// PGP: 4E10 55DC 84E9 DFF6 13D7 8557 719D 69D3 2453 9450 ///
signature.asc

mo

unread,
Oct 1, 2016, 10:20:04โ€ฏAM10/1/16
to


Am 01.10.2016 um 15:57 schrieb Teemu Likonen:
> mo [2016-10-01 12:36:10+02] wrote:
>
>> I'm not a friend of avahi to be honest, i much rather ignore it :D
>
> Avahi is great. My ethernet-connected printer uses DHCP to get IP
> address and network configuration. The printer announces itself to the
> network with <mac-address>.local name so a print server can use that
> name to connect to it. CUPS print server also announces its printers by
> names. No static IP address configuration needed anywhere. I think the
> underlying technique is called multicast DNS.
>

I guess i should be looking into avahi, never really did that, to be
honest avahi so far did not really made much sense to me with my static
network... But one can never learn enough ;)

Greets

mo

mo

unread,
Oct 1, 2016, 10:20:04โ€ฏAM10/1/16
to
Oh yes, i see. Indeed i can understand your point!
Thanks for the explanation ;)
My picture of exim is getting better and better :)

> Mark
>

Greets

mo

mo

unread,
Oct 1, 2016, 10:30:04โ€ฏAM10/1/16
to


Am 01.10.2016 um 16:17 schrieb rhkr...@gmail.com:
> On Saturday, October 01, 2016 08:23:10 AM mo wrote:
>> I use Icedove (Thunderbird) for all my personal mails and also to write
>> mail to the Debian users Mailing list ;)
>> I have never tried Kmail before, maybe i should, but Icedove fit's the
>> bill right :) (I'm normally a wm guy.. so i opt for lesser dependencies
>> when i install software... (Kmail pulls in a lot of KDE stuff that i
>> don't want) but atm i use Gnome.. well it works :D )
>> I will give Kmail a try on one of my vm's (Got Debian Jessie here in a
>> vm on which i have KDE installed)
>
> AFAIK, Icedove is the same kind of email client as kmail, so there is no need
> to try kmail. (I happen to use (or, at least, used to use) a lot of other KDE
> stuff, do using kmail was no burden for me.) (I mean that Icedove uses (or at
> least can use) pop3 to get emails and smtp to send emails--otoh, I have never
> used Icedove, so I'm not absolutely sure.

Indeed, they are both MUA's with quite the same features (Of course the
GUI is different - also another gui toolkit, qt - icedove uses gtk)
Yes, that is true, icedove can handle POP and IMAP

> regards,
> Randy Kramer
>

Greets

mo

Brian

unread,
Oct 1, 2016, 10:40:04โ€ฏAM10/1/16
to
On Sat 01 Oct 2016 at 22:36:09 +0900, Mark Fletcher wrote:

> On Sat, Oct 01, 2016 at 01:56:40PM +0100, Brian wrote:
>
> > The thing for Mo to grasp is that exim *always* does an MX lookup, often
> > using the ISP's DNS server. user@server will fail (as has been found
> > out) because the domain "server" is not in the DNS.
> >
> > /etc/hosts is not consulted when the lookup is done. exim can be made to
> > look at /etc/hosts but for such a simple setup it is not worth the
> > effort and would likely lead to a world of pain.
> >

I hope we are not talking at cross-purposes. I was explicitly addressing
the issue of why an entry in /etc/hosts for machines on the network will
not replace a hubbed_hosts file.

> With great respect I think that confuses the issue. A DNS lookup will
> *not* explicitly get done by exim4 if the target domain is in
> hubbed_hosts, or if exim4 has been told it is the local domain. The

A hubbed_hosts file is for overriding or augmenting MX information from
the DNS (exim4-config_files). If you had

lists.debian.org: 91.221.168.152

the DNS would not be used and any mail to debia...@lists.debian.org
would go to 91.221.168.152. MX information would be overriden.

With

server: 192.168.5.100 or server: server.local

MX information is augmented.

> point is one wishes to PREVENT a DNS lookup that is doomed to fail, and

No. The point is you want to override or augment MX information. Ok, a
DNS lookup is prevented but it is not because it is one which is doomed
to fail. A lookup on lists.debian.org would succeed but for some reason
the user wants the mail to go to 91.221.168.152.

> one does so for machines that are not the machine-local domain by
> putting them in hubbed_hosts, which will cause exim4 to throw out a
> connection request for the local network infrastructure (starting with
> the network infra on the local machine) to handle, without doing an
> explicit DNS lookup. That is handled by /etc/hosts if it is populated,
> and by Avahi if it is present and /etc/hosts is not populated, and no
> doubt by a few other alternatives I am not familiar with as well. If
> none of them succeed, the delivery will fail, because if I recall
> correctly hubbed_hosts router config ends with no_more which prevents
> other routers having a go.

exim does not use /etc/hosts; user@server will fail with '192.168.7.88
server' in it. user@server,local succeeds because server.local is in the
DNS.

--
Brian.

Liam O'Toole

unread,
Oct 1, 2016, 12:30:04โ€ฏPM10/1/16
to
On 2016-10-01, mo <mo...@gmx.net> wrote:
> First of all:
> Thank you Liam for your help! :)
> Thanks for the very nice and long explanation Mark! :)
>
> I think i should elaborate a little more on my setup.. i guess i did not
> make that very clear in the first place, sorry about that.
>
> My network is consisting of the following systems:
>
> Main PC - 192.168.23.11 (Running Debian Jessie)
> Server - 192.168.23.200 (Running Debian Jessie)
>
> The server is always online, the PC is only half of the day on.
>
> What i want to do now is the following:
>
> Sending mail from my Main PC to my Server and also the other way around,
> from the Server to my Main PC.
> The Server should also be able to send mail to the "outside" (Meaning to
> other SMTP servers).
> The second requirement is optional since i dont own a domain and all
> this is sitting locally at my home. The most important thing for me is
> to send and receive mail from both systems in my home network.
> I hope this made my problem a little clearer :)
>
> I'm a little ashamed to say that, but i could not totally follow your
> explanations Mark... I'm quite a newbie when it comes to SMTP.. sorry :(
>
> Thanks again for all your help ;)
>
> Greets
>
> mo
>
>

I should have been a little clearer myself. You don't need to register a
domain name. Just invent your own domain name for local purposes. Let's
say you choose the domain name "monet", and that you have already given
the hostnames "desktop" and "server" to your two machines. Then you
would edit the file /etc/hosts on both machines to contain the following
lines:

192.168.23.11 desktop.monet desktop
192.168.23.200 server.monet server

Now you only need to tell exim4 on the server that it is the final
destination for emails to *.monet, again using the debconf wizard. You
will then be able to send emails to local addresses, while emails to all
other domains will go through your ISP's smarthost.

Incidently, you can also tell exim4 on the desktop to use the server as
its smarthost.

I realise that you're getting lots of (sometimes contradictory)
information from various sources. The barebones configuration I have
described above has served me well for several years.

If you add more machines to your network later on you should consider
setting up local DHCP and DNS instead of manually updating /etc/hosts
files. But we'll leave that for another day. :)

--

Liam

Brian

unread,
Oct 1, 2016, 2:20:04โ€ฏPM10/1/16
to
I did that on gnome and desktop with appropriate changes:

192.168.7.20 desktop.monet desktop
192.168.7.67 gnome.monet gnome

> Now you only need to tell exim4 on the server that it is the final
> destination for emails to *.monet, again using the debconf wizard. You
> will then be able to send emails to local addresses, while emails to all
> other domains will go through your ISP's smarthost.

I did that on gnome and desktop.

> Incidently, you can also tell exim4 on the desktop to use the server as
> its smarthost.
>
> I realise that you're getting lots of (sometimes contradictory)
> information from various sources. The barebones configuration I have
> described above has served me well for several years.

All commands are issued from gnome.

brian@gnome:~# ping -c3 desktop
PING desktop.monet (192.168.7.20) 56(84) bytes of data.
64 bytes from desktop.monet (192.168.7.20): icmp_seq=1 ttl=64 time=0.267 ms
64 bytes from desktop.monet (192.168.7.20): icmp_seq=2 ttl=64 time=0.255 ms
64 bytes from desktop.monet (192.168.7.20): icmp_seq=3 ttl=64 time=0.269 ms

--- desktop.monet ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.255/0.263/0.269/0.019 ms

brian@gnome:~# ping -c3 desktop.monet
PING desktop.monet (192.168.7.20) 56(84) bytes of data.
64 bytes from desktop.monet (192.168.7.20): icmp_seq=1 ttl=64 time=0.264 ms
64 bytes from desktop.monet (192.168.7.20): icmp_seq=2 ttl=64 time=0.255 ms
64 bytes from desktop.monet (192.168.7.20): icmp_seq=3 ttl=64 time=0.255 ms

--- desktop.monet ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 0.255/0.258/0.264/0.004 ms

We expect that result because ping uses files in /etc/nsswitch.

root@gnome:~# exim -bt brian@desktop
R: dnslookup for brian@desktop
brian@desktop is undeliverable: Unrouteable address

root@gnome:~# exim -bt br...@desktop.monet
R: dnslookup for br...@desktop.monet
br...@desktop.monet is undeliverable: Unrouteable address

Am I the only one who gets this? No capability to deliver mail to
desktop. What am I doing wrong?

--
Brian.

mo

unread,
Oct 1, 2016, 4:50:03โ€ฏPM10/1/16
to
Thanks for the clarification Liam :)

> If you add more machines to your network later on you should consider
> setting up local DHCP and DNS instead of manually updating /etc/hosts
> files. But we'll leave that for another day. :)

I think that day will soon come for me :) (I cant live without some
playing and fuzzing around :^) )

mo

unread,
Oct 1, 2016, 4:50:03โ€ฏPM10/1/16
to
I think this is the problem with exim calling DNS on the given
hostname... which is doomed to fail. To get it working you need to
create the hubbed_hosts file and set your aliases in there, for example:
192.168.7.20: desktop

Then it should work fine, at least for me it did.

Hope this helps :)

Liam O'Toole

unread,
Oct 1, 2016, 5:10:04โ€ฏPM10/1/16
to
exim seems to be trying to resolve desktop.monet via DNS, thus ignoring
/etc/nsswitch. (I have no idea whether that is the default behaviour.) Do
you have a local DNS capable of resolving the address?

You might try the mail command from the mailutils or bsd-mailx packages
for comparison.

--

Liam

Brian

unread,
Oct 1, 2016, 6:30:04โ€ฏPM10/1/16
to
Not really, I'm afraid.

We all know a hubbed_hosts file works. Mark Fletcher has written
extensively about it and I have said a thing or too also. What I want to
know is why following the advice from Liam O'Toole doesn't work for me,
even though I have followed the instructions exactly.

BTW: It would be 'desktop: 192.168.7.20' and 'desktop.monet:192.168.7.20'
in hubbed_hosts.

--
Brian.

Brian

unread,
Oct 1, 2016, 6:40:04โ€ฏPM10/1/16
to
Exim's default behaviour, as has been mentioned a couple of times in
this thread, is to use DNS; nsswitch is not involved. This is a default
exim install; no files in conf.d altered. How about you?

> You might try the mail command from the mailutils or bsd-mailx packages
> for comparison.

mail uses exim as the MTA. It is hardly likely to work.

--
Brian.

Liam O'Toole

unread,
Oct 1, 2016, 8:10:03โ€ฏPM10/1/16
to
Doing an strace on the exim command shows that /etc/nsswitch is
consulted first, then /etc/resolv.conf (followed by a DNS lookup of the
smarthost).

> This is a default
> exim install; no files in conf.d altered. How about you?

No alterations I can remember, and 'dpkg --verify' reports no changes to
exim4-related files. All customisations have been done via debconf. I am
reluctant to divulge those customisations here, but I can tell you that
the settings are not particularly exotic. One host on the local network
is configured to use my ISP's SMTP server as its smarthost, while the
other hosts in turn use the former as their smarthost.

>> You might try the mail command from the mailutils or bsd-mailx packages
>> for comparison.
>
> mail uses exim as the MTA. It is hardly likely to work.
>

Indeed. Please strike my suggestion from the record, m'lud. I
misunderstood the meaning of the '-bt' switch you quoted above.

--

Liam

Mark Fletcher

unread,
Oct 1, 2016, 8:30:03โ€ฏPM10/1/16
to
On Sat, Oct 01, 2016 at 11:22:06PM +0100, Brian wrote:
>
> We all know a hubbed_hosts file works. Mark Fletcher has written
> extensively about it and I have said a thing or too also. What I want to
> know is why following the advice from Liam O'Toole doesn't work for me,
> even though I have followed the instructions exactly.
>

I think Liam is describing a situation where the only mail-capable
machine is the server, in your example gnome.monet. He configured it to
be the end-point for *.monet. But for mo's original use-case, gnome
should only be the end-point for gnome.monet and desktop should be the
end-point for desktop.monet. Then, if gnome.monet gets handed a mail for
desktop.monet, it doesn't try to deliver it, but instead tries to pass
it on, and that's when you need hubbed_hosts populated so it can find
desktop.monet to pass it on to.

So Liam has consistently been describing a solution that, while
perfectly valid, is the solution to a slightly different problem than
the one mo originally asked about.

Mark

mo

unread,
Oct 2, 2016, 4:50:03โ€ฏAM10/2/16
to
Ah yeah, right, i mixed the syntax up, sorry about that.

Liam O'Toole

unread,
Oct 2, 2016, 7:10:04โ€ฏAM10/2/16
to
My setup is more or less as you describe. The only difference is that
all machines are mail capable and use the local server as their
smarthost, while the server in turn uses an external smarthost.

Brian seems to be experiencing a more fundamental issue, where exim
refuses to resolve domain names in the expected manner. That one has me
stumped.

--

Liam

Brian

unread,
Oct 2, 2016, 8:00:04โ€ฏAM10/2/16
to
[Some snipping. Not too much, I hope].

On Sun 02 Oct 2016 at 01:05:20 +0100, Liam O'Toole wrote:

> On 2016-10-01, Brian <ad...@cityscape.co.uk> wrote:
> >
> > Exim's default behaviour, as has been mentioned a couple of times in
> > this thread, is to use DNS; nsswitch is not involved.
>
> Doing an strace on the exim command shows that /etc/nsswitch is
> consulted first, then /etc/resolv.conf (followed by a DNS lookup of the
> smarthost).

This is what I cannot get round. I'm prepared to accept that my
understanding may be defective but when I see "driver = dnslookup" in
router/200_exim4-config_primary it fits what I observe. Which is why I
use a hubbed_hosts file to manually route mail to machines on the LAN.

> > This is a default
> > exim install; no files in conf.d altered. How about you?
>
> No alterations I can remember, and 'dpkg --verify' reports no changes to
> exim4-related files. All customisations have been done via debconf. I am
> reluctant to divulge those customisations here, but I can tell you that
> the settings are not particularly exotic. One host on the local network
> is configured to use my ISP's SMTP server as its smarthost, while the
> other hosts in turn use the former as their smarthost.

I have the same setup and all customisations (apart from hubbed_hosts)
have been done via debconf. TBH, I cannot see why /etc/hosts should be
consulted because I thought there is first a check for an MX record and
then an attempt to resolve the host *using the DNS* if there was none.

Your instructions are clear so I can continue to try more customising
via debconf.

mo appears to have had no more success than I have. Don't know about
Mark.

--
Brian

Mark Fletcher

unread,
Oct 2, 2016, 8:50:04โ€ฏAM10/2/16
to
That's twice you've mentioned conf.d now, bear in mind in a
defaults-accepting Debian installation of exim4, it's not used.

Mark

Gene Heskett

unread,
Oct 2, 2016, 9:20:04โ€ฏAM10/2/16
to
Uuh, Mark, here on an up to date wheezy install, with exim4's default
config untouched, it does indeed exist, as /etc/exim4/conf.d, and its
populated with quite a few subdirs.
=========
gene@coyote:~$ ls -l /etc/exim4/conf.d
total 28
drwxr-xr-x 2 root root 4096 Apr 4 21:35 acl
drwxr-xr-x 2 root root 4096 Apr 4 21:35 auth
drwxr-xr-x 2 root root 4096 Apr 4 21:35 main
drwxr-xr-x 2 root root 4096 Apr 4 21:35 retry
drwxr-xr-x 2 root root 4096 Apr 4 21:35 rewrite
drwxr-xr-x 2 root root 4096 Apr 4 21:35 router
drwxr-xr-x 2 root root 4096 Apr 4 21:35 transport
==========
Based on the dates, I have to assume exim4 was pulled in as a dependency
of something else I installed recently since this wheezy install is
around 2 years old now. It's installation did not effect how my machine
runs that I am aware of. According to htop, no daemon of that name is
currently running.

Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>

Brian

unread,
Oct 2, 2016, 9:40:03โ€ฏAM10/2/16
to
It shouldn't make any difference whether the split configuration is used
or not for what we are doing.

A defaults-accepting installation would use "local delivery only; not on
a network". Obviously this would not suit testing mail delivery to other
machines on the LAN. It was at this first page I made my mistake!

I chose "Internet site......" because that is the way I always send
mail. No wonder I got "Unrouteable address". Was it clear that I should
have used "mail sent by smarthost......" (Liam?)?. Mystery solved. I've
not tested extensively but I can get mail to go to a user on another
machine.

I'm not enamoured of this technique because it does not suit my mail
setup. So I will stick with the more versatile hubbed_hosts.

Thanks for all the clues.

--
Brian.

Mark Fletcher

unread,
Oct 2, 2016, 9:50:04โ€ฏAM10/2/16
to
Yup, here too. But it is not being used.

Mark

Liam O'Toole

unread,
Oct 2, 2016, 11:30:04โ€ฏAM10/2/16
to
ยง2.1 of /usr/share/doc/exim4-base/README.Debian.html (from exim4-base)
provides some assistance.

>
> I'm not enamoured of this technique because it does not suit my mail
> setup. So I will stick with the more versatile hubbed_hosts.
>
> Thanks for all the clues.
>

At least your curiosity has been satisfied. :)

--

Liam
0 new messages