1.application Layer
1.application Layer
APPLICATION LAYER
1.INTRODUCTION
• – Centralized
• – Distributed
– A single point of failure: DNS server crashes, so does the entire Internet!
– Traffic volume: A single DNS server would have to handle all DNS queries generated from
hundreds of millions of hosts
–– Maintenance: The single DNS server would have to keep records for all Internet hosts.
Management of it becomes very difficult!
• A Distributed Domain Name System (DNS) is a system that distributes the
responsibilities of resolving domain names to IP addresses across multiple servers or
nodes.
• Advantages of distributed domain name system
1.Improved Fault Tolerance:
2. Increased Scalability
3. Reduced Latency
4. Enhanced Security
5. Resistance to Censorship
Name Space
A namespace is a context within which the names of all objects must be unambiguously resolvable.
• A name space that maps each address to a unique name can be organized in two ways:
flat -usually used for small internets
hierarchical -a hierarchical system used by large internets, including the Internet
Flat name space
In a flat namespace, each host name consists of a sequence of characters without any further structure. A
single authority maintains a table of the host names and assigned internet addresses to avoid naming
conflicts and to regulate the names.
• Advantages:
1. Names are convenient and short.
2. They are stored at a central location, so access is easier.
• Disadvantages:
1. Cannot be used for large system like Internet for both technical and administrative reasons.
2. The potential for conflicts increases as number of sites increases.
Flat name space
Hierarchical name space:
• each name is made of several parts
– the first part can define the nature of the organization
– the second part can define the name of an organization
– the third part can define departments in the organization
Advantages
1. The name is made up of several parts; each defining a level in a hierarchy.
2. The authority to assign names can be decentralized. This reduces burden on a single entity.
3. Flexible and extensible.
4. Even if the prefix chosen for a host is taken by another organization i.e. part of the address is the same,
whole address is different. For example, compsc.acollege.edu compsc.anothercollege.edu are different
addresses.
• Disadvantages
1. Requires communication and coordination between several authorities.
2. Modifications are difficult to make.
Hierarchical name space:
Sr. No. Flat Name Space Hierarchical Name Space
1. Each name consists of sequence of characters Each name is made of several parts , each
without any further structure. defining a level in a hierarchy.
5. As the names are drawn from a single set of Even if part of the names are same, the
identifiers, the potential for conflicts increases. whole address is unique.
• 6. Which one of the following allows client to update their DNS entry as their IP address change?
a) dynamic DNS
b) mail transfer agent
c) authoritative name server
d) none of the mentioned
• 7. The right to use a domain name is delegated by domain name registers which are accredited by _______
a) internet architecture board
b) internet society
c) internet research task force
d) internet corporation for assigned names and numbers
• 8. The domain name system is maintained by _______
a) distributed database system
b) a single server
c) a single computer
d) none of the mentioned
2. Answer: b
Explanation: DNS client also known as DNS resolver also known as DNS lookup helps to resolve
DNS requests using an external DNS server.
3. Answer: b
Explanation: Whenever a request is received at server from other domains, it handles this situation
by contacting remote DNS server.
4. Answer: d
Explanation: Domain Name system not only deals with mapping IP addresses with the hostname
but also deals with exchange of information in the server.
5. Answer: a
Explanation: Root name servers are actually very important and critical as they are the first step in
translating human readable hostnames into IP addresses for carrying out communication.
6. Answer: a
Explanation: Dynamic DNS or in short DDNS or DynDNS helps in automatically updating a
name server in the DNS. This does not require manual editing.
7. Answer: d
Explanation: The ICANN (Internet Corporation for Assigned Names and Numbers) deals with IP address
space allocation, protocol identifier assignment, generic and country code Top Level domain name system
management (gTLD and ccTLD).
8.Answer: a
Explanation: A domain name system is maintained by a distributed database system. It is a collection of
multiple, logically interrelated databases distributed over a computer network.
9.Answer: a
Explanation: It need not be that a single hostname will correspond to a ip address. For example
facebook.com and fb.com both correspond to same ip address. So there can be multiple hostnames for a
single ip address.
10. A. Flat
11. C. label; 63
• DNS is a directory service that provides a mapping between the name of a host on the
network and its numerical address.
• DNS is required for the functioning of the internet.
• The domain name space is divided into three different sections: generic domains,
country domains, and inverse domain.
1. Generic Domain
• It defines the registered hosts according to their generic behavior.
• As of now, there are currently 21 generic top-level domains within the root zone,
• It uses three-character labels, and these labels describe the organization type.
• It allows organizations to be grouped by organizational types.
• generic (.com, .info, .net, .org), which can be used for general purposes;
• sponsored (.aero, .asia, .cat, .coop, .edu, .gov, .int, .jobs, .mil, .mobi, .tel, .travel, and .xxx), which can
only be used by entities engaged within the specific industry;
• generic restricted (.biz, .name, .pro), which can be use only for their specified purposes and
• infrastructure (.arpa), is a special category that contains only one TLD i.e. the address and routing
parameter area (ARPA).You cannot register the domain as a TLD as it is typically only used for
technical web infrastructure motives. and it is operated by IANA. [3]
2. Country Domain
• The format of country domain is same as a generic domain, but it uses two-character country
abbreviations (e.g., us for the United States, uk- for United Kingdom ,in-for India) in place of
three character organizational abbreviations.
3. Inverse Domain
• Inverse domains, also known as reverse DNS, perform the opposite function of traditional
DNS. Instead of translating domain names to IP addresses, inverse domains translate IP
addresses to domain names.
• They are commonly used in email servers and security applications. For example, an inverse
domain in DNS may reveal that the IP address 192.168.0.1 corresponds to
"router.example.com."
RESOLUTION
• DNS cache refers to the temporary storage of information about previous DNS lookups
on a machine's OS or web browser.
• Keeping a local copy of a DNS lookup allows your OS or browser to quickly retrieve it and
thus a website's URL can be resolved to its corresponding IP much more efficiently.
• Advantages Of Caching
1. Caching speeds up resolution.
2. The same query need not be forwarded repeatedly.
• Disadvantages Of Caching
1. Requires additional memory.
2. If a server caches a mapping for a long time, it may send an outdated mapping to the
client.
E-MAIL
• Also in this case sender needs a User agent(UA) in order to prepare the message. After preparing the
message the sender sends the message via a pair of MTA through LAN or WAN.
• Fourth Scenario (Both users are remote user )
• In this scenario, the receiver is also connected to his mail server with the help of WAN or LAN.
• When the message arrives the receiver needs to retrieve the message; thus there is a need for another
set of client/server agents. The recipient makes use of MAA(Message access agent) client in order to
retrieve the message.
• In this, the client sends the request to the Mail Access agent(MAA) server and then makes a request
for the transfer of messages.
• This scenario is most commonly used today.
• Format Of an Email
• An e-mail consists of three parts that are as follows :
1. Envelope
2. Header
3. Body
• 1. Envelope :
The envelope part encapsulates the message. It contains all information that is required for sending any e-
mail such as destination address, priority and security level. The envelope is used by MTAs for routing
message.
• 2. Header :
• The header consists of a series of lines. Each header field consists of a single line of ASCII text specifying field
name, colon and value. The main header fields related to message transport are :
• BCC: It refers to blind carbon copy. It is very similar to Cc. The only difference between Cc and Bcc is that it
allow user to send copy to the third party without primary and secondary recipient knowing about this.
• From : It specifies name of person who wrote message.
• Sender : It specifies e-mail address of person who has sent message.
• Return-Path: It is added by the message transfer agent. This part is used to specify how to
get back to the sender.
• Message Body
• The body of a message contains text that is the actual content/message that needs to be
sent, such as “Employees who are eligible for the new health care program should
contact their supervisors by next Friday if they want to switch.”
• The message body may also include signatures or automatically generated text that is
inserted by the sender’s email system.
Email Address
• An email address is the identification of an electronic mailbox.
• It has two parts, namely, a local part and the domain.
• The local part usually contains the username of the user while the domain name depends on what email
service provider you are using. The local part can contain words, numbers, or periods while the domain
name depends on what kind of service provider you are using.
MESSAGE TRANSFER AGENT: SMTP
• To send mail, a system must contain client MTA and to receive a mail, a system must
have server MTA.
• SMTP transfers this message from client MTA to the server MTA. To send a mail, SMTP is
used two times: one between sender and sender’s mail server and the other between
the two mail servers.
TURN : Allows to switch Sender and recipient.
The first 5 commands are mandatory and must be supported by every SMTP
software.
• The response is sent back from the server to the client . It is 3 digit number which specifies
the result of the command,
• Ex. 450 means mailbox not available. 220 means service ready, 421 means service not ready.
Mail transfer phases
The process of transferring a mail messages occurs in 3 phases.
• Connection establishment
• Mail transfer
• Connection termination
• Connection establishment phase
i. The client makes a TCP connection to port 25
ii. The server sends code 220 (service ready) to tell the client that it is ready to receive mail. If
the server is not ready, it sends code 421 (service not available)
iii. The client sends the HELO message to identify itself, using its domain name address.
iv. The server responds with code 250 (request command completed).
Connection Establishment Phase
• Mail Transfer phase
i. Client sends MAIL FROM message with mail address of the sender
ii. The server responds with code 250 or some other appropriate code
iii. The client sends the RCPT TO message with mail address of the recipient
iv. The server responds with code 250 or some other appropriate code
v. The client sends the DATA message to initialize the message transfer.
vi. The server responds with code 354 (start mail input) or some other appropriate message
vii. The client sends the contents of the message in consecutive lines. Each line is terminated by a
two-character end-of-line token (carriage return(\r) and line feed(\n)).
viii. The server responds with code 250 (OK) or some other appropriate code
Mail Transfer Phase
• Connection Termination Phase
• i. The client sends the QUIT command.
• ii. The server respond with code 221 or some other appropriate code.
MIME (MULTIPURPOSE INTERNET MAIL EXTENSIONS )
• The mail transfer protocol i.e. SMTP (Simple Mail Transfer Protocol) allows only ASCII
characters to be included in the mail. It does not support characters from other
languages and scripts, images, audio, video etc.
• Multipurpose Internet Mail Extensions Protocol is a supplementary protocol used with
SMTP in order to allow non-ASCII data like images etc to be sent in the email .
• MIME transforms non ASCII data at the sender to ASCII data and delivers it to the client
MTA. The message at the receiving site is transformed back to the original data.
• MIME Header
• MIME specifies 5 headers which can be added to the original email headers. These are:
ii. Content-Type: Specifies the type of data. Supported types are: text(plain/HTML), image,
audio, video, multipart, message, application.
iii. Content-Transfer-Encoding: This header defines the method used to encode the
messages into 0s and Is for transport. The five types of encoding methods are 7-bit, 8-bit,
Binary, Base64, and Quoted-printable.
iv. Content-ID: Uniquely identifies the whole message in a multiple message environment.
v. Content-Description: This header defines whether the body is image, audio, or video
MESSAGE ACCESS AGENT (POP & IMAP)
• SMTP is a push protocol and it only sends the email from the MTA client to the senders
MTA server (stage 1) and from the senders MTA server to the receivers MTA server .To
retrieve messages from the mail server, the receiver uses a MAA.
• It uses a pull protocol which pulls messages from the server. Currently, the two most
widely used Message Access Protocols are Post Office Protocol, version 3 (POP3) and
Internet Mail Access Protocol, version 4 (IMAP4).
• POP3
• Post Office Protocol, version 3 (POP 3) is a simple protocol with limited functionality.
• The server POP3 software is installed on mail server and the client POP3 software is
installed on client computer. Ex. Microsoft's Outlook
• To download an email from the mail server, the following steps are performed
i. The client opens a connection to the server on TCP port 110
ii. It then sends its user name and password to access the mailbox.
iii. The server responds with an OK after verification.
iv. The user requests for a list of emails.
v. The server responds with the list of emails.
vi. The client retrieves the email messages one by one.
Advantages of POP3
• Offline Access: Emails downloaded via POP3 can be accessed offline, making it convenient for
users in areas with limited or intermittent internet connectivity.
• Simple Setup: Setting up a POP3 email account is straightforward, requiring minimal
configuration, which is ideal for users who prefer simplicity.
• Efficient Data Usage: POP3 downloads only new emails, reducing data usage compared to
other protocols that synchronize entire mailboxes.
• Local Control: Once downloaded, emails are managed locally on the client device, giving users
control over storage and organization without relying heavily on server resources.
• Cross-Platform Compatibility: POP3 is supported by most email clients and is compatible
across different operating systems and devices, ensuring widespread usability.
Disadvantages of POP3 protocol
1. If the emails are downloaded from the server, then all the mails are deleted from the server
by default. So, mails cannot be accessed from other machines unless they are configured to
leave a copy of the mail on the server.
2. Transferring the mail folder from the local machine to another machine can be difficult.
3. Since all the attachments are stored on your local machine, there is a high risk of a virus
attack if the virus scanner does not scan them. The virus attack can harm the computer.
4. The email folder which is downloaded from the mail server can also become corrupted.
5. The mails are stored on the local machine, so anyone who sits on your machine can access
the email folder.
IMAP4
• IMAP4 Internet Mail Access Protocol (IMAP) version 4 is more powerful and complex than
POP3.
• The features of IMAP makes it popular among the mail users.
• It uses TCP port no 143.
IMAP features:
i. User can check the e-mail header before downloading.
ii. User can partially download the emails.
iii. User can create, delete or rename mailboxes on the mail server.
iv. User can arrange mailboxes according to the hierarchy.
v. User can set up filters and examine text before downloading. This helps some ISPs to sort
mails as either important or spam (junk e-mail) and store these messages in corresponding
mailboxes.
• Advantages of IMAP4
I. Provides additional features to the user to perform a variety of operations on the mailbox.
II. Emails are on the server all the time, so they can be accessed anytime and from any place
III. More flexibility.
Disadvantages of IMAP4
I. Accessing emails requires an active internet connection.
II. Requires a larger mailbox size as compared to POP3.
III. IMAP is also a complicated protocol, and needs to be setup
POP3 IMAP4
Simple protocol that only allows downloading Advanced and more powerful protocol.
messages from the mailbox to the computer.
Uses port 110 Uses port 143...
All emails must be downloaded for reading All emails need not be downloaded
Once emails are downloaded, they can be accessed Active internet connection is required to access
without internet connection the Emails on the server.
Emails can be accessed only from a single device at Emails can be accessed from multiple devices at a
a time time.
Users cannot organize the emails in the mailbox Provides a facility to organize emails in the mailbox
The user cannot search, create, delete or rename The user can search, create, delete or rename
email on the mail server. email on the mail server
It works in two modes delete mode and. Keep Emails are always kept in the mailbox and also
mode other servers Deleted emails can be retrieved
Since emails are downloaded, the mailbox size can The size of the mailbox must be sufficiently large to
be smaller hold all emails.
Easy to setup and use Complicated to setup and use.
Speed is fast. Speed is slow.
• When users create an email account or set up an email client, they typically choose
between POP3 (Post Office Protocol version 3) and IMAP (Internet Message Access
Protocol) based on their specific needs and preferences.
• POP3 remains relevant in scenarios where users prioritize local email management,
offline access, and email backup.
• Microsoft Outlook, Mozilla Thunderbird, Apple Mail, and others, support POP3 for
downloading emails from email servers to the user's computer or mobile device
4. FILE TRANSFER PROTOCOL
• Transferring files from one computer to another is one of the most common tasks
expected from a networking or internetworking environment.
• The greatest volume of data exchange in the Internet today is due to file transfer.
Although transferring files from one computer to another seems simple and
straightforward, some issues need to be addressed:
• i. The two systems may use different file name conventions
• ii. The two systems may have different directory structures.
• iii. The two systems may have different ways to represent data.
• All of these problems have been solved by FTP.
• The HTTP protocol can be used to transfer files from a server to a client. However, FTP
is a better choice to transfer large files or to transfer files using different formats.
• File Transfer Protocol (FTP) is a standard network protocol used to copy a file from one
host to another over the Internet. In FTP, file transfer means one of three things:
• retrieving a file (server to client),
• storing a file (client to server), and
• directory listing (server to client).
• Features
I. It is used for copying a file from one host to another in a TCP/IP network.
II. FTP is built on the client-server architecture.
III. FTP uses the services of TCP.
IV. It needs two TCP connections: The well-known port 21 is used for the control
connection and the well-known port 20 for the data connection.
• FTP Connections
• FTP uses two types of connections:
Control Connection:
• The control connection is established between the client and the server to manage the
file transfer session.
• It handles commands and responses between the client and server, such as logging in,
changing directories, and initiating file transfers.
• This connection remains open during the entire FTP session.
Data Connection:
• The data connection is used to transfer the actual files or directory listings between the
client and the server.
FTP Model
• The FTP client has three components:
i. User interface
ii. Client control process
iii. Client data transfer process
• The FTP server has two components:
i. Server control processes
ii. Server data transfer processes
4.1 COMMUNICATION OVER CONTROL
CONNECTION
• The control connection is used for sending session commands between client and server. It
remains open for the entire duration of the session.
• FTP uses ASCII based commands over the control connection.
• The control connection uses very simple rules of communication.
i. The communication is request-response based.
ii. We need to transfer only a line of command or a line of response at a time.
iii. One command is sent by the client at a time and then it waits for a response before
sending the next command.
iv. The commands and responses are very small and terminated by an end-of-line token
consisting of two characters - Carriage return and line feed.
V. Commands sent from the FTP client control process, are in the form of ASCII uppercase,
which may or may not be followed by an argument. Ex.
• ABOR: Abort an active file transfer.
• CWD: Change working directory.
• DELE: Delete file.
• NLST: Returns a list of file names in a specified directory.
vi. Every FTP command generates at least one response.
vii. A response has two parts: a three-digit number followed by text. The numeric part
defines the code; the text part defines needed parameters or further explanations.
For example: 125: Data connection open, 150: File status OK etc.
4.2 COMMUNICATION OVER DATA CONNECTION
iii. Transmission mode: Data transfer can be done in any of three modes:
a. Stream mode: Data is sent as a continuous stream
b. Block mode: FTP breaks the data into several blocks and then passes it on to TCP.
c. Compressed mode: Data is compressed and then sent.
4.3 ANONYMOUS FTP
• FTP was designed for account-based access to files on a server. This means, a user needs to
have an account on a remote system for navigating the directories, hierarchy and retrieving
files after authentication.
• Anonymous FTP extends this idea by allowing users without accounts to use FTP for
retrieving "public" data.
• To do this, a user connects to FTP server using anonymous as a user-id and sending an
identifying string, typically an email address, as password. Once connected in this manner, the
user can examine the server's file repository and download files using FTP's standard
capabilities.
• Anonymous FTP servers typically implement various security measures to prevent
anonymous users from accessing any thing but an area designated for public information.
Thank You..