Binaryfigments

PTR Records


When using the internet, we all use DNS records to resolve the name of websites so our computer and/or browser knows that when we go to https://binaryfigments.com the browser has to go to the webserver with the IP address 213.249.93.130 of the IPv6 address 2a01:448:1003::130.

The other way around

There is also a way to get a name behind an IP address. This is also a DNS record named a PTR record. PTR stand for Pointer Record, also known as reverse DNS record. If you do reversed lookup for a IP address, you will get the name behind it. There records are commonly used by mail systems to check if the sending mail server is who he is that he say he is.

For example, if we do a look up to the name of SMTP server of my domain provider we get the following results:

$ dig A filter01.networking4all.net +short
213.249.66.8

Or for IPv6:

$ dig AAAA filter01.networking4all.net +short
2a01:448:1:1002::8

With the host command:

$ host filter01.networking4all.net
filter01.networking4all.net has address 213.249.66.8
filter01.networking4all.net has IPv6 address 2a01:448:1:1002::8

These are normal lookup’s checking what IP address is behind what full qualified domain name. If we want to do a reversed lookup to these addresses, we can also use the dig or host command.

With dig:

$ dig -x 213.249.66.8 +short
filter01.networking4all.net.
$ dig -x 2a01:448:1:1002::8 +short
filter01.networking4all.net.

With host:

$ host 213.249.66.8
8.66.249.213.in-addr.arpa domain name pointer filter01.networking4all.net.
host 2a01:448:1:1002::8
8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.1.1.0.0.0.8.4.4.0.1.0.a.2.ip6.arpa domain name pointer filter01.networking4all.net.

Notation of a PTR record

As you can see in the results of the last host commands, PTR records have a bit of a strange notation. These PTR records are the IP address, but in a reversed notation in the zone in-addr.arpa, for IPv4 and for IPv6 the zone ip6.arpa.

213.249.66.8
8.66.249.213 (.in-addr.arpa)

Who is maintaining these records?

The PTR records are in the DNS servers of the network maintainer. If I want to get a PTR record on the IP address that I have from my provider 213.249.93.130 and add the name binaryfigments.com to it, I will have to ask them to set it for me. Even better it is if you can set it up on your own in a portal. The provider will set this PTR record in their name server. If you have a IP subnet, you can possible use your own nameservers.

To get the zone you are in you can run the command:

$ dig 130.93.249.213.in-addr.arpa.

; <<>> DiG 9.8.3-P1 <<>> 130.93.249.213.in-addr.arpa.
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21458
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;130.93.249.213.in-addr.arpa.	IN	A

;; AUTHORITY SECTION:
93.249.213.in-addr.arpa. 1799	IN	SOA	ns1.networking4all.com. hostmaster.yourdomainprovider.net. 2016081703 14400 3600 1209600 7200

;; Query time: 48 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Wed Aug 17 14:47:08 2016
;; MSG SIZE  rcvd: 136

And for IPv6:

$ dig 0.3.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.0.1.8.4.4.0.1.0.a.2.ip6.arpa

; <<>> DiG 9.8.3-P1 <<>> 0.3.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.0.1.8.4.4.0.1.0.a.2.ip6.arpa
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 806
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;0.3.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.0.1.8.4.4.0.1.0.a.2.ip6.arpa. IN A

;; AUTHORITY SECTION:
8.4.4.0.1.0.a.2.ip6.arpa. 1799	IN	SOA	ns1.networking4all.com. hostmaster.networking4all.com. 2016081706 3600 3600 1209600 7200

;; Query time: 131 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Wed Aug 17 14:42:22 2016
;; MSG SIZE  rcvd: 159

At the authority section you see the SOA of the zone of the IP address. The name server in the SOA is the authoritive name server for the zone of your IP address.

Zone for my IPv4: 93.249.213.in-addr.arpa.

Zone for my IPv6: 8.4.4.0.1.0.a.2.ip6.arpa.

The primary name server for this zone is ns1.networking4all.com, and there you have to add the right PTR record.

How and where is this set?

The RIPE is the organization that manages the IP subnets in the region I am in. My provider, Networking4all, need to add an DOMAIN object in de database off the RIPE with the right name servers in it.

You can search it here: https://apps.db.ripe.net/search/query.html?searchtext=93.249.213.in-addr.arpa#resultsAnchor

This is the DOMAIN object that you will find: https://apps.db.ripe.net/search/lookup.html?source=ripe&key=93.249.213.in-addr.arpa&type=domain

You can see, PTR records have a slightly different approach for looking up. It is important to set a right PTR record for your IP address on your server if you user services like e-mail and DNS.