using an ip in an MX record

James A Griffin agriffin at cpcug.org
Thu Aug 9 13:30:27 UTC 2001


Leon Harris wrote:
> 
> Hi James,
> not really incredible at all.
> 1)Cricket examples for MX records all use host names.

And why would Cricket provide anything but correct examples?  Read the
specification for MX RRs on page 533 (4th edition) or read RFC1035, page
17, part of which is quoted below:

3.3.9. MX RDATA format
 
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                  PREFERENCE                   |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    /                   EXCHANGE                    /
    /                                               /
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 
where:
 
PREFERENCE      A 16 bit integer which specifies the preference given to
                this RR among others at the same owner.  Lower values
                are preferred.
 
EXCHANGE        A <domain-name> which specifies a host willing to act as
                a mail exchange for the owner name.
 
MX records cause type A additional section processing for the host
specified by EXCHANGE.  The use of MX RRs is explained in detail in
[RFC-974].

> 2)Using a bare ip works - in that mail is sent to the appropriate host,
> but with a whole lot of lame server errors in the logs.

It only seems to work because of other fallback operations of sendmail. 
Try doing the following:

dig +norec @your.name.server. your.domain. mx

If your MX record has RDATA xxx.xxx.xxx.xxx. (as shown in your original
post) you will get something like this:
; <<>> DiG 9.1.1 <<>> +norec @sparta.athena.inc. badmail.athena.inc. mx;
[snip]
;; ANSWER SECTION:
badmail.athena.inc.     86400   IN      MX      5 234.123.234.123.
[snip]

If you try to add an A RR (e.g. 234.123.234.123. IN A 192.168.1.1) and
reload the zone, you will get an "out of zone" error message and the RR
will be ignored.

If you add an MX record like:
your.domain. IN MX 5 123.234.123.234
BIND will interperate it as:
your.domain. IN MX 5 123.234.123.234.your.domain.

Now you can add an A RR like:
123.234.123.234 IN A IP.addr.of.mailserver

And now 'dig' returns:
; <<>> DiG 9.1.1 <<>> +norec @sparta.athena.inc. badmail.athena.inc. mx
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 30438
;; flags: qr aa ra; QUERY: 1, ANSWER: 2, AUTHORITY: 3, ADDITIONAL: 4

;; QUESTION SECTION:
;badmail.athena.inc.            IN      MX
 
;; ANSWER SECTION:
badmail.athena.inc.     86400   IN      MX      5 234.123.234.123.
badmail.athena.inc.     86400   IN      MX      5
123.234.123.234.athena.inc.
 
;; AUTHORITY SECTION:
athena.inc.             86400   IN      NS      minerva.athena.inc.
athena.inc.             86400   IN      NS      sparta.athena.inc.
athena.inc.             86400   IN      NS      corinth.athena.inc.
 
;; ADDITIONAL SECTION:
123.234.123.234.athena.inc. 86400 IN    A       192.168.1.14
sparta.athena.inc.      86400   IN      A       192.168.1.8
corinth.athena.inc.     86400   IN      A       192.168.1.3
minerva.athena.inc.     86400   IN      A       192.168.1.14

Note the inclusion of the A RR in the Additional section (as per the
RFC).

But if your assumption about your ISP is correct, then this scheme of
using what is just an "odd" host name for the RDATA of an MX RR will
fail too.

> 3)It doesn't work if I use a fqdn for the host that is running the mail
> server. I think this has to do with the service providers policy of
> routing all mail for boxen in his domain through one mail exchanger.

Assuming you are correct about your ISP, this is a different issue, and
not one with BIND.

> Don't know how this is done, I just know that when I use the IP it
> works, and when I use the fqdn it doesn't.
> 

When you specified the FQDN, did you put a period '.' at the end?  If
not then your RDATA was interperted as something like
"mail.your.domain.your.domain."  

> My question still stands: is there anything (eg some other glue records)
> which I can use to allow an ip to be used in a mx record.

I think your question has be answered, but let me summarize, "no".

Jim

> 
> Thanks,
> Leon
> 
> btw this is bind 8
> 
> James A Griffin wrote:
> 
> > Leon wrote:
> > >
> > > Hi.
> > > I recently set up an MX record for an unnamed windows box which was
> > > running exchange.
> > >
> > > something like
> > >
> > > domain  IN               MX      10 xxx.xxx.xxx.xxx.
> > -----you need to put a host name here ^^^^^^^^^^^^^^^^
> >
> > [snip]
> > >
> > > I have looked through the cricket book, but cant see an answer.
> > >
> > Incredible!
> >
> > Check again, from the index of the 4th edition:
> >      MX records, 94-96, 98-100, 533
> >
> 
> good to see I was looking at the right pages, tho' it is p419 on my book
> not 533
> 
> >
> > In particular see page 533 or the section on MX records with specific
> > examples starting on page 94.
> >
> > > Any help would be most appreciated
> > > Cheers,
> > > Leon
> >
> > Jim


More information about the bind-users mailing list