There are many similar questions on here but nothing that looks like it's actually what I need.
I know what I need is very simple but I can't websearch it, probably I'm missing a key word.
My issue:
There is a standard DNS set up on a third party (as yet unseen by my eyes) controlling the website and email. Defined as "Server Old". There is a new website set up on its own server, defined "Server New" this server hosts the website ONLY and so I need to update the DNS of the original "server Old" DNS hoster.
I understand I should update the original A
record (only) to the IP of the server hosting the new website.
But I am having trouble understanding what to do about the DNS for the new-website server, it needs to recognise when dealing with email to send emils out to the WAN rather than dealing with them internally. How do I set up this DNS, for example if the new website sends emails to the website owner, the email needs to be send from the new server to the old server;
Is it simply a case of updating the MX record on the new-website server to point back to the original DNS server?
Or have I missed some things here?
Update 1
In response to Tilman's answer to my above query. A kinda rewrite and clarification response to the above answer.
There is a Domain; "Domain Alpha" that has it's A, MX and all other records set correctly.
I believe that, in order to redirect the website -only- to a new server, that on the DNS rules set for "Domain Alpha" I should update the "A" DNS rule -only- to the IP of the new website server.
I would then have a DNS ruleset on this new server that would -only- handle incoming HTTP requests and anything else be pushed back to the original FQDN DNS ruleset.
Basically, I want to delegate all services EXCEPT email (MX) to the new server and leave the email as it is.
Can I do this (3) by setting an A ruleset record in the existing DNS ruleset that points to the new server, and then on the new server (which also contains DNS rulesets) setting an explicit MX record back to the "original" current server IP (or the orginal / current DNS host)?
You need to sort out your concepts. There is no such thing as "the DNS for the new-website server". There is only the one worldwide domain name system (DNS) [1] containing resource records (RRs) for domain names, and within it one authoritative nameserver for your domain on which you can maintain and update RRs within that domain [2]. Nor does the DNS have "rulesets", or "recognize" anything. It just answers queries about RRs assigned to fully qualified domain names (FQDNs) without considering (or in fact even knowing) which service the client wants to access.
With respect to your question, there is no such thing as "a DNS ruleset on this new server" that would be able to "-only- handle incoming HTTP requests" because DNS doesn't even know whether an incoming request is for HTTP. Nor is there a mechanism to "push back" anything once it has arrived on your new webserver.
There are two relevant types of RRs for your purposes:
There are however a few additional considerations:
https://www.example.com
but your mail addresses will be[email protected]
. In that case the A RR determining the webserver to consult will be the one on the FQDNwww.example.com
but the MX RR determining the mailserver will be on the FQDNexample.com
(withoutwww.
). If your website is reachable as bothhttps://www.example.com
andhttps://example.com
you need to update the A RRs on bothwww.example.com
andexample.com
.So what you need to do is:
[1] leaving aside private split DNS in order not to complicate things unnecessarily
[2] leaving aside subdomain delegation for simplicity
The authoritative DNS server for your domain should contain the proper MX record for your domain.
When your new server is sending emails to your domain, the SMTP server that new server uses, will do a query for MX record of the destination domain.
Then the mail server will resolve the A/AAAA record for the mail server mentioned in MX record, and then will connect to that server.
Note that if the MX record pointed to domain name used for web services, then you need to set up another domain for your MX record.
For example: If old server had
www.example.com
with IP address192.0.2.1
and MX record pointed towww.example.com
, then that doesn't work with new setup.A working set of DNS rules in your authoritative DNS server for the domain would be:
Here
192.168.100.1
is the IP address of the new server, and192.168.200.1
is the IP address of the old server.MX record must always be a domain name.