Are you a web developer, who mainly focuses on developing your application? Do you only just update your nameserver and point to your hosting company at the registry and think everything will just work with no hiccups and go on your business coding? If yes then dont be that developer as I was.
Nameservers comes first!
You have to understand this bit to understand everything else in the DNS realm (https://webmasters.stackexchange.com/questions/16297/which-comes-first-dns-or-name-servers link to the article) . I have spent my night trying to uncover this puzzle basically there is 2 entities that you will likely come across when dealing with DNS, the Domain Registry(where you bought your domain) and your Web Host DNS manager(your webhost).
When you change your nameservers to your new hosting, you are basically saying to delegate all DNS records to that server thus allowing your new web host to handle your DNS or RR(Resource Records). Your Domain Registry will be free of responsibility when it comes to other records you have on it. I am saying the A , AAAA, MX records etc. These records will now be handled by your web host dns manager.
Very important if you have existing RR in your domain registry make sure you leave them be until you actually know whats happening and make sure you read this blog post before committing. So what you can do is to copy all your resource records from your original DNS to your hosting company, which to be honest is I dont like doing because a lot things can go awry when you get it wrong and will take time for it to get right.
Create an A record for your domain.com to point to the IP address of your hosting company. Then create an MX record for that domain.com to point to your current mail.domain.com DNS, then do the rest for every RR you have, that includes FTP, SFTP sub-domains.
So there you have it! If you are wondering what those records do here is a quick rundown below.
A records – translate domain name to IP address eg. domain.com -> 126.96.36.199
MX records – for email service that only points to domain name. eg mail.domain.com -> A record.
CNAME record – an alias to another name record or domain name.
AAAA record – A record but points to IPv6 instead of IPv4
What is ‘@’ record used for: