Do not send e-mail to me!

Introduction to rDNS

Introduction to rDNS

Reverse DNS (rDNS) is the naming method of the machine that is using a given IP and is defined by the IP block administrators through the PTR record in DNS.

 

How to discover the rDNS of an IPv4

 

To discover the rDNS of an IPv4, just consult the PTR of the IP reverse form with “.in-addr.arpa”. As an example, the IP “209.85.218.43” is transformed into “43.218.85.209.in-addr.arpa” and the PTR record is query:

ubuntu:~$ dig PTR 43.218.85.209.in-addr.arpa +noall +answer
; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> PTR 43.218.85.209.in-addr.arpa +noall +answer
;; global options: +cmd
43.218.85.209.in-addr.arpa. 32 IN PTR mail-oi0-f43.google.com.

As can be seen in the example, the IP rDNS “209.85.218.43” is “mail-oi0-f43.google.com”.

 

How to discover the rDNS of an IPv6

 

To discover the rDNS of an IPv4, just consult the PTR of the IP reverse form with “.ip6.arpa”. As an example, the IP “2607:f8b0:400c:c05::22f” is transformed into “f.2.2.0.0.0.0.0.0.0.0.0.0.0.0.0.5.0.c.0.c.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa” and the PTR record is query:

ubuntu:~$ dig PTR f.2.2.0.0.0.0.0.0.0.0.0.0.0.0.0.5.0.c.0.c.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa +noall +answer
; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> PTR f.2.2.0.0.0.0.0.0.0.0.0.0.0.0.0.5.0.c.0.c.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa +noall +answer
;; global options: +cmd
f.2.2.0.0.0.0.0.0.0.0.0.0.0.0.0.5.0.c.0.c.0.0.4.0.b.8.f.7.0.6.2.ip6.arpa. 60 IN PTR mail-vk0-x22f.google.com.

As can be seen in the example, the IP rDNS “2607:f8b0:400c:c05::22f” is “mail-vk0-x22f.google.com”.

 

Importance of rDNS to email servers

 

Many email providers check the rDNS from source when receiving an e-mail. Although not a standard, if rDNS is not the same as the MTA hostname, the message is rejected by many of these providers. The technique ended up being widely used and for this reason it is important that your mail server has rDNS same to the hostname of the machine.

 

This technique is a way to restrict access to SMTP services, ensuring that the IP administrator agrees that the machine in question is actually being used with that name. Many IPs do not have rDNS and may therefore be used for purposes other than genuine e-mail service. Sometimes is a residential machine or other types services machine, that can be hijacked by spambot.

 

How to configure rDNS on your mail server

 

If you are the administrator of the IP block of your mail server, simply change the DNS zone records in such a way that the rDNS query responds properly, as described above.

 

If your e-mail server is using an IP from a data-center or ISP, you will need to request the change of rDNS directly to the administrator of this company. If company refuses to change the rDNS of your IP, it may mean that your agreement to use that specific IP is not intended to use in a email server. In this case, it will be necessary to change the IP or establish a new contract. If the company refuses to change rDNS in any situation, the solution is to terminate the contract because this type of configuration should be taken by any serious company in this area.

 

You must use the hostname of the machine to configure rDNS. Use the following command on your server to find out which machine’s hostname is:

ubuntu:~$ hostname
mx-br.spfbl.net

In this example, the hostname of the machine is “mx-br.spfbl.net” and it is exactly this name that should be used in the rDNS of the IP that this machine is using.

 

If the hostname of the machine is wrong, you must correct it before configuring rDNS:

ubuntu:~$ sudo hostnamectl set-hostname mx-br.spfbl.net

This command will make all the necessary settings to change the hostname and keep it permanent so that the machine can be restarted and continue using the same hostname.

 

Links externos

https://en.wikipedia.org/wiki/Reverse_DNS_lookup

Leandro Carlos Rodrigues

Bacharel em Ciência da Computação pela FEI