[Dnsmasq-discuss] REQ: Clarification

Simon Kelley simon at thekelleys.org.uk
Thu Aug 25 17:00:20 BST 2005


gypsy wrote:
> Simon,
> 
> I have read the man page but I still need assistance.  Because dnsmasq
> cannot reload the cache from a dump, this must be perfect before I stop
> and restart dnsmasq, else I will again have Email messages backed up for
> hours (a few deferred 4 days last time!) while the cache rebuilds.
> 
> I need MX.  In dnsmasq.conf there are 4 lines; which do I set, please?
> mx-host
> (What is the meaning of	"mx_name[, hostname][, preference#]"?  Do I need
> to set mx-host?)
> mx-target
> (mx-target seems inappropriate, if I read the man page correctly.)
> selfmx
> (???)
> localmx
> (???)
> 
> Here is the scenario:
> eth1 EXTERNAL IP	FQDN		INTERNAL IP eth0
> 66.209.101.194  yesican.chsoft.biz	192.168.1.1
> 66.209.101.195  news.chsoft.biz		192.168.1.205
> 
> When "news" emails to "yesican", I need for dnsmasq to return
> 192.168.1.1 to the MX request.  (? and the A request if there will be
> one, and to return 1.1.168.192.in-addr.arpa to the PTR request if there
> is one of those ?)
> 
> WBTH (What Bad Thing Happens):
> The present configuration causes this
> Aug 24 02:05:05 YesICan dnsmasq[123]: query[MX] yesican.chsoft.biz from
> 192.168.1.205
> Aug 24 02:05:05 YesICan dnsmasq[123]: forwarded yesican.chsoft.biz to
> 207.178.128.21
> --->>>^^^ This should not be forwarded! ^^^<<<---
> Aug 24 02:05:05 YesICan dnsmasq[123]: query[A] yesican.chsoft.biz from
> 192.168.1.205
> Aug 24 02:05:05 YesICan dnsmasq[123]: /etc/hosts yesican.chsoft.biz is
> 66.209.101.194
> Aug 24 02:05:05 YesICan dnsmasq[123]: query[PTR]
> 195.101.209.66.in-addr.arpa from 127.0.0.1
> Aug 24 02:05:05 YesICan dnsmasq[123]: cached 66.209.101.195 is
> 66-209-101-195.skyriver.net
> Aug 24 02:05:05 YesICan dnsmasq[123]: query[A]
> 66-209-101-195.skyriver.net from 127.0.0.1
> Aug 24 02:05:05 YesICan dnsmasq[123]: forwarded
> 66-209-101-195.skyriver.net to 207.178.128.21
> Aug 24 02:05:05 YesICan dnsmasq[123]: reply 66-209-101-195.skyriver.net
> is <NXDOMAIN>-IPv4
> Aug 24 02:05:05 YesICan dnsmasq[123]: query[A]
> 66-209-101-195.skyriver.net.chsoft.biz from 127.0.0.1
> Aug 24 02:05:05 YesICan dnsmasq[123]: forwarded
> 66-209-101-195.skyriver.net.chsoft.biz to 207.178.128.21
> Aug 24 02:05:05 YesICan dnsmasq[123]: reply
> 66-209-101-195.skyriver.net.chsoft.biz is <NXDOMAIN>-IPv4
> 
> More generally, any MX request from an internal machine should return
> the internal IP of the specified computer.
> 
> dnsmasq version 2.22 running on Slackware Linux version 10.0.
> 
> 1) Your explanations in this mailing list are clear; please add some
> (more) explanatory text to the man page so it too is clear.  An example
> in the config file would be a huge help as a supplement to the man page.
> 2) Please supply an external program to reload the cache from a SIGUSR1
> dump for those of us who are in serious need of an equivalent to
> dnscache's SlurpCache feature.  If I had this, I could take the time to
> work out the answer to my question for myself.  I realize that the load
> on my setup exceeds the "light weight" in the description of dnsmasq,
> but except for this single lack, dnsmasq is ideal.


First, MX. You seem to believe that the result of an MX lookup is an IP 
address; this is wrong. An MX lookup returns a domain name. A mailer 
then has to do a A record lookup on that domain name to get to the IP 
address it needs to talk to.

Actually an MX lookup returns a set of domain names, each of which has a 
preference. A mailer will try each of the result in turn, in reverse 
order of preference.

So for example.

scratchy:/usr/src/modules# dig mx thekelleys.org.uk

; <<>> DiG 9.3.1 <<>> mx thekelleys.org.uk
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8732
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 5, ADDITIONAL: 5

;; QUESTION SECTION:
;thekelleys.org.uk.             IN      MX

;; ANSWER SECTION:
thekelleys.org.uk.      43200   IN      MX      30 eyas.biff.org.uk.
thekelleys.org.uk.      43200   IN      MX      5 thekelleys.org.uk.

A mailer would first attempt to deliver mail to 
someone at thekelleys.org.uk to the machine called thekelleys.org.uk but it 
will need another A record lookup to do that.

scratchy:/usr/src/modules# dig thekelleys.org.uk

; <<>> DiG 9.3.1 <<>> thekelleys.org.uk
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15618
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 4

;; QUESTION SECTION:
;thekelleys.org.uk.             IN      A

;; ANSWER SECTION:
thekelleys.org.uk.      60      IN      A       81.108.205.124

If that fails, then the mail will go to the backup, eyas.biff.org.uk 
(after another DNS A record lookup to get the Ip address of that host.

The fields in mx-host are just these: so to get the MX records above, do

mx-host=thekelleys.org.uk,thekelleys.org.uk,5
mx-host=thekelleys.org.uk,eyas.biff.org.uk,30

 > More generally, any MX request from an internal machine should return
 > the internal IP of the specified computer.

That's not clear, but assuming you want an MX record which sends mail 
addresses to each internal machine to itself, rather than a smarthost, 
then just

selfmx

will do. That returns an MX record for each internal machine, pointing 
to itself, with priority 1, so it's equivalent to doing

mx-host=hostname,hostname,1

for all hosts in /etc/hosts and named via DNS.

Second, Slurpcache. I'm sorry, but I don't understand how that would 
help. Can you tell me?


Cheers,

Simon.



More information about the Dnsmasq-discuss mailing list