DNS Basics for IT Professionals
DNS Basics for IT Professionals
2
3
4
5
6
Need for DNS
7
If you want to…
Call someone, you need to ask for their phone number
You can’t just dial “P R O F G I L L ”
Mail someone, you need to get their address first
What about the Internet?
If you need to reach Google, you need their IP
Does anyone know Google’s IP?
Problem:
People can’t remember IP addresses
Need human readable names that map to IPs
8
Google Ip Adresses
9
iPv4
64.233.160.0 – 64.233.191.255
66.102.0.0 – 66.102.15.255
66.249.64.0 – 66.249.95.255
72.14.192.0 – 72.14.255.255
74.125.0.0 – 74.125.255.255
209.85.128.0 – 209.85.255.255
216.239.32.0 – 216.239.63.255
64.18.0.0 - 64.18.15.255
108.177.8.0 - 108.177.15.255
172.217.0.0 - 172.217.31.255
173.194.0.0 - 173.194.255.255
207.126.144.0 - 207.126.159.255
216.58.192.0 - 216.58.223.255
iPv6
2001:4860:4000:0:0:0:0:0 - 2001:4860:4fff:ffff:ffff:ffff:ffff:ffff
2404:6800:4000:0:0:0:0:0 - 2404:6800:4fff:ffff:ffff:ffff:ffff:ffff
2607:f8b0:4000:0:0:0:0:0 - 2607:f8b0:4fff:ffff:ffff:ffff:ffff:ffff
2800:3f0:4000:0:0:0:0:0 - 2800:3f0:4fff:ffff:ffff:ffff:ffff:ffff
2a00:1450:4000:0:0:0:0:0 - 2a00:1450:4fff:ffff:ffff:ffff:ffff:ffff
2c0f:fb50:4000:0:0:0:0:0 - 2c0f:fb50:4fff:ffff:ffff:ffff:ffff:ffff
Internet Names and Addresses
10
Addresses, e.g. 129.10.117.100
Computer usable labels for machines
Conform to structure of the network
Names, e.g. www.northeastern.edu
Human usable labels for machines
Conform to organizational structure
How do you map from one to the other?
Domain Name System (DNS)
ICANN: Internet Corporation for Assigned Names and Numbers
What is ICANN's Role? ICANN is responsible for coordinating the
management of the technical elements of the DNS to ensure
universal resolvability so that all users of the Internet can find all
valid addresses.
History
11
The idea of mapping human-readable hostnames to numerical addresses
originated in the 1970s, with ARPANET, the predecessor of the modern
internet. The Stanford Research Institute (SRI) was responsible for
maintaining a text file called hosts.txt that mapped hostnames to computer
addresses on ARPANET.
Before DNS, all mappings were in hosts.txt
/etc/hosts on Linux
C:\Windows\System32\drivers\etc\hosts on Windows
Centralized, manual system
Changes were submitted to SRI(Stanford Research Institute ) via email
Machines periodically FTP new copies of hosts.txt
Administrators could pick names at their discretion
Any name was allowed
alans_server_at_sbu_pwns_joo_lol_kthxbye
Towards DNS
12
Eventually, the hosts.txt system fell apart
Not scalable, SRI couldn’t handle the load
Hard to enforce uniqueness of names
e.g MIT
Massachusetts Institute of Technology?
Melbourne Institute of Technology?
Many machines had inaccurate copies of hosts.txt
Thus, DNS was born
Interview question
13
DNS uses which protocol at transport layer
Interview question
14
DNS uses which protocol at transport layer
Why DNS uses UDP by default protocol
Does really TCP supports DNS when and why
Which port number DNS is supported
Interview question
15
Why DNS uses UDP by default protocol
UDP is for primary queries.
UDP is faster than TCP and UDP uses less network
resources
Does really TCP supports DNS when and why
TCP used in Zone transfer like big amount of data or
information which we want to share that time TCP will
come into the picture on port 53
16
Domain Name
17
It is the sequence of labels. In domain name the
sequence of labels are separated by dot (.). The domain
name is always read from the lower level to higher level
i.e., from the leaf node to root node. Since the root node
always represent NULL string, all the domain name end
with dot.
18
.org (organization)
.net (network)
.name (name)
.biz (business)
.info (information
Sponsored TLDs are restricted and certain guidelines must be met by
the person or company that wants to use them. They are:
47
.edu - Only educational institutions can use this.
Administered by ICANN
13 root servers, labeled AM
6 are anycasted, i.e. they are globally replicated
Contacted when names cannot be resolved
In practice, most systems cache this information
Map of the Roots
54
56
a3.nstl a.gtld-
d.com server
5
udel ns1.goo
server gle.com
3 iterative response (referral) 7
“I don't know. Try a.root-servers.net.”
iterative response (referral) 9
“I don't know. Try a.gtld-servers.net.”
1 iterative response (referral)
iterative response (referral)
“I don't know. Try a3.nstld.com.”
2 4 “I don't know. Try ns1.google.com.”
6 iterative response
8 “The IP address of www.google.com
Local 10 is 216.239.37.99.”
dns
iterative request
“What is the IP address of
www.google.com?”
DNS Server Class
70
All DNS servers fall into one of four categories:
Recursive resolvers, root nameservers, TLD
nameservers, and authoritative nameservers. In a typical
DNS lookup (when there is no caching in play), these
four DNS servers work together in harmony to
complete the task of delivering the IP address for a
specified domain to the client (the client is usually a
stub resolver - a simple resolver built into an operating
system).
https://ns1.com/resources/dns-types-records-servers-
and-queries
Local Name Servers
71 Where is
google.com?
Northeastern
www.neu.edu =
Where is www.neu.edu
155.33.17.68
www.neu.edu?
Northeastern
Root edu neu
com
Root
Iterated DNS query
75
www.google.com
Where is www.google.com?
Root
DNS Propagation
76
How many of you have purchased a domain name?
Did you notice that it took ~72 hours for your name to
become accessible?
This delay is called DNS Propagation
www.my-new-site.com
Root com
asgard.ccs.neu.edu ns.godaddy.com
asgard.ccs.neu.edu
Root
Zone files may be cached com
for 1-72 hours
www.my-new-site.com ns.godaddy.com
What Are DNS Records?
78
When you enter an internet address in the browser, the system
first has to look up which IP address belongs to this domain.
This sometimes occurs even in the computer’s memory itself,
often in the internet provider’s database or other DNS servers,
and in cases of uncertainty, via one of the large root servers that
monitor the entire Domain Name System as authority entities.
In order to perform a name resolution, the DNS records,
specifically the resource records, must be searched for in the
DNS and/or name servers.
Here, each IP address (known to the server) is assigned a
domain name.
How Do DNS Records Work?
79
DNS records are primarily located in zone files. With
respect to DNS, a zone denotes an organizational area.
It is possible for a domain to consist of a single zone.
Extensive domains, however, are often divided into
several zones.
Each DNS server is responsible for a zone. If a client
therefore wishes to activate a specific domain, it (or
more specifically, the DNS server) has a look in the
zone files for the appropriate records and forwards the
request to a lower-level server until the final destination
is reached.
DNS Record Syntax
80
Resource records are structured according to a simple
system and coded in ASCII. There is a separate line for
each DNS record. The records typically follow the
following format:
81
<name>: The domain name is the name that the user enters into their
browser.
<ttl>: TTL stands for “time to live” and denotes the time (in seconds) that a
record may be temporarily stored in the cache. After the time has lapsed, it
cannot be ensured that the resource record is still current. This information is
optional.
<class>: In theory, there are different classes of DNS records. In practice,
however, the records always refer to the internet (marked as IN), which is
why this information is also optional.
<type>: Different types of resource records appear in a zone file (for more
on this, see below).
<rdlength>: This optional field specifies the size of the subsequent data
field.
<rdata>: Resource data is the information according to which the domain
name can be resolved (such as the IP address).
The DNS record for the example.com web server thus
looks like this:
82
www.example.com. 12879 IN A 93.184.216.34
A client can store the record for 12,879 seconds (around
three and a half hours) in the cache before the
information must again be requested from the DNS
server. It involves a DNS record on the internet (IN) and
a type A record (A). The domain is resolved to an IP
address.
83
Another notation is also possible:
$TTL 12879
$ORIGIN example.com.
www A 93.184.216.34
This notation illustrates that the computer with the name
www is part of the example.com domain. This way,
other computers such as mail or ftp can be placed under
the origin domain.
The Most Important DNS Record
Types
84
A Record
The largest portion of name resolution on the internet takes place via the
type A record. An IPv4 address is located in its data field. Through these
records, it is possible for the internet user to enter a domain name in the
browser and for the client to send an HTTP request to the appropriate IP
address. Since an IPv4 address always has a size of 4 bytes, the value under
rdlength – if specified – is always 4.
AAAA Record
An AAAA record, also known as “quad A”, functions exactly like the A
record. However, it uses an IPv6 address instead of an IPv4 address to
resolve the name. Because IPv6 has a length of 128 bits (16 bytes), the data
field length is also predefined here. The AAAA designation is based on the
fact that the data field has four times the length of an A record data field.
85
SOA Record
SOA stands for Start of Authority. The records for this type contain
information on the zone that is organized by the zone file and/or the DNS
server. This is important – among other scenarios – during a zone transfer.
Here, zone files are mirrored to other servers in order to prevent failures. The
zone transfer regulates the periodic distribution of the original file. In this kind
of DNS record, a serial number is therefore also placed next to the mailing
address of the responsible administrator. This increases with each file update.
CNAME Record
Under a CNAME record (canonical name record), one finds an alias – an
additional name for a domain. Using this, the record refers to an existing A
record or AAAA record. With this type, the rdata field is filled with a domain
name that was previously linked with an IP address in the file. In this way,
different addresses can refer to the same server.
86
MX Record
An MX record refers to a mail exchange or an SMTP email server. One
or several email servers are defined here that belong to the relevant
domain. When using several mail servers (for example, to offset a
failure), they specify different priority levels. In this way, the DNS
knows in which sequence the contact attempt should proceed.
PTR Record
The PTR record (pointer) is a DNS record that permits a reverse lookup.
Through this technique, the DNS server can also provide information
regarding which host names belong to a specific IP address. For every IP
address that is used in A or AAAA records, there also exists a
corresponding PTR record. At the same time, the IP address is structured
in reverse sequence and is also provided with the name of a zone.
87
NS Record
In the NS record – a zone file’s name server record – the jurisdiction for
a specific zone is clarified. For this reason, this record is mandatory for
each zone file. This resource record gives the DNS server information
on whether it is responsible for the request – thus requiring it to
organize the relevant zone – and to whom it must forward the request.
TXT Record
The TXT record contains text that either is intended for human users as
an information source or is machine-readable information. This DNS
record gives an administrator the option of storing unstructured Text (in
contrast to the structured data of the other DNS records). This could
also include details about the company behind the domain.
88
SRV Record
Via the SRV record, a server can provide information
about other services (SRV). For this purpose, the service,
including the port at which it can be reached, is specified. In
addition, the used protocol forms part of the name. Via the
DNS record, a client can receive information on LDAP or
XMPP services.
LOC Record
Through the LOC record, the location of the physical
server can be disclosed. For this purpose, the latitude,
longitude, height above sea level as well as an error
deviation are given at the end of the record.
Zone File
89
In the zone file (a type of simple text file), all of the
DNS records are listed. In order for the data to be
correctly processed, specific guidelines must be
observed. Otherwise the DNS cannot function, and the
client will receive the SERVFAIL error message. For this
reason, it is necessary to adhere to a special structure:
Initially the zone name is specified, and then, in many
cases, the TTL. Adding the time information right here
has the advantage that, in the individual resource
records, the information can be omitted. The TTL is
then valid globally for the entire zone.
90
$ORIGIN example.com.
$TTL 12879
The first DNS record is a SOA record. Without this, a
zone file cannot function. Conversely, a zone file is then
also valid only if the SOA record is available. After that,
there are the first records for the name server, and then
the A and AAAA records.
DNS Resource Records
91
DNS queries have two fields: name and type
Resource record is the response to a query
Four fields: (name, value, type, TTL)
There may be multiple records returned for one query
What do the name and value mean?
Depends on the type of query and response
DNS Types
92
Type = A / AAAA
Query
Name: www.ccs.neu.edu
Name = domain name Type: A
Value = IP address
Name: www.ccs.neu.edu
Resp.
A is IPv4, AAAA is IPv6 Value: 129.10.116.81
Type = NS
Name = partial domain Query Name: ccs.neu.edu
Type: NS
Value = name of DNS server
for this domain
Name: ccs.neu.edu
Resp.
Type = CNAME
Query
Name: foo.mysite.com
Name = hostname Type: CNAME
Value = canonical hostname
Name: foo.mysite.com
Resp.
Useful for aliasing Value: bar.mysite.com
CDNs use this
ccs.neu.edu
DNS as Indirection Service
95
DNS gives us very powerful capabilities
Not only easier for humans to reference machines!
www.google.com
Content Delivery Networks
97
Response Spoofing
Eavesdrop on requests
Where is
DNS Spoofing
bankofamerica.com? 123.45.67.89
106
How do you know that a given
nameIP mapping is correct?
Where is dns.bofa.com
bankofamerica.com?
66.66.66.93
123.45.67.89
dns.evil.com
66.66.66.93
Where is
DNS Cache Poisoning
www.google.com? www.google.com =
Where is
107
bankofamerica.com? 74.125.131.26
dns.neu.edu ns1.google.com
Deployment
On the roots since July 2010
Verisign enabled it on .com and .net in January 2011
DNSSEC Hierarchy of Trust
111
.com (Verisign)
IP:
IP:123.45.67.89
66.66.66.93
Key: < >
Where is SIG:
SIG: 9na8x7040a3
x9fnskflkalk
bankofamerica.com? dns.bofa.com
dns.evil.com
Does DNSSEC Solve all our
problems?
112
No.
DNS still vulnerable to reflection attacks + injected
responses
113