Jump to content

Are MX lookups real time?


JudgementDay

Recommended Posts

I just added a MX record to my zone file.

 

I queried a MX record for my domain name straight after, but nothing returned.

I am guessing the server I use for DNS lookup will be using a cached record, rather than looking up my DNS server real time, and that their cache will be flushed when their server does a periodic lookup on my DNS server, which will probably be within 48 hours, right?

Link to comment
Share on other sites

You can use a tool like dig to query dns servers for the information.  You could  use it to query your nameserver directly (the one with the zone file) to ensure it returns the correct information.

 

You may also be able to see how much time remains before the server your querying updates it's cache.  For example, if I query my domain:

 

kicken@bonzi:~$ dig MX aoeex.com
[..snip..]
;; ANSWER SECTION:
aoeex.com.              3600    IN      MX      0 sitemail.everyone.net.

 

The 3600 is the TTL value meaning that server will serve that response for 3600 seconds before it updates it by checking the master server again.  Essentially, it is now cached for the next hour.

 

Link to comment
Share on other sites

Cool. My DNS server has updated its cache with my new zone file.

 

There is something I am not happy about though... when I goto the URL 'mail.mydomain.com', it goes to my webpage 'mydomain.com', when it shouldn't be doing anything.

I added this to my zone file when adding the MX. Have I did it right?

 

IN MX 10 mail.mydomain.com.

mail IN A 201.124.95.75

 

How can I stop this behavior?

Link to comment
Share on other sites

You would just have to configure your web server such that if someone went to that domain it would redirect them to your main domain instead.

 

I wouldn't worry about it too much, so long as your not linking or advertising your mail.mydomain.com around the internet nobody should really be using it when trying to surf to your site.

 

Link to comment
Share on other sites

No way.. I have been running a SMTP server for 2 years without any of this, and people have been able to contact me fine.

 

If there is no MX record, SMTP servers will fallback on the A record for the domain and attempt to deliver to that IP.  You should have an MX record if your accepting mail though, and it should point to whatever your mail server's host name is, and that host name must have an A record to resolve it's IP address.

 

Transaction sort of goes like this:

mail to you@mydomain.com:

- server queries MX records for mydomain.com.  Receives back a list of hostnames, in your case mail.mydomain.com

- server queries A record for mail.mydomain.com.  If an IP is received, connect to that IP and deliver the mail

- if it fails to connect, it tries the next server in the MX list (sorted by the preference).

 

- if all mx servers fail (or no mx record) it will query an A record for mydomain.com and try to deliver the mail to there.

 

Link to comment
Share on other sites

I have just had an interesting thought.

 

I've got this ok:

IN MX 10 mydomain.com.

mydomain.com. IN A 202.136.92.37

... well, wouldn't the second line not be necessary? I'm guessing because my domains glue record already points to my IP address? or are chances that most MTA software are not sophisticated enough to put the two together, and I will need an A record regardless for the MX record target?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.