|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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! |
|
|||
|
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.
|
|
|||
|
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. |
|
|||
|
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) Code:
mail.example.com 14400 IN A xx.xxx.xx.xxx This is the better form. An MX record is supposed to be a hostname, which resolves to an IP. |
|
|||
|
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 |
|
|||
|
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. |
|
|||
|
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 Code:
tracert mail.exampledomain.com.au Unable to resolve target system name mail.exampledomain.com.au. Something is still not right somewhere. Michael |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
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.
__________________
InstaCarma Outsourced Web Hosting Technical Support and Server Management To visit out Blog , click here |
![]() |
| Thread Tools | |
| Display Modes | |
|
|