Understanding Domain Name System (DNS)
Understanding Domain Name System (DNS)
• We knew that network layer provides unique identification and source to destination
delivery for a host on the Internet. For this, network layer uses its own IP protocol (for
source to destination delivery) and IP addressing (for unique identification).
• However, people prefer to use names instead of numeric addresses. Therefore, we
need a system that can map a name to an address or an address to a name.
• When the Internet was small, mapping was done by using a host file. Every host stores
these hosts file on its disk and update it periodically from a master file. This file had
two columns i.e., name and address.
• When a program or a user wanted to map a name to an address, the host consulted the
host file and found the mapping.
• Today, since the size of Internet is so large and growing day-by-day, the host file
becomes too large to store on every host. It would also be impossible to update all host
files every time there was a change.
• One solution to this problem is, instead of storing the host file on every computer, the
host file is stored on single computer and allows access to this centralized information
to every computer who needs mapping.
• But it will create large traffic on the Internet and number of users will not get the
mapping. So this solution also not works.
• Another solution is, instead of storing this huge information on single computer,
divide this huge information into smaller parts and store each part on a different
computer.
• The host that needs mapping can contact the closest computer holding the needed
information. This method is Doman Name System (DNS).
• Domain Name Systems (DNS) is mechanisms that assign easy to remember names to IP
address. Domain is a large group of computers on the Internet. Under this scheme
each computer has an IP address and a domain name.
• Domains have been made on the base of organization type or geographical locations,
e.g., the domain name [Link] (where, .com indicates that Google is a commercial
organization).
• In Fig. 1.1, a user wants to use a file transfer client to access the corresponding file
transfer server running on a remote host. The user knows only the file transfer server
name, such as [Link].
• However, the TCP/IP suite needs the IP address of the file transfer server to make the
connection. The following six steps map the host name to an IP address:
Step 1: The user passes the host name to the file transfer client.
Step 2: The file transfer client passes the host name to the DNS client.
Step 3: Each computer, after being booted, knows the address of one DNS server. The
DNS client sends a message to a DNS server with a query that gives the file
transfer server name using the known IP address of the DNS server.
Step 4: The DNS server responds with the IP address of the desired file transfer
server.
1.2
Computer Networks - II Application Layer
Step 5: The DNS client passes the IP address to the file transfer server.
Step 6: The file transfer client now uses the received IP address to access the file
transfer server.
Fig. 1.1: How TCP/IP uses a DNS Client and a DNS Server to
Map a Name to an Address
• Fig. 1.2 shows an example of how a DNS client/server program supports a user to find
IP address.
• The domain name space refers a hierarchy in the internet naming structure. In this
space, the names are defined in an inverted tree structure with the root at the top.
• The Fig. 1.3 shows the domain name space hierarchy.
1.4
Computer Networks - II Application Layer
• To have a hierarchical name space, a domain name space was designed. The names
are defined in an inverted-tree structure (Refer Fig. 1.3) with root at the top.
Label:
• Each node in the tree has a label, which is a string with a maximum of 63 characters.
The root label is null string.
Domain Name:
• Every node in the tree has a domain name. A full domain name is a sequence of labels
separated by dots (.).
• Domain names are always read from the node up to the root. Fig. 1.4 shows some
domain names.
1. Fully Qualified Domain Name:
• If a label is terminated by a null string, it is called a Fully Qualified Domain Name
(FQDN).
• A FQDN is the complete domain name for a specific computer, or host, on the Internet.
FQDN contains full name and all labels of a host.
• For example: [Link], [Link], [Link] etc.
2. Partially Qualified Domain Name:
• If a label is not terminated by a null string, it is called a Partially Qualified Domain
Name (PQDN).
• A PQDN starts from a node, but it does not reach the root.
• For example: unipune.
Root
edu
edu.
atc [Link].
challenger [Link].
3. Domain:
• A domain is a subtree of the domain name space.
• The name of the domain is the domain name of the node at the top of the subtree. A
domain may be divided into sub-domains.
edu
Domain
com
Domain
Domain
Domain
Domain
Root server
• DNS allows domains to be divided further into sub-domains. Each server can be
responsible for either a large or small domain. We have hierarchy of servers in the
same way as hierarchy of names.
• If the server divides the domain into sub-domains and assigns responsibility to
different servers, zone and domain are different. Each server has authority over a
zone.
• A DNS zone is a portion of the global Domain Name System (DNS) net-nuance for
which administrative responsibility has been delegated.
• The authority over each DNS zone is delegated to a legal entity or organization (i.e. a
country-code lop-level domain registry) or a company/individual.
• A zone is created mainly for administrative purposes. If a server stores the entire
domain, the zone and domain are the same.
Zone:
• Since, the complete domain name hierarchy cannot be stored on a single server, it is
divided among many servers. What a server is responsible for or has authority over is
called a zone.
• If a server accepts responsibility for a domain and does not divide the domain into
smaller domains (sub-domains), the "domain" and the 'zone" refers to the same thing.
• The server makes a database called a zone file and keeps all the information for every
node under that domain.
1.7
Computer Networks - II Application Layer
Root
com
Zone
Domain
Root Server:
• Root servers are DNS name servers that operate in the root zone. Root Server is the top
level server which consists of the entire DNS tree.
• It does not contain the information about domains but delegates the authority to the
other server.
• Root servers are an essential part of the infrastructure of the Internet; web browsers
and many other internet tools would not work without them.
Primary and Secondary Servers:
• DNS defines two types of servers i.e., Primary and Secondary.
1. Primary Servers:
• A primary server is a server that stores a file about the zone for which it is an
authority.
• It is responsible for creating, maintaining and updating the zone file. It stores the zone
file on a local disk.
2. Secondary Server:
• A secondary server is a server that transfers all information from the primary server.
• When the secondary downloads information from the primary, it is called zone
transfer.
Zone Transfer:
• A primary server loads all information from the disk file; the secondary DNS Server
loads all information from the primary server.
• When the primary DNS server downloads information from the secondary, it is called
zone transfer.
fhda
atc
chal
[Link].
Index to addresses
1.9
Computer Networks - II Application Layer
3. Inverse Domain:
• The inverse domain is used to map an address to a name. This can be happen, for
example, server want to check his authorized client.
• Fig. 1.11 shows example of inverse domain.
1.10
Computer Networks - II Application Layer
Index to names
Recursive Resolution:
• If the client (resolver) sends recursive query to the DNS server and expects the server
to supply the final answer, if that server is the authority for the domain name, it
checks the database and responds.
• If the server is not authority, it sends the request to another server and waits for
response. If this server is authority, it responds, otherwise it sends the query to yet
another server.
• When the query is finally resolved, the response travels back up to the requesting
client. This is called recursive resolution and it is shown in Fig. 1.12.
Root server
3
4
8
7
com
2 ac
6
9
1 5
10
[Link]
Client [Link]
1.12
Computer Networks - II Application Layer
• If the same or another client asks for the same mapping, it can check its cache memory
and gives reply. The server marks such type of response as un-authoritative.
• Caching speeds up the resolution but sometimes it can also be problematic.
Header:
• Both query and response messages have the same header format with some fields set
to zero for the query messages.
• The header is 12 bytes and its format is shown in Fig. 1.15.
Identification Flags
1.2 E-MAIL
• The main task of the Internet is to provide services to users. E-mail is most popular
application of Internet. E-mail is short form of electronic mail.
• At the beginning of the Internet, the messages sent by electronic mail were short and
contains text only. Today, e-mails are much more complex and contains text, audio
and video and one message can be sent to multiple recipients.
• We will study architecture of e-mail and the components of e-mail system in this
section.
1.15
Computer Networks - II Application Layer
Amar Bhushan
System
Second Scenario:
• In the second scenario, the sender and receiver of the e-mail are users from different
systems. The message is sent over the Internet. Thus, we need two user agents and
pair of MTAs (client and server).
• Amar, the sender uses user agent program to send her message at her own site.
Bhushan, the receiver needs user agent program to retrieve messages stored in the
mail box of the system at his site.
• To send the messages from Amar’s site to Bhushan’s site, two Message Transfer Agents
(MTAs) are needed, one client and one server. This is shown in Fig. 1.18.
User User
Agent (UA) Agent (UA)
Amar Bhushan
MTA MTA
client Internet client
System System
(mail server) (mail server)
Third Scenario:
• In this scenario, Bhushan, the receiver is directly connected to his system. Amar, the
sender is separated from him system. He is connected to the system via dial up modem
or DSL etc.
• Amar uses user agent to prepare his message.
• The message is now send through the LAN or WAN. This is done by using pair of
message transfer agent (client and server).
1.16
Computer Networks - II Application Layer
User MTA
agent Amar client
LAN
or
WAN
MTA
client
User
agent
Bhushan
MTA MTA
client Internet server
System System
(mail server) (mail server)
• MTA client establishes a connection with MTA server. MTA client then send the
message to the system at Bhushan’s site.
• System receives it and stores it in Bhushan’s mail box. As per his convenience,
Bhushan uses his user agent to retrieve his message.
• Note that, when the sender is connected to the mail server via a LAN or a WAN, we
need two UAs and two pairs of MTAs (client and server).
Fourth Scenario:
• In the fourth and most common scenario, Bhushan, the receiver is also connected to
his mail server by a WAN or LAN. When the message is arrived at Bhushan’s server,
he retrieves it by using another set of client/server agents also called as Message
Access Agents (MAAs).
• Bhushan uses MAA client to retrieve the message. The MAA client pulls the messages
from the mail server and pushes them into a special MAA server.
• Bhushan uses MAA client to retrieve messages from the MAA server.
1.17
Computer Networks - II Application Layer
• In short, we can say, when both sender and receiver are connected to the mail server
via a LAN or WAN, we need two UAs, two pairs of MTAs, and a pair of MAAs. This is
most common situation today, shown in Fig. 1.20.
User MTA MAA User
agent Amar client client Bhushan agent
LAN LAN
or or
WAN WAN
MTA MTA
client server
MTA MTA
client Internet server
System System
(mail server) (mail server)
Fig. 1.20: Fourth scenario in Electronic Mail
1.18
Computer Networks - II Application Layer
27/11/2015
1.2.3 MIME
• E-mail system has one limitation, it can send messages only in NVT 7-bit ASCII. It
cannot be used for languages like German, Russian, Chinese, Japanese and Hebrew.
Also it cannot be used to send binary files or video or audio data.
• The Multipurpose Internet Mail Extensions (MIME) is a protocol that allows non-ASCII
data to be sent through e-mail.
1.20
Computer Networks - II Application Layer
• MIME transforms non-ASCII data at sender site to NVT (Network Virtual Terminal)
ASCII and delivers them to the client MTA to be sent through the Internet. The message
at the receiving site is transformed back to the original data
• Suppose a user (Amar) wants to send an email through user agent and it is in a non-
ASCII format so there is a MIME protocol which converts it into 7-bit NVT ASCII
format.
• Message is transferred through e-mail system to the other side in 7-bit format now
MIME protocol again converts it back into non-ASCII code and now the user agent of
receiver side reads it and then information is finally read by the receiver (Bhushan).
1.2.4 Message Transfer Agent: SMTP (April 16, 17, Oct. 17)
• The mail transfer is done by Message Transfer Agents (MTA). To send mail, a system
must have client MTA and to receive mail, a system must have server MTA.
• The protocol that defines the communication between MTA client and MTA server is
called Simple Mail Transfer Protocol (SMTP).
• SMTP is a TCP/IP protocol that specifies how computers exchange electronic mail.
SMTP is used twice, between the sender and the sender’s mail server and between the
two mail servers.
• Another protocol i.e. POP3 or IMAP4 is needed between the mail server and the
receiver.
POP3/
SMTP SMTP IMAP4
Amar Bhushan
sender receiver
LAN LAN
or or
WAN WAN
Code Description
Positive Completion Reply
211 System status or help reply
214 Help message
220 Service ready
221 Service closing transmission channel
250 Request command completed
251 User not local, the message will be forwarded
Positive Intermediate Reply
354 Start mail input
Transient Negative Completion Reply
421 Service is not available
450 Mail box not available
451 Command aborted: local error
452 Command aborted: insufficient storage
1.23
Computer Networks - II Application Layer
Fig. 1.29
1.25
Computer Networks - II Application Layer
2. IMAP4:
• IMAP stands for Internet Mail Access Protocol. It was first proposed in 1986. The
current version is Internet Mail Access Protocol, version 4 (IMAP4).
• Another mail access protocol is IMAP4 is similar to POP3 but is more powerful and
more complex.
• POP3 not allows the user to organize mail on the server, the user cannot have different
folders on the server.
• POP3 also does not allow the user to partially check the content of mail before
downloading. All these drawbacks are overcome in IMAP4.
• IMAP4 provides following functions:
(i) User can check e-mail header before downloading.
(ii) User can search the contents of the e-mail for a specific string of characters before
downloading.
(iii) User can partially download e-mail.
(iv) A user can create, delete or rename mailboxes on the mail server.
(v) User can create a hierarchy of mailboxes in a folder for storage.
1.26
Computer Networks - II Application Layer
Sr.
POP IMAP
No.
1. Generally used to support single Designed to handle multiple clients.
client.
2. Messages are accessed offline. Messages are accessed online although it
also supports offline mode.
3. POP does not allow search facility. It offers ability to search emails.
4. All the messages have to be It allows selective transfer of messages
downloaded. to the client.
5. Only one mailbox can be created on Multiple mailboxes can be created on
the server. the server.
6. Not suitable for accessing non-mail Suitable for accessing non-mail data i.e.
data attachment.
7. POP commands are generally IMAP commands are not abbreviated,
abbreviated into codes of three or they are full. Example: STATUS.
four letters. Example: STAT.
8. It requires minimum use of server Clients are totally dependent on server.
resources.
9. Mails once downloaded cannot be Allows mails to be accessed from
accessed from some other location. multiple locations.
10. The e-mails are not downloaded Users can view the headings and sender
automatically. of e-mails and then decide to download.
11. POP requires less internet usage IMAP requires more internet usage time.
time.
1.27
Computer Networks - II Application Layer
1.3.1 FTP
• FTP stands for File Transfer Protocol. FTP is the standard mechanism provided by
TCP/IP for copying (transferring) a file from one host to another.
• FTP can transfer files between any computers that have an Internet connection, and
also works between computers using totally different operating systems.
• Transferring files from a client computer to a server computer is called "uploading"
and transferring from a server to a client is "downloading".
FTP commands
FTP replies
Data
User
User
interface
Control connection
Control Control
process process
TCP/IP
Data transfer Data transfer
process process
Data storage Data connection Data storage
Client Server
Fig. 1.32: Basic Model of FTP
• Communication with an FTP server is done through two connections, a control
connection, and a data connection.
• FTP uses two well-known TCP ports for connections Port 21 is used for the control
connection and port 20 is used for the data connection.
1.29
Computer Networks - II Application Layer
Control Control
transfer transfer
process Data connection process
Client Server
o A list of directory or file names is to be sent from the server to the client. The FTP
treats a list of directory or file names as a file. It is sent over the data connection.
PRACTICE QUESTIONS
Q.I Multiple Choice Questions:
1. Which is the top most layer in OSI model and TCP/IP model?
(a) Session (b) Physical
(c) Application (d) Transport
2. Consider following different activities related to email:
m1: Send an email from a mail client to a mail server.
m2: Download an email from mailbox server to a mail client.
m3: Checking email in a web browser.
Which is the application level protocol used in each activity?
(a) m1: HTI m2: SMTP m3 POP (b) m1 SMTP m2: FTP m3: HTTP
(c) m1: SMTP m2 POP m3: HTTP (d) m1. POP m2 SMTP m3 IMAP
3. What is the maximum size of data that the application layer can pass on to the TCP
layer below?
16
(a) Any Size (b) 2 bytes- size of TCP header
16
(c) 2 bytes (d) 1500 bytes
4. Identify the correct order in which the following actions take place in an
interaction between a web browser and a web server.
(i) The web browser requests a webpage using HTTP.
(ii) The web browser establishes a TCP connection with the web server.
(iii) The web server sends the requested webpage using HTTP.
1.33