Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 11 of 11
  1. #1
    Member
    Join Date
    May 2006
    Posts
    236

    Default Best way to point a domain to external IP / server, but keep mail local?

    I've been kind of bashing my head against the wall on this one and after reading up on / researching the use of CNAME's and other DNS zone settings, I'm not sure of the best way to do this, so I'm hoping someone here can please help.

    Let's say I have a customer on one of my cPanel servers, and he wants to host his DNS / email for his domain through my server, but he wants the web site for his domain name to be hosted on his home computer / server.

    Now let's say the IP for his domain "example.com" on my shared hosting server is 123.456.123.456 and the IP where he wants to host his actual web pages is 789.012.789.012.

    The ultimate goal is to have his domain "example.com" serve his web site pages from his home server at 123.456.123.456, but his have his domain registration still use my nameservers, and have his account on my server still handle all the email processing.

    What is the best way to achieve this?

    I've tried editing his DNS zone and pointing the A record for his domain to his other computer IP address, and putting a check next to the option for my server to still handle the MX / email for the domain, and so far that kind of works but DNS reports show problems with using this method (failure to locate mail server, etc...) and it appears to be non RFC compliant.

    Is there a better way to do this using CNAME instead? I believe we tried creating a CNAME for "example.com" (not his real domain of course) and pointing that to the IP address of his external home server, but then his domain is only accessable via www. and not without the w's.

    I know I'm overlooking something simple here, but all of the CNAME / DNS documentation I've been reading is just confusing me further on the issue.

    If anyone is willing to provide guideance I'd be extremely appreciative.
    Thank you for any thoughts on this!

  2. #2
    Member
    Join Date
    Jul 2008
    Posts
    63

    Default

    Set example.com to his home IP address, and set www.example.com as a CNAME for example.com. Then, assign your server IP to mail.example.com, and set the MX record to mail.example.com. And make sure to check the option for cpanel to handle mail for that domain.

  3. #3
    Member
    Join Date
    May 2006
    Posts
    236

    Default

    Thanks FreedomBI. If I understood you correctly, I tried it your way and the DNS zone record contains:

    example.com. 14400 IN A xx.xxx.xxx.xxx (his home IP)
    example.com. 14400 IN MX 0 mail.example.com
    mail.example.com 14400 IN CNAME xx.xxx.xx.xxx.example.com (IP of my server)
    www 14400 IN CNAME example.com

    And a check mark next to "Always accept mail locally even if the primary mx does not point to this server."

    However, when I do it that way and then do a DNS Report from dnsstuff.com it shows two red failures - one for "Reverse DNS entries for MX records" and one for "Connect to mail servers" (the first error showing no Reverse DNS (PTR) entries and the second error showing Could not connect without glue or A record.)



    SO, I tried it a slightly different way, doing the following:

    In Edit DNS Zone I changed it to:

    example.com. 14400 IN A xx.xxx.xxx.xxx (his home IP)
    example.com. 14400 IN MX 0 xx.xxx.xx.xxx (my server IP)
    mail 14400 IN CNAME example.com
    www 14400 IN CNAME example.com

    BUT at that point the DNS Report errors still persisted, and I noticed that it changed the MX line in the zone to:
    example.com. 14400 IN MX 0 xx.xxx.xx.xxx.example.com (usingmy server IP)

    So I added one last step:

    In WHM > DNS Functions > Edit MX Entry for example.com and changed xx.xxx.xx.xxx.example.com to just xx.xxx.xx.xxx (my server IP and submitted it).

    That added the following A entry to the DNS zone:
    mx-xx-xxx-xx-xxx 14400 IN A xx.xxx.xx.xxx (all x's are my server IP)

    And it changed this line:
    example.com. 14400 IN MX 0 xx.xxx.xx.xxx.example.com (using my server IP)
    To:
    example.com. 14400 IN MX 0 mx-xx-xxx-xx-xxx.example.com (usingmy server IP)

    Once I used the second method I described just above, and manually edited the MX entry (which auto added an A entry for the MX to my server IP), the errors/failures from the DNS Report were gone, and it's now showing a perfect Report on dnsstuff.com. DNS Report is clean now!

    So either I misundertood you and the second method that I used is what you actually meant, or my particular server setup doesn't play nice with the first method as I understood it from you.

    Either way you put me on the right track, and I thank you very much for your repsonse! Much appreciated!!
    Last edited by Metro2; 08-13-2008 at 04:15 AM.

  4. #4
    Member
    Join Date
    Jul 2008
    Posts
    63

    Default

    Your first attempt was almost correct. Your mistake was

    Code:
    mail.example.com 14400 IN CNAME xx.xxx.xx.xxx.example.com (IP of my server)
    instead of
    Code:
    mail.example.com 14400 IN A xx.xxx.xx.xxx
    I'm sure in the first, you tried putting just the IP, but since it was expecting a hostname and did not have a trailing dot, .example.com was appended.

    This is the better form. An MX record is supposed to be a hostname, which resolves to an IP.

  5. #5
    Member
    Join Date
    Oct 2003
    Posts
    49

    Default

    A year on, I've hit exactly the same dilemma, with a client wanting their pages on another server, and their mail and dns on my server. And while this post was really useful, I just can't get it to work.

    Here are my current settings:



    The site works, but emails are bouncing with "No MX or A records for ..." in the returned error message.

    Any suggestions would be really appreciated.

    Thanks

  6. #6
    Member
    Join Date
    Sep 2004
    Posts
    887

    Default

    From some remote computer (such as your home pc or some other computer not located in the same place as your hosting machine and not using your hosting machine's nameservers as its resolvers) do:

    nslookup -q=mx exampledomain.com.au
    - should return an indication that the mail exchanger is mail.exampledomain.com.au
    - further down it should show that mail.exampledomain.com.au resolves to 205.200.100.31

    make sure exampledomain.com.au is in /etc/localdomains
    make sure exampledomain.com.au is NOT in /etc/remotedomains

    Assuming all of that is correct, the world knows to deliver mail to mail.exampledomain.com.au, the world knows that mail.exampledomain.com.au resolves to 205.200.100.31, a remote mailserver should send mail for @exampledomain.com.au to mail.exampledomain.com.au, and your server should accept it.

    I used nslookup as the tool of choice because you'll have it on unix and on Windows.

    Mike

    PS: There may be places still caching old DNS information regarding mail.exampledomain.com.au, etc.

    PS #2: Incidentally, your DNS configuration as shown above is correct - As long as the domain registrar has ns1.mydnsserver.com and ns2.mydnsserver.com listed as the authoritative nameservers, it should work.
    Last edited by mtindor; 08-23-2009 at 08:21 PM.

  7. #7
    Member
    Join Date
    Oct 2003
    Posts
    49

    Default

    Thanks a lot Mike

    Checked and re-checked everything. exampledomain.com.au is in /etc/localdomains and /etc/remotedomains is empty. NS servers are listed as such with the domain registrar.

    However nslookup returned the following:

    Code:
    nslookup -q=mx exampledomain.com.au
    Server:  www.routerlogin.com
    Address:  192.168.0.1
    
    Non-authoritative answer:
    exampledomain.com.au   MX preference = 0, mail exchanger = mail.exampledomain.com.au
    And a tracert to mail.exampledomain.com.au fails:

    Code:
    tracert mail.exampledomain.com.au
    Unable to resolve target system name mail.exampledomain.com.au.
    It's now more than 12-hours since I made the changes and sill not working/propagated.

    Something is still not right somewhere.

    Michael

  8. #8
    Member
    Join Date
    Oct 2003
    Posts
    49

    Default

    Solution found:

    entry for mail.exampledomain.com.au was set incorrectly in
    /var/named/exampledomain.com.au.db

    Following line,

    mail.exampledomain.com.au 14400 IN A 205.200.100.31

    was changed to,

    mail.exampledomain.com.au. 14400 IN A 205.200.100.31

    Serial number was corrected and named was restarted and it is now resolving locally.

  9. #9
    Member
    Join Date
    Sep 2004
    Posts
    887

    Default

    Those damned periods [or lack thereof] will do it every time

    Mike

  10. #10
    Registered User
    Join Date
    Sep 2009
    Posts
    1

    Default Editing "A" Record to point to another Server

    Hi! All,

    I would appreciate if anyone can tell

    What and where in WHM- DNS Editing ( In what column like in the "www" or the "site name like abc.com" Column) the "A" record needs to be changed to point to another server hosting the web site?

    I tried a few things but did not work. An early response is appreciated.

    Thanks,

    Arvin

  11. #11
    Member
    Join Date
    Apr 2009
    Posts
    230

    Default

    AS in the above posts, if you are trying to serve the web-pages for your domain from an external server while keeping dns and mail on the local server then you need to do the following changes in the DNS zone file :

    Code:
    abc.com. IN MX 0 mail.abc.com.
    abc.com. IN A XX.XX.XX.XXX ( the external server's IP )
    mail IN A YY.YY.YY.YYY ( local server's IP)
    www IN CNAME abc.com.

Similar Threads & Tags
Similar threads

  1. Domain with external DNS: external MX and local mail problem
    By vapetrov in forum E-mail Discussions
    Replies: 2
    Last Post: 01-14-2011, 08:33 PM
  2. hosting domain with external mail server
    By drmuey in forum cPanel and WHM Discussions
    Replies: 35
    Last Post: 09-09-2009, 08:13 PM
  3. Replies: 3
    Last Post: 05-26-2009, 11:27 AM
  4. Duplicate domain local and external
    By riostyles in forum E-mail Discussions
    Replies: 1
    Last Post: 02-24-2008, 08:13 AM
  5. Domain local - E-Mail external
    By aubergine in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 08-31-2007, 06:19 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube