Understanding Domain Name System (DNS)
Understanding Domain Name System (DNS)
Name Space
It is a representation of the domains of the Internet as a tree structure. Each domain can be subdivided
into many other domains, which are further partitioned thereby creating a hierarchy. The leaf nodes of
the tree cannot be subdivided and each leaf node may contain only a single host or several hosts. The
top-level domains are classified into two groups, namely, generic and country. The generic group con-
tains domain names such as com (commercial), edu (educational institutions), gov (governments), int
(international organizations), mil (armed forces), net (network providers) and org (organizations). The
country domains contain one entry for every country, as per ISO 3166 specification. The tree structure
of the name space is shown in Figure 13.1.
Generic Countries
A label is included in each node of the tree (Figure 13.2). The label is a string, which has a maximum
size of 63 characters. The label at the root node is just an empty string. The child nodes, which have the
same parent, are not allowed to have the same label name as it may cause ambiguity. Each node in the
root(.)
edu.
edu
[Link]. Domain
flag names
Labels
[Link].
tc
[Link].
terminator
Figure 13.2 Labels and Domain Names
tree has a domain name, which is formed by a sequence of labels separated by dots (.). The domain
names are again divided into two types, namely, fully qualifie domain name (FQDN ) and partially
qualified domain name (PQDN ).
FQDN: If the domain name ends with a dot (.), that is, null string, it is said to be an FQDN. It is
the full name of a host, which includes all labels, starting from the host label toward the root label,
which is a dot (.). For example, in Figure 13.2, the FQDN of a host named terminator installed at
the technology centre tc is [Link] .
PQDN: If a domain name does not end with a null string, then it is said to be a PQDN. This means
a PQDN starts with the host label but does not end with the root node. A partial domain name ad-
dress is used when the domain name and the client reside in the same site. The PQDN can take
help of the resolver to convert it to an FQDN. For example, if a person at the [Link] site wants
to get the IP address of the terminator computer, he/she defines only the partial name terminator.
The rest of the part (called suffi ), that is, [Link] , is added by the resolver and then the address
is passed to the DNS server.
Resource Records
Every domain is associated with a set of information known as resource records (RRs). The most com-
mon RR is the IP address for a single host, although many other kinds of resource records are also found.
A RR is a five-tuple set, which is mostly represented as ASCII text, but for better efficienc , it can also
be encoded in binary form. The different fields of the five-tuple set are described as follow
Domain_Name: This field identifies the domain with which this record is associated. Usually, many
records related to a single domain exist in the databases and the database contains RRs for multiple
domains. Thus, this field is used for search operations so that queries an be executed efficientl .
Time_to_Live: This field indicates the stability of the record. It specifies the time interval with-
in which a RR may be cached by the receiver so that the server need not be consulted for RR
repeatedly. A zero value in this field indicates that the RR is to be used for a single transaction and
therefore, should not be cached. The highly stable records are given large values while less stable
records are given small values.
Class: This field identifies the protocol family. It is set to IN for Internet information; otherwise,
some other codes are used.
Type: This field specifies the type of the recor
Value: This field depends on the Type field and can be a domain name, a number or an ASCII
character.
Name Servers
As DNS database is very vast, it is impossible for a single server to hold information about the complete
database and respond to all queries. Even if it is done, then a failure in the single name server would
bring the whole network down. To avoid such a situation, the DNS name space is divided into many
non-overlapping zones (represented by dotted areas in Figure 13.3) with each zone containing name
servers holding information about that zone. Each zone covers some nodes of the tree and contains a
group of one or more subdomains and their associated RRs that exist within that domain. The name
server creates a zone file, which holds all the information of the nodes under it. Each zone has a primary
name server and one or more secondary name servers. The primary name server of a zone obtains the
information from a file on the disk, whereas the secondary name servers obtain information from the
primary name server. Some servers can also be located outside the zone to improve the reliability.
Generic Country
CS cs
Iinda keio nec
john
texas
Advantages Disadvantages
• The delivery of messages is very fast, sometimes • Although e-mail is delivered instantly, the recipient may
almost instantaneous, even though the message is or may not read his/her mail on time. That defeats the
meant for overseas or just to a friend next door. quickness of electronic mailing.
• The cost of e-mailing is almost free as it involves • The user must stay online to read and write more than
negligible amount of telephone and ISP charges. one mail. In addition, most webmail either display
advertisements during use or append them to mails
sent. It results in increased size of the original mail,
which brings a significant decrease in speed of use.
• M
ultiple copies of the same message can be sent • Since e-mail passes through a network, therefore, it
to a group of people at the same time and can be may be intercepted in between. Moreover, viruses can
sent as easily to a single person. enter the system while downloading the e-mails.
• Pictures, documents and other files can also be • The slightest error in the address or a failure in one
attached to messages. of the links between sender and receiver is enough to
prevent a delivery.
MTA MAA
UA A B UA
client client
LAN/WAN LAN/WAN
MTA MAA
server server
Message Message
MTA MTA
Internet
client server
Reading Messages: This service helps the user to read the messages, which are in its inbox. Most
user agents show a one-line description of each received mail.
Replying to Messages: This service is used to reply to the messages that have been received by
the user. While replying, a user can send a new reply or may include the original message sent by
the sender along with the new one. Moreover, the user can reply either to the original sender or to
all the recipients of message.
Forwarding of Messages: This service helps the user to forward the message to the third party
instead of sending it to the original sender. The user can also add some more content in the message
to be forwarded.
Handling Mailboxes: The user agent is responsible for maintaining all the mailboxes in e-mail
system. Basically, it creates two types of mailboxes, namely, inbox and outbox. The inbox contains
all the messages received by a user and the outbox contains all the messages sent by the user. The
messages are kept in both mailboxes until the user deletes them.
There are two types of UAs namely, command-driven and graphical-user-interface (GUI )-based
UAs. These types are described as follows:
Command-driven UA: This UA was used in the early days in e-mail. In this type, the user can
type one character at a time at the command prompt while replying to the sender. A few command-
driven UAs include pine, elm and mail.
GUI-based UA: This UA being used nowadays allows the user to use both mouse and keyboard
to interact with the software. As the name of this UA suggests, it provides GUI components such
as menus and icons that help the users to access the services more easily. Thus, GUI-based UAs
are more user friendly.
Content Transfer Encoding: This header defines the different methods used for encoding the
messages into various formats, so that it can be transmitted over the network. Some schemes used
for encoding the message body are listed in Table 13.3.
Type Description
7 bit NVT ASCII characters and short lines
8 bit Non-ASCII characters and short lines
Binary Non-ASCII characters with unlimited length
between the sender and the receiver, SMTP is used twice. Once, it is used to transfer the mail from
sender’s end to sender’s mail server, and then to transfer the mail from sender’s mail server to receiver’s
mail server. To retrieve the mail from receiver’s mail server at the receiver’s end, a different mail pro-
tocol such as POP3 and IMAP (discussed in the next question) is used. While transferring mails, SMTP
uses commands and responses between MTA client and MTA server.
Commands: They are sent from the client machine to the server machine. The syntax of a com-
mand consists of a keyword followed by zero or more arguments. There are total 14 commands
defined by SMT some of which are listed in Table 13.4.
Table 13.4 SMTP Commands
Responses: They are just the opposite of commands, that is, they are sent from a server machine
to a client machine. A response consists of a three-digit code, which may be followed by additional
textual information. Some of the SMTP responses are shown in Table 13.5.
Code Information
221 Service closing transmission channel
354 Start mail input
500 Syntax error, unrecognized command
503 Bad sequence or commands
POP3 software must be installed on the recipient’s machine and on its mail server, respectively. Further,
POP3 works in two modes: delete mode and keep mode. In the delete mode, as a message has been
pulled from the mail server, it is deleted from the mailbox on the mail server. On the other hand, in the
keep mode the message remains in the mailbox even after it has been pulled from the mail server. This
mail can be read later from any other computer or location.
Whenever a recipient (client) needs to retrieve mails from the mail server, it establishes a TCP con-
nection to the server on the port 110. Then, it passes its username as well as the password to the mail
server to get access to the mailbox on the mail server. After the server has verified the client, the client
can list and download the messages one at a time.
POP3 has some disadvantages, which are as follows:
POP3 does not support mail organization on the server, that is, a user cannot have different folders
on the mail server.
POP3 does not allow the contents of the mail to be checked in parts while the mail is being down-
loaded. The mail can be checked after it has been completely downloaded.
(b) IMAP4: It stands for Internet mail access protocol and the number 4 denotes its version number.
Like POP3, it is also an MAA protocol but it provides more functionality and is more complex than
POP3. Some of the additional features provided by IMAP4 are as follows:
A user can create folders on the mail server and can delete or rename the mailboxes.
IMAP enables the user to partially download the mails. This is especially useful in cases where a
message contains large audio and video files, which may take a lot of time to download because
of slow Internet connection. In such cases, the user can download only the text part of message if
required using IMAP4.
A user can search through the contents of the messages while the messages are still on the mail
server.
IMAP allows the user to check the contents of the e-mail before it has been downloaded.
A user can selectively retrieve the attributes of messages such as body, header, etc.
User
User
interface
Control
connection
Control Control
process process
TCP/IP
Data Data
Disk transfer transfer Disk
process Data connection process
Client Server
Figure 13.6 Mechanism of File Transfer in FTP
and server are connected via control connection, whereas the data transfer process of client and server
are connected via data connection. The control processes of client and server communicate using NVT
format. They are responsible for converting from their local syntax such as DOS or UNIX to NVT
format and vice versa. The data transfer processes of client and server communicate under the control
of commands transferred through the control connection.
13. Explain the following with respect to FTP:
File Type
Data Structure
Transmission Mode
Ans: To transfer a file through the data connection in FTP, the user (client) has to specify certain
attributes to the server including type of file to be transferred, the data structure and the transmission
mode so that the control connection could be prepared accordingly. These attributes are described as
follows:
File Type: FTP supports three types of files for transmission over the data connection, namely, an
ASCII fil , EBCDIC fil or image file. The ASCII fil is the default format used for text files. It
uses the 7-bit ASCII format to encode each character of text file. The sender converts the file from
its original form to ASCII characters, while the receiver converts the ASCII characters back to the
original form. If EBCDIC encoding (file format used by IBM) is supported at the sender or receiver
side, then files can be transmitted using the EBCDIC encoding. The image fil is the default format
used in the transmission of binary files. Binary files are sent as continuous stream of bits without
using any encoding method. Usually, the compiled programs are transferred using the image file
Data Structure: FTP uses three data structures to transfer a file, namely, file structure, record struc-
ture and page structure. When file structure format is used, the file is sent as a continuous stream of
bytes. The record structure can be used only with text files and the file is divided into many records.
In page structure, each file is divided into a number of pages where each page contains a page
number and a page header. These pages can be accessed sequentially as well as randomly.
Transmission Mode: FTP uses three types of transmission modes, namely, stream mode, block
mode and compressed mode. The default mode of transmission is the stream mode, which sends
the data as a continuous pattern of bytes. In case the data contains only a stream of bytes, then no
end-of-file (closing of data connection) is required; the end of file is simply indicated by closing
of connection by the sender. In the block mode, data is sent in blocks, where each block is pre-
ceded by a 3-byte header. The first byte is just a description about the block and the next two bytes
define the size of the block in bytes. The compressed mode is used in case of large files to reduce
their size so that they can be transmitted conveniently. The size of file is reduced by replacing
multiple consecutive occurrences of characters with a single character or reducing the number of
repetitions. For example, in text files blank spaces can be compressed
Client (Browser)
Browser is a program which accesses and displays the web pages. It consists of three components, namely,
controller, interpreter and client protocol. The user provides inputs (request for a web document)
to the controller through a keyboard or a mouse. After receiving the input, the controller uses client
p rotocols such as FTP or HTTP to access the web document. Once the controller has accessed the
desired web document, it selects an appropriate interpreter such as hypertext markup language (HTML)
or JavaScript depending on the type of the web document accessed. The interpreters help the controller
to display the web document. A few of the web browsers used today include Microsoft Internet Explorer,
Opera and Google chrome.
To understand how a browser works, consider a user who wants to access the link [Link]
[Link]/home/[Link]. When the user provides this link (URL) to the browser, the browser goes
through the following steps:
1. The browser determines the given URL and sends a query to the DNS server asking for the IP
address of [Link].
2. The DNS sends a reply to the browser, providing the desired IP address.
3. A TCP connection to port 80 on the received IP address is made by the browser.
4. The browser then sends a request for the file home/[Link].
5. The file home/[Link] is sent by the [Link] server.
6. The TCP connection is ended.
7. The browser displays the text in the file /home/[Link]. It also fetches and displays the images
in the file
Server
Server is the place where web pages are stored. On a request from the client, the server searches the
desired document from the disk and returns the document to the browser through a TCP connection. The
steps performed by a server are as follows:
1. The server accepts the TCP connection request arriving from the client.
2. It then acquires the name of the file requested by the client
3. The server retrieves the file from the disk
4. The file is sent back to the client
5. The TCP connection is released.
The efficiency of a server can be improved by caching the recently accessed pages so that those pages
could be directly accessed from memory and need not be accessed from the disk. Moreover, server can
support multithreading, that is, serving multiple clients at the same time to increase the efficienc .
the protocol and the domain name. Then comes the last part of a URL, namely, the path and the file name.
The path name specifies the hierarchical location of the said file on the computer. For instance, in http://
[Link]/tutor/start/[Link], the file [Link] is located in start, which is a subdirectory of tutor.
Cookies
Cookies are the small files or strings, which are used to store information about the users. This stored
information may be later used by the server while responding to the requests of the client(s). For some
particular sites, only registered users are permitted to access the information. In such a case, the server
stores the user’s registration information in the form of cookies on the client’s machine. The size of a
cookie file cannot exceed 4 KB. A user can disable the cookies in the browser or can even delete them.
16. What is HTTP? Describe the format of HTTP request and response message.
Ans: Hypertext transfer protocol (HTTP) is the most common protocol that is used to access infor-
mation from the Web. It manages the transfer of data between the client and the server. The older version
of HTTP was 1.0, in which TCP connection was released after serving a single request. This was not ad-
equate as every time a new connection had to be established. This led to the development of HTTP version
1.1 that supports persistent connection, that is, it is meant for multiple request–response operations.
Further, HTTP is a stateless protocol and all the transactions between the server and client are carried
out in the form of messages. The client sends a request message to the server and the server replies with
a response message. The HTTP request and response messages have a similar format (Figure 13.7) ex-
cept that in request message, the first line is the request line while in response message, and the first line
is the status line. The remaining part of both the messages consists of a header and sometimes, a body.
Headers Headers
Body Body
The HTTP request messages are of different types, which are categorized into various methods as
shown in Table 13.6.
For each HTTP request message, the server sends an HTTP response that consists of status line and
some additional information. The status line comprises a three digit status code, similar to the response
message of FTP and SMTP. The status code indicates whether the client request is satisfied or if there is
some error. The first digit of the status code can be 1, 2, 3, 4 or 5 and it indicates one of the five groups
Method Description
GET Request to access a web page from the server.
HEAD Request to get the header of a web page
PUT Request to store a web page
POST Append to a named resource
DELETE Remove the web page
TRACE Echo the incoming request
CONNECT Reserved for future use
OPTIONS Enquire about certain options
into which response messages have been divided. Codes falling in the 100 range are only informational
and thus, rarely used. The codes falling in the 200 range indicate a successful request, codes in the 300
range redirect the client to some other site, the codes in the 400 range indicate an error in the client side
and the codes in the 500 range indicate an error at the server site.
Further, HTTP also contains various headers, which are
used to transfer additional information other than the normal
Header name Header value
message between the client and the server. For example, the
request header can ask for a message to be delivered in some
particular format while a response header can contain a de-
scription of the message. The additional information can be Space
included in one or more header lines within the header. Each Figure 13.8 HTTP Header Format
header line has a format as shown in Figure 13.8.
Each header line may belong to one of the four types of HTTP
headers, which are discussed as f ollows:
General Header: This header can be included in both request and response message. It contains
general information about the sent or received messages. An example of a general header is Date
that is used to display the current date.
Request Header: This header can be used only in the request messages from the client. The details
about the client setup and the preference of the client for any particular format are included in this
header. An example of a request header is the From header, which shows the e-mail address of
the user.
Response Header: This header is part of the response messages only. It contains the server’s setup infor
mation. An example of a response header is the Age header, which shows the age of the d ocument.
Entity Header: This header includes information about the body of a document. It is mostly pres-
ent in the request or response messages. An example of entity header is the Allow header, which
lists the valid methods that can be used with a URL.