Re: [Exim] Need Exim to ask hosts file before asking my DNS

Top Page
Delete this message
Reply to this message
Author: Sherif Mohamad
Date:  
To: exim-users
CC: ph10
Subject: Re: [Exim] Need Exim to ask hosts file before asking my DNS
> > Unfortunatly this didn't work:
> >
> > mydnslookup:
> > driver = manualroute
> > route_list = * $0/MX byname;
> >
> > I wanted Exim to get the hostname from /etc/hosts not directly from the

DNS
> > because I have about 800 domains behind a firewall, I do not want to put

all
> > their names in the config of Exim.
> > $0 should be the domain name, $0/MX should mean the host that is

configured
> > in the DNS as MX of that domain, and byname means ask the local system

(to
> > look at /etc/hosts) to get the IP of that host not direct to the DNS.
> >
>
> 1. Have you tried $domain instead of $0? (Just in case $0 is broken.)


I tried $domain and it seems the same result.

>
> 2. "byname" causes Exim to call "gethostbyname". Whether that looks at

your
> /etc/hosts or the DNS or both depends on your nsswitch.conf settings.


I think that my nmswitch.conf is ok, I think so because when I try ping -s
my-other-host, it resolves from /etc/hosts and ping correctly, and does not
try to ping the external IP.

>
> 3. Have you tried running a routing test using -bt -d to get debugging
> output to see what Exim is actually doing?


I tried it now after your advise, yes it show it is trying to the real IP
not the virtual one (behind the firewall), it used gethostbyname to get the
MX of the domain, so it got the host name, but when trying to get the IP of
that hostname, it used the DNS again !!

> sherifd30@???
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Testing sherifd30@???
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Considering sherifd30@???
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

routing sherifd30@???
--------> mydnslookup router <--------
local_part=sherifd30 domain=menanet.net
calling mydnslookup router
mydnslookup router called for sherifd30@???
  domain = menanet.net
route_item = * $domain/MX byname
menanet.net in "*"? yes (matched "*")
original hostlist=$domain/MX options=byname
expanded hostlist="menanet.net/MX" options=byname
set transport remote_smtp
finding IP address for menanet.net/MX
doing DNS MX lookup for menanet.net/MX
DNS lookup of menanet.net (MX) succeeded
DNS lookup of mnaccounts.menanet.net (A) succeeded
host_find_bydns yield = HOST_FOUND (2); returned hosts:
  npopd.menanet.net 217.29.134.4 MX=5
  menasmtp.menanet.net 217.29.134.12 MX=10
queued for remote_smtp transport: local_part = sherifd30
domain = menanet.net
  errors_to=NULL
  domain_data=NULL localpart_data=NULL
routed by mydnslookup router
  envelope to: sherifd30@???
  transport: remote_smtp
  host npopd.menanet.net [217.29.134.4] MX=5
  host menasmtp.menanet.net [217.29.134.12] MX=10
sherifd30@???
  router = mydnslookup, transport = remote_smtp
  host npopd.menanet.net    [217.29.134.4]  MX=5
  host menasmtp.menanet.net [217.29.134.12] MX=10