Jayesh Bhoot's Ghost Town

Learnings on DNS

Posted on in

Syntax of a DNS record, along with examples:

; Syntax #1: name [ttl] [record_class] record_type record_data
; Syntax #2: name [record_class] [ttl] record_type record_data 
foo.example.com. CNAME example.com.
example.com.     A     1.2.3.4
Syntax of a DNS record

Here, foo.example.com resolves to example.com, which in turn resolves to 1.2.3.4.

In a CNAME mapping, @ CNAME example.com, example.com is the canonical name, while @ is the domain being mapped to the canonical name.

In a record, @ means the current origin. Usually, the current origin means the apex domain (like bhoot.sh).

In a record, www implies the www subdomain of the current origin. e.g., www.bhoot.sh.

Prefer ANAME to CNAME even if the the former is not yet standardized because CNAME does not allow multiple records for the same canonical name. Also, CNAME does not allow mapping the apex domain to a canonical name.

Ideally, several domain names map to a canoical name via CNAME/ANAME records. This canonical name is then mapped to the actual IP address in an A record.

Post author's photo Written by Jayesh Bhoot