I'm configuring DNS server in linux and cannot understand these things. There is no information in the Internet about them:

  1. Must A record be same as PC name? For example, my PC's name is PC1 and in my PC there is a mail server configured with domain example.com.
    Should my friend (at his office) write in his DNS zone file(zone file for my domain at his office in his linux server) A record like this:

    PC1 IN A

    IN MX PC1.example.com.

    Am I right? Or can we put any convenient for us name for A record?

  2. Must I create seperate zone files for each domain for sending mails to them from my domain?


Local hostname and DNS names is a different things. You can type any hostnames at your server (or PC; not matter) and any public DNS names.

But! Some operating systems (Windows especially) can deny access to himself if you try to connect with different names (names that differ from server's hostname). But it is not your case.

There are some things about mail servers:

  1. Is a good practic that your hostname return real MX name with command hostname -f

    Example: hostname -f on server return mail.example.com; MX record for domain example.com point to mail.example.com

  2. Mail server may (and must in most cases) return HELO with valid DNS record:

    open example.com 25
    Connected to example.com.
    Escape character is '^]'.
    220 mail.example.com ESMTP Postfix
  3. IP address of mail server must have any ptr record (for good spam reputation) and may have ptr record that resolv to MX record (some "improperly" configured mail servers required strictly accordance of MX --> A --> IP --> PTR (like A record). For example domain: example.com MX --> mail.example.com --> --> mail.example.com).

  • thank you for good explanation. Just one question, in your 1st answer, you said that it is a good practic that my hosname return real MX name, no problem that is OK. But, I want to add MX record about other domain's mail server, I know other domain's name, for example: branchoffice.com, I know its IP address, for example, but I dont know its PC's hostname. Must I still write MX record in DNS zone file according to PC name? Or should I write just its domain name? – it dev Jan 24 '18 at 12:34
  • branchoffice.com IN A IN MX 2 branchoffice.com am I right? It doesnt matter what the PC name – it dev Jan 24 '18 at 12:36
  • @it dev, it doesn't matter, you are right. My recommendation may be needed for proper working of mail server (e.g. Postfix can check his own hostname for proper mail delivery - to define that mail.example.com is himself. But you can rewrite this behaviour with config /etc/postfix/main.cf). – Egor Vasilyev Jan 24 '18 at 13:12
  • do you have any messenger id? If yes, can you give me? – it dev Jan 24 '18 at 16:16
  • @it dev, no i haven't – Egor Vasilyev Jan 24 '18 at 16:25

No, the hostname of the machine does not need to be available in DNS.

BUT ... the machine must be able to look itself up. So it is always best to put the local hostname in /etc/hosts (or equivalent) pointing to a loopback address.

Should that same hostname be a fully qualified domain name, and be in DNS, and pointing to the IP the machine has, well that is OK too. But it isn't required.

FWIW I've just checked my 2 desktops, my Raspberry Pi, and my Linode machines and NONE of the hostnames are in DNS - they are in each machine's /etc/hosts though, all pointing to or

  • I just want to know the address to which it refers? – k.Cyborg Jan 23 '18 at 20:45
  • is the loopback address it always refers to the host itself. So each computer on the planet is its own – Patrick Mevzek Jan 24 '18 at 5:26
  • @ivanivan, well that is OK, the PC name and A record are not required to be the same. But I saw that in some DNS ZONE records, there are written mail, www, ftp IN A and ip address. What they mean? Are that names used as convenience? – it dev Jan 24 '18 at 6:05
  • If some applications get unhappy if is resolvable to a name other than "localhost" or "localhost.localdomain", one workaround is to assign the system hostname to instead. It is also a loopback address, just like – telcoM Jan 24 '18 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.