Unit 1 Application Layer
Unit 1 Application Layer
Application layer
Contents :
Domain name system
Name space-flat name space, hierarchical name space
Domain name space -label ,domain name, fqdn, pqdn
Distribution of domain name space-hierarchy of name servers, zone, root
server, primary and secondary servers.
DNS in the internet: generic domains, country domains, inverse domain
Resolution-resolver, mapping names to address, mapping addresses to
names, recursive resolution, iterative resolution, caching
Electronic mail-
Architecture-first scenario, second scenario, third scenario, fourth
scenario
User agent-services of user agent, types of ua format of e-mail
Mime-mime header
Message transfer agent-smtp
Message access agent: pop and imap
File transfer
Ftp-communication over data control connection, file type, data structure,
transmission mode, anonymous ftp
Domain name system
The domain name system (DNS) is like the internet’s phone book. It helps you
find websites by translating easy-to-remember names (like www.example.com)
into the numerical IP addresses (like 192.0.2.1) that computers use to locate each
other on the internet. Without DNS, you would have to remember long strings of
numbers to visit your favorite websites.
Types of domain
there are various kinds of domains:
Generic domains: .com(commercial), .edu(educational), .mil(military),
.org(nonprofit organization), .net(similar to commercial) all these are generic
domains.
Country domain: .in (india) .us .uk
Inverse domain: if we want to know what is the domain name of the website.
IP to domain name mapping. So DNS can provide both the mapping
The domain name system (DNS) works on client server model. It uses udp protocol
for transport layer communication. DNS uses hierarchical domain based naming
scheme. The DNS server is configured with fully qualified domain names (fqdn)
and email addresses mapped with their respective internet protocol addresses.
o DNS stands for domain name system.
o DNS is a directory service that provides a mapping between the name of a
host on the network and its numerical address.
o DNS is required for the functioning of the internet.
o Each node in a tree has a domain name, and a full domain name is a
sequence of symbols specified by dots.
o DNS is a service that translates the domain name into IP addresses. This
allows the users of networks to utilize user-friendly names when looking for
other hosts instead of remembering the IP addresses.
o For example, suppose the ftp site at edusoft had an IP address of
132.147.165.50, most people would reach this site by specifying
ftp.edusoft.com. Therefore, the domain name is more reliable than IP
address.
1. Root servers: the highest level in the DNS hierarchy. They contain
information about the tlds and delegate requests to the appropriate tld
name servers. There are 13 sets of root servers, named a through m,
distributed globally.
2. Top-level domain (tld) servers: these servers are responsible for the top-
level domains. They maintain information about the second-level domains
within their tld. For instance, the .com tld servers manage domains like
example.com, google.com, etc. Directly below the root. Examples include
.com, .org, .net, country codes like .uk, .jp, and others.
6. Primary (master) servers: these contain the original read-write copy of all
the domain's DNS records. This server holds the original copy of the zone file
and is the authoritative source for the DNS records in that zone. It allows
updates and modifications to the zone file.
Zones
Zone files: these files contain the mappings of domain names to IP addresses
and other DNS records. Each zone has a primary server where the original
zone file is stored and one or more secondary servers where copies of the
zone file are stored.
Root servers
Root servers form the foundation of the DNS hierarchy. They handle queries
for records in the root zone and refer requests to the appropriate tld servers.
They are critical for the operation of the internet.
DNS in internet
DNS is a tcp/IP protocol used on different platforms. The domain name space is
divided into three different sections: generic domains, country domains, and
inverse domain.
Generic domains
Label DescrIPtion
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) in place of three
character organizational abbreviations.
Inverse domain
The inverse domain is used for mapping an address to a name. When the server
has received a request from the client, and the server contains the files of only
authorized clients. To determine whether the client is on the authorized list or not,
it sends a query to the DNS server and ask for mapping an address to the name.
Working of DNS
Resolver
Mapping a domain name to an IP address is known as name-address resolution.
DNS is designed as a client -server application.
A host that needs to map an address to a name or a name to an address calls a
DNS client called a resolver.
The resolver accesses the closest DNS server with a mapping request.
If the server has the information it satisfies the resolver ;otherwise, it either
refers the resolver to other servers or asks other servers to provide the
information.
After the resolver receives the mapping, it interprets the response to see if it is
a real resolution or an error, and finally delivers the result to the process that
requested it.
Higher load on servers since each Lower load on servers since only
Server load
server in the chain must be queried the local server is queried
Response Longer response time since multiple Shorter response time since only
time servers may need to be queried one or a few servers are queried
Lower cache hit rate since referrals Higher cache hit rate since
Cache usage
are returned instead of mappings mappings are returned directly
Lower security since each server in Higher security since only the
Security the chain may potentially modify the local server is trusted to return a
response valid response
1. Electronic mail
Electronic mail allows a message to include text, audio, and video.
It also allows one message to be sent to one or more recipients. E-
mail system has three main components:
1. User agent,
2. Message transfer agent
3. Message access agent
Email architecture :
First scenario :
When the sender and the receiver of an e-mail are on the same
system, we need only two user agents
Second scenario :
When both sender and receiver are connected to the mail server via
LAN or WAN, we need two UA, two pairs of MTA and a pair of MAA.
User agent
• The first component of an electronic mail system is the user agent(UA).
• It provides service to the user to make the process of sending and
receiving a message easier.
1. Composing Messages:
A user agent helps the user to compose (create) an e-mail. User
agent provides a template on the screen,which helps the user.
Some even have built in editor that can do spell checking, grammar
checking, cut, copy, paste etc. text formatting functions.
2. Reading Messages:
Next function of user agent is to read incoming messages. User agent
first checks the mail in the incoming mail box. User agent shows a
one line summary of every received mail.
Every e-mail contains number field, flag showing status of e-mail like
new, read, replied etc., size of message, the sender and the optional
subject field.
3. Replying to Messages:
After reading a message, user sent reply by using user agent.
The user agent allows the user to reply to the original sender or to
reply all recipients of the messages.
4. Forwarding Messages:
User agent allows the receiver to forward the message, with or
without extra comments, to a third party.
5. Handling Mail Boxes:
A user agent creates two mail boxes i.e., inbox and outbox.
Inbox keeps all the received e-mails until they are deleted by the
user. The outbox keeps all the sent e-mails until the user deletes
them.
Types of User Agent:
1. Command Driven:
Command driven user agents belong to the early days of e-mail.
A command driven user agent normally accepts one character from
the keyboard to perform its task, e.g. mail, pine and elm.
2. GUI Based:
Modern user agents are GUI-based, which contains graphical user
interface that allow the user to use keyboard and mouse, e.g.
Outlook, Netscape, Eudor(a)
Sending Mail:
To send mail, user creates a mail. E-mail has an envelope and a
message as shown in Fig. 1.22.
27/11/2015
MIME
E-mail system has one limitation, it can send messages only in NVT 7-
** Working of MIME
Features of mime protocol
1. It supports multIPle attachments in a single e-mail.
2. It supports the non-ascii characters.
3. It supports unlimited e-mail length.
4. It supports multiple languages.
Advantage of the mime
LAN LAN
or or
WAN WAN
Internet
Mail server Mail server
Commands and Responses:
SMTP uses commands and response to transfer messages between
MTA client and MTA server.
Permanent Negative
Completion Reply
500 Syntax error, unrecognized command
501 Syntax error in parameters or arguments
502 Command not implemented
503 Bad sequence of commands
504 Command temporarily not implemented
550 Command is not executed, mail box unavailable
551 User not local
552 Requested action aborted, exceeded storage location
553 Requested action not taken, mail box name not
allowed
554 Transaction failed.
Advantages of smtp
If necessary, the users can have a dedicated server.
It allows for bulk mailing.
Low cost and wide coverage area.
Offer choices for email tracking.
Reliable and prompt email delivery.
Disadvantages of smtp
Smtp’s common port can be blocked by several firewalls.
Smtp security is a bigger problem.
Its simplicity restricts how useful it can be.
Just 7-bit ASCII characters can be used.
If a message is longer than a certain length, SMTP servers may reject the entire
message.
Delivering your message will typically involve additional back-and-forth
processing between servers, which will delay sending and raise the likelihood
that it won’t be sent.
1. 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.
Pop3 has two modes: the delete mode and the keep mode.
In the delete mode, the mail is deleted from the mailbox
after each retrieval. The delete mode is normally used
when the user is working at her permanent computer and
can save and organize the received mail after reading or
replying.
In the keep mode, the mail remains in the mailbox after retrieval.
The keep mode is normally used when the user accesses her mail
away from her primary computer. The mail is read but kept in the
system for later retrieval and organizing. (e.g a laptop).
Limitations of pop3
1. It does not allow the user to organize her mail on the server
2. the user can not have different folders on the server. 3. Pop3
does not allow the user to partially check the contents of the mail
before downloading.
We cannot reduce the size of the We can reduce the size of the
email in smtp. email in extended smtp.
Stands for simple mail transfer Stands for post office Stands for internet
protocol protocol. message access protocol.
Not used at receiver side. Used at receiver side. Used at receiver side.
FTP
o Ftp stands for file transfer protocol.
o Ftp is a standard internet protocol provided by tcp/IP used for transmitting
the files from one host to another.
o It is mainly used for transferring the web page files from their creator to the
computer that acts as a server for other computers on the internet.
o It is also used for downloading the files to computer from other servers.
Objectives of FTP
Why FTP? Although transferring files from one system to another is very simple
and straightforward, but sometimes it can cause problems. For example, two
systems may have different file conventions. Two systems may have different ways
to represent text and data. Two systems may have different directory structures.
Ftp protocol overcomes these problems by establishing two connections between
hosts. One connection is used for data transfer, and another connection is used for
the control connection.
Mechanism of FTP
The above figure shows the basic model of the ftp. The ftp client has three
components: the user interface, control process, and data transfer process. The
server has two components: the server control process and the server data
transfer process.
o Control connection: the control connection uses very simple rules for
communication. Through control connection, we can transfer a line of
command or line of response at a time. The control connection is made
between the control processes. The control connection remains connected
during the entire interactive ftp session.
o Data connection: the data connection uses very complex rules as data types
may vary. The data connection is made between data transfer processes. The
data connection opens when a command comes for transferring the files and
closes when the file is transferred.
FTP clients
o Ftp client is a program that implements a file transfer protocol which allows
you to transfer files between two hosts on the internet.
o It allows a user to connect to a remote host and upload or download the
files.
o It has a set of commands that we can use to connect to a host, transfer the
files between you and your host and close the connection.
o The ftp program is also available as a built-in component in a web browser.
This gui based ftp client makes the file transfer very easy and also does not
require to remember the ftp commands.
Advantages of FTP:
o Speed: one of the biggest advantages of ftp is speed. The ftp is one of the
fastest way to transfer the files from one computer to another computer.
o Efficient: it is more efficient as we do not need to complete all the operations
to get the entire file.
o Security: to access the ftp server, we need to login with the username and
password. Therefore, we can say that ftp is more secure.
o Back & forth movement: ftp allows us to transfer the files back and forth.
Suppose you are a manager of the company, you send some information to
all the employees, and they all send information back on the same server.
Disadvantages of FTP:
o The standard requirement of the industry is that all the ftp transmissions
should be encrypted. However, not all the ftp providers are equal and not all
the providers offer encryption. So, we will have to look out for the ftp
providers that provides encryption.
o Ftp serves two operations, i.e., to send and receive large files on a network.
However, the size limit of the file is 2gb that can be sent. It also doesn't allow
you to run simultaneous transfers to multIPle receivers.
o Passwords and file contents are sent in clear text that allows unwanted
eavesdropping. So, it is quite possible that attackers can carry out the brute
force attack by trying to guess the ftp password.
o It is not compatible with every system.
Transmission mode :
Ftp transfer files using any of the following modes:
Stream mode: it is the default mode. In stream mode, the data is transferred
from ftp to tcp in stream bytes. Here tcp is the cause for fragmenting data into
small segments. The connection is automatically closed if the transforming
data is in the stream bytes. Otherwise, the sender will close the connection.
Block mode: in block mode, the data is transferred from ftp to tcp in the form
of blocks, and each block followed by a 3-byte header. The first byte of the
block contains the information about the block so it is known as the
description block and the other two bytes contain the size of the block.
Compressed mode: this mode is used to transfer big files. As we know that,
due to the size limit we can not transfer big files on the internet, so the
compressed mode is used to decrease the size of the file into small and send it
on the internet.
Ftp commands
Sr. No. Command Meaning
Applications of FTP
The following are the applications of ftp:
Ftp connection is used by different big business organizations for transferring
files in between them, like sharing files to other employees working at
different locations or different branches of the organization.
Ftp connection is used by it companies to provide backup files at disaster
recovery sites.
Financial services use ftp connections to securely transfer financial documents
to the respective company, organization, or government.
Employees use ftp connections to share any data with their co-workers.
Advantages
MultIPle transfers: ftp helps to transfer multIPle large files in between the
systems.
Efficiency: ftp helps to organize files in an efficient manner and transfer them
efficiently over the network.
Security: ftp provides access to any user only through user id and password.
Moreover, the server can create multIPle levels of access.
Continuous transfer: if the transfer of the file is interrupted by any means,
then the user can resume the file transfer whenever the connection is
established.
Simple: ftp is very simple to implement and use, thus it is a widely used
connection.
Speed: it is the fastest way to transfer files from one computer to another.
Disadvantages
Less security: ftp does not provide an encryption facility when transferring
files. Moreover, the username and passwords are in plain text and not a
combination of symbols, digits, and alphabets, which makes it easier to be
attacked by hackers.
Old technology: ftp is one of the oldest protocols and thus it uses multIPle
TCP/IP connections to transfer files. These connections are hindered by
firewalls.
Virus: the ftp connection is difficult to be scanned for viruses, which again
increases the risk of vulnerability.
Limited: the ftp provides very limited user permission and mobile device
access.
Memory and programming: ftp requires more memory and programming
efforts, as it is very difficult to find errors without the commands.
Communication over data control connection
Data connection
The data connection facilitates the well-known port 20 at the server site. The
following steps display how ftp creates a data connection.
The user, not the server, issues a passive open using an ephemeral port.
The client assigns this port number to the server using the port command.
The server receives the port number and issues an active open using the
wellknown port 20, and the received ephemeral port number.
Ftp uses a similar approach as telnet or smtp to communicate across the control
connection. It uses the nvt ascii character set. Communication is achieved through
command and responses. Each command or response is only one short line;
therefore, we need not worry about file format or file structure.
In this, the client must define the type of file to be transferred via transmission
mode. Before sending the document through the data connection, we arrange for
transmission through the control connection.
File type
FTP can transfer ASCII, EBCDIC, or image files. The ASCII is the default file
share format, in this, each character is encoded by NVT ASCII. In ASCII or
EBCDIC the destination must be ready to accept files in this mode. The image
file format is the default format for transforming binary files.
Data structure
Ftp uses following data structures :
1. File structure (default)
2. Record structure
3. Page structure
Transmission mode
File transfer
FTP commands to transfer files
mget It is used to copy multIPle files from the remote machine to the
local machine.
get It is used to copy a file from the server to the client device.
mput This command is used to copy many files from the user device to
the server device.
put This command is used to copy a file from the user device to the
server device.
A user needs to have an account along with a password on the remote server
if he wants to use FTP.
Some sites have a set of files available for public access to enable
anonymous FTP.
A user does not need to have an account or password to access these
files. Instead the user can use anonymous as the user name and guest as the
password.
***