I'm learning about setting up my own web and mail servers, and I've been confused about this question for days, and articles online (including Server Fault) seems to be so inconsistent with their use of the term 'subdomain' and 'hostname'.
From my understanding:
- A host name uniquely identifies a computer in a network
- A domain and subdomain must have a DNS A record which points to one or more hosts
Let's say my web server is at
220.127.116.11, I have my host name set to
development (confirmed by running
hostname in bash shell), and I'm setting A records like so:
@ -> 18.104.22.168 www -> 22.214.171.124 mx -> 126.96.36.199 mx -> 188.8.131.52
Then I have the
mx subdomains pointing to my web server whose hostname is
mx subdoman also points to two hosts (for redundancy).
Why do I need a hostname? My machine can already be identified using its IP address.
I read somewhere that says a hostname is important because it gets sent in some messages. But if my server is both a mail server, and a file server, and a database server, and etc, what should I set my hostname to be? I certainly don't want someone receiving my mail to see a from address of
development. And a machine can only have one hostname right? Should I set my computer's
abc.example.com or just
How to set hostname if hosting multiple servers on the same machine?