The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

A bit deeper with MX Records

Discussion in 'E-mail Discussions' started by Joey009, Jun 14, 2014.

  1. Joey009

    Joey009 Registered

    Joined:
    Jun 14, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi, Guys,
    I thought I knew MX pretty well but some questions stumped me. Hope you can help.

    Let's say I have 2 mail servers for domain.com. They are:
    mail1.domain.com at IP 5.5.5.5 and
    mail2.domain.com at IP 7.7.7.7.

    ----------------------------------------------------------
    First scenario is

    10 mail1.domain.com 5.5.5.5
    20 mail2.domain.com 7.7.7.7

    So if mail1 is not responsive, it will then send to mail2.

    Questions regarding scenario 1.

    What happens to the mail that goes to mail2.domain.com? Does it sit on the server on mail2.domain.com at 7.7.7.7 waiting for my client to connect to it? Or does it hold it and wait for mail1 to become responsive and then delivers it to mail1 at 5.5.5.5?

    I used to think it sat on mail2 until the client connected with it to retrieve it. But then that would mean that the client would have to know to connect to mail2.domain.com as well as any mail1.domain.com. Since common practice is have the client check only one record, I now doubt that it's final resting point is mai2.


    ===============================

    Second scenario is

    10 mail1.domain.com 5.5.5.5
    10 mail2.domain.com 7.7.7.7


    Questions regarding scenario 2:

    How is distribution decided? Is it 50/50? I don't see DNS keeping record of resolutions given out. Is it just a virtual flip o f the coin that ends up roughly load balanced?

    Do I have to configure my client to check both servers? If not, how will be able to retrieve all of my mail?

    Thanks in advance.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,471
    Likes Received:
    199
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  3. Joey009

    Joey009 Registered

    Joined:
    Jun 14, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    I have. That document does not address any of my questions. Look at it this way. That document would be what a teacher says to when they explain MX records. Then she would say, "Any questions?"

    Below would be the follow-up questions to her established foundation.

    1. The document explains that you can assign an MX as backup, but doesn't explain HOW backups work.
    2. The document does not explain what occurs with multiple MX records having the priority. How is one MX chosen over the other?
    3. The document does not address configuration of client for retrieval from multiple MX (if applicable).
     
  4. Joey009

    Joey009 Registered

    Joined:
    Jun 14, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    I have. That document does not address any of my questions. Look at it this way. That document would be what a teacher says to when they explain MX records. Then she would say, "Any questions?"

    Below would be the follow-up questions to her established foundation.

    1. The document explains that you can assign an MX as backup, but doesn't explain HOW backups work.
    2. The document does not explain what occurs with multiple MX records having the priority. How is one MX chosen over the other?
    3. The document does not address configuration of client for retrieval from multiple MX (if applicable).
     
  5. cPanelPeter

    cPanelPeter Technical Analyst III
    Staff Member

    Joined:
    Sep 23, 2013
    Messages:
    569
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    This doesn't actually pertain to cPanel software directly. It's how MX records work in general. With a secondary MX record in place, messages will be queued on that secondary server. They will then attempt re-delivery every so often. If they can't deliver to the main MX server after a certain number of days (5 by default for most mail servers) then they will bounce.

    From a redundancy/failsafe perspective, a backup MX is a good thing, but might not be needed. Email will either queue up at your primary MX server, wasting your bandwidth, or at the originating server. With a backup MX record you queue it up, without it, it queues up on the originating server.

    The historical reasons for backing up the MX records included both redundancies and allowing for a secondary (slower) route or the secondary host, with the primary behind the firewall. In the days of 9600 baud UUCP or even 1200 baud dialup links, it made a lot of sense. You wanted to incrementally and in small steps get the email closer and closer to its final destination. Also, the primary could be down for DAYS! Remember the default sendmail settings, the warning after 4 hours (2 hours for high priority), and a bounce after 5 days. Can you imagine an MX server down for 5 days?

    Today's reasons for backing up MX records are mostly used for load balancing.

    If you look at Hotmail's mail servers, they have the same MX 'weight' for all servers.

    Code:
    
    $ dig hotmail.com mx
    
    ; <<>> DiG 9.9.2-P1 <<>> hotmail.com mx
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12055
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 5, ADDITIONAL: 67
    
    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 4096
    ;; QUESTION SECTION:
    ;hotmail.com.			IN	MX
    
    ;; ANSWER SECTION:
    hotmail.com.		488	IN	MX	5 mx2.hotmail.com.
    hotmail.com.		488	IN	MX	5 mx3.hotmail.com.
    hotmail.com.		488	IN	MX	5 mx4.hotmail.com.
    hotmail.com.		488	IN	MX	5 mx1.hotmail.com.
    
    ... rest of output skipped ...
    
    See how they all have a weight/priority of 5?

    Hope that answers your question.
     
Loading...

Share This Page