0

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 192.168.1.125

    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?

2

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
    Trying 12.34.56.78...
    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 --> 12.34.56.78 --> 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 1.2.3.4, 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 1.2.3.4 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
3

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 127.0.1.1 or 127.0.0.1

  • I just want to know the address 127.0.1.1 to which it refers? – k.Cyborg Jan 23 '18 at 20:45
  • 127.0.0.1 is the loopback address it always refers to the host itself. So each computer on the planet is its own 127.0.0.1 – 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 127.0.0.1 is resolvable to a name other than "localhost" or "localhost.localdomain", one workaround is to assign the system hostname to 127.0.1.1 instead. It is also a loopback address, just like 127.0.0.1. – 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.