Internet Technology
03. Domain Name Server
Adhi Rizal
1
Today we’ll examine
• DNS: Domain Name System
• HTTP: Hypertext Transfer Protocol
• FTP: File Transfer Protocol
2
Domain Name System
3
How are IP addresses assigned?
IP addresses are distributed hierarchically
• Internet Assigned Numbers Authority (IANA) at the top
– IANA is currently run by ICANN
• Internet Corporation for Assigned Names and Numbers IANA
RIPE
Regional Internet Registries (RIR) AfriNIC APNIC ARIN LACNIC
NCC
Allocate blocks of addresses to ISPs
RIR Map
ISP ISP ISP ISP ISP ISP
ISP ISP
4
How are machine names assigned?
Mac Address
vendor-assigned number
OUI
(Organizationally Unique Identifier)
8 bit 8 bit 8 bit
• A domain hierarchy was created in 1984 (RFC 920)
– Domains are administrative entities: divide name management
– Tree-structured global name space
– Textual representation of domain names
www.stmik-kharisma.ac.id
5
Domain Name Hierarchy
Root
com edu gov ac net org id ae nl us zw
generic TLDs country-code TLDs
stmik-kharisma
www
6
Top Level Domains (TLDs)
ccTLD IDN ccTLD gTLD
Country-code domains Internationalized Generic top-level domains
ISO 3166 codes country-code domains e.g., .biz, .com, .edu,
e.g., .id, .us, .de, .ca, e.g., .ةيدوعسال, .中國 , .рф .gov, .info, .net, .org, .ac
.es
There are currently 1,239 top-level domains
Each top-level domain has an administrator assigned to it
Assignment is delegated to various organizations by the Internet Assigned
Numbers Authority (IANA)
See http://www.iana.org/domains/root/db for the latest count
7
Tahap Registrasi Domain
• Domain name registry: this is the database
– Keeps track of all domain names registered in a top-level domain
• Domain name registry operator: this is the company that runs the db
– NIC = Network Information Center – organization that keeps track of the
registration of domain names under a top-level domain
– keeps the database of domain names
• Domain name registrar: this is the company you use to register
– Company that lets you register a domain name
DN
DN DN
Registry
Registry Registrar
Operator
8
The problem
Every device connected to the Internet has a unique
Internet Protocol (IP) address
How do you resolve user-friendly machine names to
IP addresses?
stmik-charisma.ac.id IP Address??
10
DNS: Domain Name System
• Distributed database
– Hierarchy of name servers
• DNS is an application-layer protocol
– Name-address resolution is handled at the edge
– The network core is unaware of host names
12
DNS provides
• Name to IP address translation
• Aliasing of names (called canonical names)
• Identification of name servers
• Mail server names
13
DNS is a distributed, hierarchical database
Root DNS
Servers
com DNS edu DNS org DNS
Servers Servers Servers
google.com rutgers.edu columbia.edu pk.org DNS
DNS Servers DNS Servers DNS Servers Servers
A collection of DNS servers
14
Jenis DNS Server Records
Key data that a DNS server maintains (partial list)
Information Abbreviation Description
Host A Host address (name to address)
Includes name, IP address, time-to-live
(TTL)
Canonical name CNAME Name for an alias
Mail exchanger MX Host that handles email for the domain
Name server NS Identifies the name server for the zone:
tell other servers that yours is the
authority for info within the domain
DLL DLL DLL
16
Finding your way
• How do you find the DNS Server for stmik-charisma.ac.id?
– That’s what the domain registry keeps track of
– When you register a domain, you supply the addresses of at least
two DNS servers that can answer queries for your zone
• So how do you find it?
– Start at the root
17
Root name servers
• The root name server answers can return a list of
authoritative name servers for top-level domains
• 13 root name servers
– A.ROOT-SERVERS.NET , B.ROOT-SERVERS.NET , …
– Each has redundancy (via anycast routing or load balancing)
Download the latest list at http://www.internic.net/domain/named.root
18
DNS Queries
Iterative (non-recursive)
•
- Client mengirimkan query ke masing-masing Name Server.
- root name server
- id name server
- ac name server
- Name Server mengirimkan hasil query (per bagian) yang diminta
client secara bertahap
- Kelebihan algoritma sederhana (satu perintah untuk mengakses
semua name server) dan stateless (name server tidak menyimpan
kondisi pencarian)
• Recursive DNS name resolution
– Name server bertanggung jawab penuh menerjemahkan query
• Query dapat dikirimkan kembali ke DNS Server lain jika query belum bisa terjawab
– Kekurangan beban kerja name server lebih banyak dan harus
– menyimpan kondisi pencarian
– Kelebihan Caching di setiap name server dan beban kerja client
lebih ringan
Most top-level DNS servers only support iterative queries
19
DNS Resolvers: local name server
Agen penerjemah/pencari DNS yang terletak di komputer atau di ISP pengguna
• DNS Resolver
– Not really a part of the DNS hierarchy
– Acts as an intermediary between programs that need to resolve names and the
name servers
– A resolver is responsible for performing the full resolution of the query
• Where are they?
– Local system has one: that’s what applications contact
• Local cache; may be a process or a library
• On Linux & Windows, these are limited DNS servers (called stub resolvers): they are not
capable of handling referrals and expect to talk with a name server that can handle recursion
(full resolution)
– ISPs (and organizations) run them on behalf of their customers
• Including a bunch of free ones (OpenDNS, Google Public DNS)
• Resolvers cache past lookups – not responsible for zones
20
Using a DNS resolver
To look up a name:
– Send a DNS query to the local resolver (recursion requested)
• Local resolver
– If the local resolver has cached results, it can return the answer
– Otherwise, consult a local hosts file (e.g., /etc/hosts) to return locally-
configured name→address mappings
– Otherwise contact a DNS server that the client knows about – this is
typically another resolver that is provided by the ISP
• The local system is configured with one or more addresses of external name
servers
• ISP Resolver
– Check cache
– Check a locally-configured zone file (if any). If the desired data is there,
return an authoritative answer
– Otherwise, do an iterative set of queries to traverse the hierarchy to find
the desired name server and get results
21
DNS Resolvers in action
Local server ISP
app DNS stub DNS Iterative
resolver resolver lookup
app cache cache DNS hierarchy
/etc/hosts zone info
Local stub resolver: External resolver
- check local cache - DNS server that accepts recursion
- check local hosts file - Running at ISP, Google Public DNS,
- send request to external resolver OpenDNS, etc.
E.g., on Linux: resolver is configured via
the /etc/resolv.conf file
22
The DNS Query Protocol
26
DNS Records
• DNS servers store resource records (RRs)
• Format
– Name, value, type of record, TTL (time to live)
• Common types
– Address: A – Canonical name: CNAME
• Name: hostname • Name: alias hostname
• Value: IP address • Value: real hostname
– Name Server: NS – Mail Exchanger: MX
• Name: domain (rutgers.edu) • Name: hostname
• Value: hostname of authoritative • Value: mail server for hostname
name server for the domain
microsoft.com. 600 IN A 150.150.150.1
27
DNS Protocol
• DNS is a service that listens to requests on TCP or UDP port 53
• Protocol consists of query and reply messages
– Both messages have the same format and header
Identification Flags
Number of Number of answer
Identification 12 bytes
questions RRs
16 bit number for query.
Number of
Matching number for reply. Identification
additional RRs
Questions
(variable # of questions)
Flags
Query or reply (request/response) Answers
(variable # of resource records)
Recursion desired (request)
Recursion available (response) Authority
(variable # of resource records)
Reply is authoritative (response)
Additional Information
(variable # of resource records)
28
DNS Protocol
• DNS is a service that listens to requests on TCP or UDP port 53
• Protocol consists of query and reply messages
– Both messages have the same format and header
Identification Flags
Number of Number of answer
questions RRs 12 bytes
Name, type fields for a query
Number of
Identification
additional RRs
Resource records in Questions
responds to query (variable # of questions)
Answers
(variable # of resource records) variable
Records for authoritative
servers Authority
(variable # of resource records)
Additional Information
Additional helpful information
(e.g., other DNS servers in (variable # of resource records)
domain)
29
Reverse DNS
• What if we have an IP address and want the name?
• Special domain for reverse lookups
– in-addr.arpa
– ARPA = Address & Routing Parameter Area,
not Advanced Research Projects Agency (e.g., ARPANET)
www.cs.rutgers.edu → 128.6.4.24
24.4.6.128.in-addr.arpa → www.cs.rutgers.edu
31