Week 11 DNS Service v2
Week 11 DNS Service v2
DNS Service
Arif Husen
browser
https://api.aws.amazon.com.
protocol FQDN
https:// , http:// api.aws.amazon.com.
User ISP DNS Root DNS Auth DYN DNS TLD DNS
DNS Query
2
www.google.com
DNS Query
4
www.google.com
DNS Query Ask .com server 3
1
www.google.com
Ask DYN Server 5
DNS Query
6
www.google.com
Authoritative Resp
7
<IP Address>
<IP Address> 8
DNS ZONE
➢ The DNS is broken up into many different zones. These zones
root Root
differentiate between distinctly managed areas in the DNS namespace.
zone
➢ Don't associate a DNS zone with a domain name or a single DNS server.
In fact, a DNS zone can contain multiple subdomains and multiple zones
can exist on the same server. DNS zones are not necessarily physically
separated from one another, zones are strictly used for delegating control. .vu
zone
➢ All of the information for a zone is stored in what’s called a DNS zone
file, which is the key to understanding how a DNS zone operates
.exam .vulms
zone zone
DNS Record Types
•Admin Email •A is an address •CNAME or •A mail exchange •A nameserver (NS) •A pointer (PTR) •The CAA record is a
record. "canonical name“ is (MX) record, is a record specifies the record provides a type of DNS record
•Last Update a record that points DNS record type authoritative DNS domain name for used to provide
•Shows the IP a domain name (an that shows where server for a domain. reverse lookup. additional
address of alias) to another emails for a domain confirmation for the
•Refresh Rate domain. should be routed to. Certification
hostname or domain •The NS record •It's the opposite of
helps point to where an A record as it Authority (CA) when
• The subdomain •An MX record internet applications provides the domain validating an SSL
•AAAA record, just certificate.
like A record, point ng.example.com makes it possible to like a web browser name linked to an IP
to the IPv6 address can point to direct emails to a can find the IP address instead of
for a domain example.com using mail server. address for a the IP address for a
CNAME. Here domain name. domain.
example.com points
to the actual IP
address using an A
record.
➢ The Start of Authority (SOA) record is a mandatory record in all zone files.
➢ It must be the first real record in a file (although $ORIGIN or $TTL specifications may appear above).
➢ Example
➢ The “A” record is used to map a host to an IPv4 IP address, while “AAAA” records are used to
map a host to an IPv6 address.
▪ host IN A IPv4_address
▪ host IN AAAA IPv6_address
▪ ns1 IN A 111.222.111.222
▪ ns1.domain.com. IN A 111.222.111.222
▪ www IN A 222.222.222.222
▪ domain.com. IN A 222.222.222.222
▪ @ IN A 222.222.222.222
▪ * IN A 222.222.222.222
CNAME Records
➢ CNAME records define an alias for canonical name for your server (one defined by an A or
AAAA record).
➢ For instance, we could have an A name record defining the “server1” host and then use the
“www” as an alias for this host:
server1 IN A 111.111.111.111
www IN CNAME server1
➢ Be aware that these aliases come with some performance losses because they require an
additional query to the server.
➢ Most of the time, the same result could be achieved by using additional A or AAAA records.
➢ One case when a CNAME is recommended is to provide an alias for a resource outside of the
current zone.
MX Records
➢ MX records are used to define the mail exchanges that are used for the domain. This helps
email messages arrive at your mail server correctly.
➢ Unlike many other record types, mail records generally don’t map a host to something, because
they apply to the entire zone. As such, they usually look like this:
IN MX 10 mail.domain.com.
➢ Example
The MX record should generally point to a host defined by an A or AAAA record, and not one defined by a
CNAME. So, let’s say that we have two mail servers. There would have to be records that look something like
this:
IN MX 10 mail1.domain.com. IN MX 10 mail1
IN MX 50 mail2.domain.com. IN MX 50 mail2
mail1 IN A 111.111.111.111 mail1 IN A 111.111.111.111
mail2 IN A 222.222.222.222 mail2 IN A 222.222.222.222
NS Records
➢ NS record type defines the name servers that are used for this zone.
Question : if the zone file resides on the name server, why does it need to reference itself?”. Part of
what makes DNS so successful is its multiple levels of caching.
▪ One reason for defining name servers within the zone file is that the zone file may be actually
being served from a cached copy on another name server.
▪ You should have at least two name servers defined in each zone file IN NS ns1.domain.com.
in order to operate correctly if there is a problem with one server. IN NS ns2.domain.com.
▪ Most DNS server software considers a zone file to be invalid if there is ns1 IN A 111.222.111.111
only a single name server. ns2 IN A 123.211.111.233
▪ As always, include the mapping for the hosts with A or AAAA records:
➢ There are quite a few other record types you can use, but these are probably the most common
types that you will come across.
PTR Records
➢ The PTR records are used define a name associated with an IP address.
➢ PTR records are unique in that they begin at the .arpa root and are delegated to the owners of the IP addresses.
➢ The Regional Internet Registries (RIRs) manage the IP address delegation to organization and service providers.
➢ The Regional Internet Registries include APNIC, ARIN, RIPE NCC, LACNIC, and AFRINIC.
➢ Example of a PTR record for an IPv6 address shows the nibble format of the reverse of Google’s IPv6
DNS Server 2001:4860:4860::8888.
➢ An example of a dig command. The +short is appended to reduce the output to the reverse DNS name.
▪ The output for the dig command above will be the domain name in the PTR record for the IP address: google-
public-dns-b.google.com.
➢ Servers on the Internet use PTR records to place domain names within log entries, make informed spam handling
decisions, and display easy-to-read details about other devices.
➢ Most commonly-used email servers will look up the PTR record of an IP address it receives email from.
➢ If the source IP address does not have a PTR record associated with it, the emails being sent may be treated
as spam and rejected.
➢ It is not important that the FQDN in the PTR matches the domain name of the email being sent. What is
important is that there is a valid PTR record with a corresponding and matching forward A record.
CAA Records
➢ CAA records are used to specify which Certificate Authorities (CAs) are allowed to issue SSL/TLS certificates for
your domain.
▪ As of September 8, 2017 all CAs are required to check for these records before issuing a certificate. If no record is
present, any CA may issue a certificate.
▪ Otherwise, only the specified CAs may issue certificates. CAA records can be applied to single hosts, or entire
domains.
➢ An example CAA record
▪ The host, IN, and record type (CAA) are common DNS fields. The CAA-specific information above is the 0 issue
"letsencrypt.org" portion. It is made up of three parts: flags (0), tags (issue), and values ("letsencrypt.org").
▪ Flags are an integer which indicates how a CA should handle tags it doesn’t understand. If the flag is 0, the record
will be ignored. If 1, the CA must refuse to issue the certificate.
▪ Tags are strings that denote the purpose of a CAA record. Currently they can be issue to authorize a CA to create
certificates for a specific hostname, issuewild to authorize wildcard certificates, or iodef to define a URL where CAs
can report policy violations.
▪ Values are a string associated with the record’s tag. For issue and issuewild this will typically be the domain of the CA
you’re granting the permission to. For iodef this may be the URL of a contact form, or a mailto: link for email feedback.
➢ You may use dig to fetch CAA records using the following options: