Are separate dns records necessary for web and mail on a single server

domain-name-systememail-serverhostnamemx-record

When setting up a web/mail server on a single server or VPS with one IP address almost every guide online follows the same structure for DNS:

example.com.               IN A    192.0.2.0  
hostname.example.com.      IN A    192.0.2.0  
mail.example.com.          IN A    192.0.2.0  
example.com.               IN MX   10 mail.example.com.  
0.2.0.192.in-addr.arpa.  IN PTR  hostname.example.com  

I used this several times and it has always worked for me. But I was wondering if there's a reason why the mail server points to a different name? Would it be possible to point the MX record to the hostname and simply use hostname.example.com for SMTP and POP3?

Best Answer

Yes, it would be possible, but you will lose some important advantages if you choose to do so:

If you point all services to the same DNS name, you can't put them onto separate servers any more without reconfiguring any client that refers to them.

As an example: With different names, when the load on the server grows too much, you can simply offload the mail services to another server without affecting the clients. All you have to do is to adapt your DNS records.