Application Layer
Application Layer
The null suffix defines nothing. This suffix is added when the user defines an FQDN.
Figure below shows some FQDNs and PQDNs.
DNS IN INTERNET
In the Internet, the domain name space (tree) is divided into three different sections:
1. Generic domains
2. Country domains
3. Inverse domain
NOTE:
Here arpa, org, com, in ... all these are called as top level domains.
Generic Domains
The generic domains define registered hosts according to their generic behaviour.
The first level in the generic domains section allows14 possible labels.
These labels describe the organization types as listed in Table below.
Country Domains
The country domains section uses two-character country abbreviations (e.g., in for India, us for United States).
Second labels can be organizational, or they can be more specific, national designations.
The United States, for example, uses state abbreviations as a subdivision of us (e.g., ca.us for California state
in USA).
Yet another example can be the address www.amazon.in can be translated to organization amazon in india.
Inverse Domain
The inverse domain is used to map an address to a name.
This may happen, for example, when a server has received a request from a client to do a task.
Although the server has a file that contains a list of authorized clients, only the IP address of the client (extracted
from the received IP packet) is listed.
The server asks its resolver to send a query to the DNS server to map an address to a name to determine if the
client is on the authorized list.
This type of query is called an inverse or pointer (PTR) query.
To handle a pointer query, we have only one top level (first level) domain known as arpa.
It was the first domain in DNS. Originally it was called Advance Research Project Agency but now it is called
Address and Routing Parameter Area.
At second level 2 domains are used for inverse mapping i.e. in-addr(for inverse address) and ip6.
in-addr is used for IPV4 and ip6 is used for IPV6.
DISTRIBUTION OF NAMESPACE
It means that how this huge amount of information is distributed over servers.
Part of tree managed by server is called its zone and it is always contiguous part of tree.
We have not stored this entire information at one place to avoid single point of failure and responding request
from all over the world places heavy load on system.
TYPES OF SERVERS
1. Non Authoritative
2. Authoritative
Non Authoritative
It has no DNS database i.e. it has no entry for IP address and name for any organization.
It is also known as cache only servers because to service any query they uses their cache or ask other servers
the same query or refer the DNS client to some other server.
Example is root server and it is type of server who's zone is entire DNS tree. Actually it does not store any
information about domain but it stores the IP address of different servers whose zone is top level domain.
There are several root servers in the Internet and all stores same redundant information.
Authoritative
It has DNS database and it is of 2 types
1. Primary
2. Secondary
Primary
It stores file for a zone for which it is responsible.
It is responsible for generating maintaining and updating this zone file.
Secondary
It transfer the complete information about zone from any other server(primary or secondary) and store the file
on its disk
It neither creates nor update the zone file.
If updation is required then it can be done only by primary server and it sent the updated file to all secondary
servers.
Also note that we can have only one primary server for zone and many secondary servers for the same zone.
When the secondary downloads information from the primary, it is called zone transfer and it is done by TCP.
WORKING OF DNS
When we type URL in address bar of web browser like www.google.com it is partially qualified domain name
(as it does not end with a dot).
It passes this address to program called resolver (DNS client) and it first convert it into FQDN that is
www.google.com.
Now it will first check in DNS cache that is temporary memory or buffer for the mapping. If entry is present
then corresponding IP address is given to web browser. Entry is present if recently web browser has opened
that page. This entry is timed out after some time.
If entry is absent then this resolver will send this query to local DNS server (address of the server is present in
TCP/IP settings and is updated by DHCP server when m/c is connected to internet)
Now this server will first check in its cache if mapping is present then it sends corresponding address to resolver
and it sends to web browser.
But if entry is not present then it will send query to root server.
Root server has IP address of all top level domain servers only so it does not have IP address of www.google.com
So it will send IP address of server whose domain is .com that is it partially solve the query.
Now local DNS will send query to .com server and it will send IP address of DNS server of Google organization
because .com server don't store IP addresses of hosts of Google organisation
Now again local DNS server send query to this Google DNS server which has IP address of www, mail, plus etc
hosts of Google and it will send IP address of www.google.com now it is fully solved.
Now query is resolved and local DNS server send reply to resolver and this resolver replies to web browser
DNS QUERY
We have 3 types of DNS queries
1. Reverse lookup query
It is used for reverse process i.e. IP to domain name
2. Recursive query
When client do this then server has to give definitive answer that is if name exists then IP address otherwise
error message must be given.
DNS server can't refer client to any other DNS server
Generally recursive queries are sent by end devices to local DNS server.
3. Iterative query
DNS client allows the DNS server to return best answer it may be definitive or not.
So now DNS server can send IP of another DNS server also and client will request the same query to it
For example as seen in working of DNS all 3 queries from local DNS server are iterative queries.
This process is also called walking the tree.
REMOTE LOGGING
In the Internet, users may want to run application programs at a remote site and create results that can be
transferred to their local site.
For example, students may want to connect to their university computer lab from their home to access
application programs for doing homework assignments or projects.
One way to satisfy that demand and others is to create a client/server application program for each desired
service.
However, it would be impossible to write a specific client/server program for each demand.
The better solution is a general purpose client/server program that lets a user access any application
program on a remote computer; in other words, allow the user to log on to a remote computer. After logging
on, a user can use the services available on the remote computer and transfer the results back to the local
computer.
Protocol used for remote login is TELNET.
TELNET
TELNET is an abbreviation for TErminaL NETwork.
It is the standard TCP/IP protocol for virtual terminal service as proposed by the International Organization
for Standards (ISO).
TELNET enables the establishment of a connection to a remote system in such a way that it appears to be a
remote system that it the local terminal of remote system.
Timesharing Environment
TELNET was designed at a time when most operating systems, such as UNIX, were operating in a
timesharing environment.
In such an environment, a large computer supports multiple users.
The interaction between a user and the computer occurs through a terminal, which is usually a combination of
keyboard, monitor, and mouse.
Even a microcomputer can simulate a terminal with a terminal emulator.
Logging
In a timesharing environment, users are part of the system with some right to access resources.
To access the system resources, the user logs into the system with a user id and password.
Types of logging
We have 2 types of logging.
1. Local logging:
When a user logs into a local timesharing system, it is called local log-in.
As a user types at a terminal or at a workstation running a terminal emulator, the keystrokes are accepted by
the terminal driver.
The terminal driver passes the characters to the operating system.
The operating system, in turn, interprets the combination of characters and invokes the desired application
program or utility. Figure below shows the logging process.
2. Remote logging
When a user wants to access an application program or utility located on a remote machine, she performs
remote log-in.
Here the TELNET client and server programs come into use.
The user sends the keystrokes to the terminal driver, where the local operating system accepts the characters
but does not interpret them.
The characters are sent to the TELNET client, which transforms the characters to a universal character set
called network virtual terminal (NVT) characters and delivers them to the local TCP/IP protocol stack.
The commands or text, in NVT form, travel through the Internet and arrive at the TCP/IP stack at the remote
machine.
Here the characters are delivered to the operating system and passed to the TELNET server, which changes
the characters to the corresponding characters understandable by the remote computer.
However, the characters cannot be passed directly to the operating system because the remote operating
system is not designed to receive characters from a TELNET server: It is designed to receive characters from
a terminal driver.
The solution is to add a piece of software called a pseudoterminal driver which pretends that the characters
are coming from a terminal.
The operating system then passes the characters to the appropriate application program. Below figure explains
the concept.
TELNET uses only one TCP connection. The server uses the well-known port 23, and the client uses an
ephemeral port.
The same connection is used for sending both data and control characters.
TELNET accomplishes this by embedding the control characters in the data stream.
However, to distinguish data from control characters, each sequence of control characters is preceded by a
special control character called interpret as control (lAC).
Disadvantage of TELNET
It does not uses any encryption technique and even login name and password are not encrypted so for security
reasons it is not used now a days.
ELECTRONIC MAIL
At the beginning of the Internet era, the messages sent by electronic mail were short and consisted of text only. Today,
electronic mail is much more complex. It allows a message to include text, audio, and video. It also allows one
message to be sent to one or more recipients.
Architecture
To explain the architecture of e-mail, we give four scenarios. We begin with the simplest situation and add
complexity as we proceed. The fourth scenario is the most common in the exchange of email.
First Scenario
In the first scenario, the sender and the receiver of the e-mail are users (or application programs) on the same
system; they are directly connected to a shared system.
The administrator has created one mailbox for each user where the received messages are stored. A mailbox is
part of a local hard drive, a special file with permission restrictions.
Only the owner of the mailbox has access to it.
When Alice, a user, needs to send a message to Bob, another user, Alice runs a user agent (UA) program to
prepare the message and UA itself will store it in Bob's mailbox.
The message has the sender and recipient mailbox addresses (names of files).
Bob can retrieve and read the contents of his mailbox at his convenience, using a user agent. Figure below
shows the concept.
NOTE:
When the sender and the receiver of an e-mail are on the same system, we need only two user agents.
Second Scenario
In the second scenario, the sender and the receiver of the e-mail are users (or application programs)
on two different systems.
So the message needs to be sent over the Internet.
Here we need user agents (UAs) and message transferagents (MTAs), as shown in figure below.
Alice needs to use a user agent program to send her message to the system at her own site.
The computer (sometimes called the mail server) at her site manages all the messages received and makes a
mail queue to store messages waiting to be sent.
MTA client keeps on checking the queue and when there is message then it will try to establish connection
with MTA server and when connection is established then it pick the messages from queue and send them
over internet to MTA server which is running at system from which bob is connected.
MTA server after receiving messages will store them at mail box of bob.
Like most client/server programs on the Internet, the server needs to run all the time because it does not know
when a client will ask for a connection.
Bob also needs a user agent program to retrieve messages stored in the mailbox of the system at his site.
NOTE:
When the sender and the receiver of an e-mail are on different systems, we need two UAs and a pair of MTAs (client
and server).
Third Scenario
In the third scenario, Bob, as in the second scenario, is directly connected to his system.
Alice, however, is separated from her system.
Either Alice is connected to the system via a point-to-point WAN, such as a dial-up modem, a DSL,
or a cable modem; or she is connected to a LAN in an organization that uses one mail server for
handling e-mails-all users need to send their messages to this mail server. Figure below shows the
situation.
Alice still needs a user agent to prepare her message. She then needs to send the message through the LAN or
WAN. This can be done through a pair of message transfer agents (client and server).
Whenever Alice has a message to send, she calls the user agent which, in tum, calls the MTA client. The MTA
client establishes a connection with the MTA server on the system, which is running all the time.
The mail server computer at Alice's site manages all messages received and makes a mail queue. MTA client
keeps on checking this queue and whenever there are messages to send it establishes a connection with MTA
server at Bob's site and sends the messages. This server receives the messages and stores it in Bob's mailbox.
At his convenience, Bob uses his user agent to retrieve the message and reads it.
NOTE:
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, Bob is also connected to his mail server by a WAN or a LAN.
After the message has arrived at Bob's mail server, Bob needs to retrieve it.
We can’t uses of MTA client at Bob computer MTA server at mail server computer. This is because MTA
client is push program which pushes the messages to MTA server, it can’t pull messages from MTA server.
Other option is use MTA sever at Bob computer which is impossible as now Bob can’t shut down her
computer because she doesn’t know when message will arrive.
Hence, we need another set of client/server agents, which we call message access agents (MAAs).
Unlike MTA client, MAA client is a pull program and it can pull messages from MAA server.
See below figure
So Bob uses an MAA client to retrieve his messages. The client sends a request to the MAA server, which is
running all the time, and requests the transfer of the messages. Figure on next page shows the situation.
USER AGENT
The first component of an electronic mail system is the user agent (UA). It provide service to the user to make the
process of sending and receiving a message easier. Best known example is Microsoft outlook.
MIME
Electronic mail has a simple structure. Its simplicity, however, comes at a price. It can send messages only in
7-bit ASCII format.
In other words, it has some limitations. For example, it cannot be used for languages that are not supported
by 7-bit ASCII characters (such as French, German, Hebrew, Russian, Chinese, and Japanese).
Also, it cannot be used to send binary files or video or audio data.
Multipurpose Internet Mail Extensions (MIME) is a supplementary protocol that allows non-ASCII data
to be sent through e-mail.
MIME transforms non-ASCII data at the sender site to ASCII data and delivers them to the client MTA to be
sent through the Internet. The message at the receiving side is transformed back to the original data.
We can think of MIME as a set of software functions that transforms non-ASCII data (stream of bits) to
ASCII data and vice versa, as shown in Figure below
MIME allows seven different types of data like audio, video, image etc.
SMTP is used two times, between the sender and the sender's mail server and between the two mail servers.
It is connection oriented protocol and uses TCP with port number 25.
SMTP simply defines how commands and responses must be sent back and forth. MTA client sends the
command and server sends the responses (see Figure below).
SMTP COMMANDS
HELO. This command is used by the client to identify itself.
MAIL FROM. This command is used by the client to identify the sender of the
message.
RCPT TO. This command is used by the client to identify the intended recipient of
the message.
DATA. This command is used to send the actual message.
QUIT. This command terminates the message.
RSET. This command aborts the current mail transaction.
VRFY. This command is used to verify the address of the recipient.
NOOP. This command is used by the client to check the status of the recipient
TURN. This command lets the sender and the recipient switch positions, whereby
the sender becomes the recipient and vice versa
EXPN. This command can verify the existence of one or more mailboxes on the system.
HELP. This command asks the recipient to send information about the command
sent as the argument.
SEND FROM. This command specifies that the mail is to be delivered to the
terminal of the recipient, and not the mailbox.
SMOL FROM. This command specifies that the mail is to be delivered to the terminal
or the mailbox of the recipient.
SMAL FROM. This command specifies that the mail is to be delivered to the terminal
and the mailbox of the recipient.
Message Access Agent: POP and IMAP
The first and the second stages of mail delivery use SMTP. However, SMTP is not involved in the third stage
because SMTP is a push protocol; it pushes the message from the client to the server. In other words, the
direction of the bulk: data (messages) is from the client to the server.
On the other hand, the third stage needs a pull protocol; the client must pull messages from the server. The
direction of the bulk data is from the server to the client. The third stage uses a message access agent.
Currently two message access protocols are available: Post Office Protocol, version 3 (POP3) and Internet
Mail Access Protocol, version 4 (IMAP4). Figure below shows the position of these two protocols in the most
common situation (fourth scenario).
POP3
Post Office Protocol, version 3 (POP3) is simple and limited in functionality. The client POP3 software is
installed on the recipient computer; the server POP3 software is installed on the mail server.
Mail access starts with the client when the user needs to download e-mail from the mailbox on the mail server.
The client opens a connection to the server on TCP port 110.
It then sends its user name and password to access the mailbox. The user can then list and retrieve the mail
messages, one by one. Figure below shows an example of downloading using POP3.
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. In the keep mode, the mail
remains in the mailbox after 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.
The keep mode is normally used when the user accesses her mail away from her primary computer (e.g., a
laptop). The mail is read but kept in the system for later retrieval and organizing.
IMAP4
IMAP4 uses TCP port number 143 and provides the following extra functions which are not provided by POP3
A user can check the e-mail header prior to downloading.
A user can search the contents of the e-mail for a specific string of characters prior to downloading.
A user can partially download e-mail. This is especially useful if bandwidth is limited and the e-mail
contains multimedia with high bandwidth requirements.
A user can create, delete, or rename mailboxes on the mail server.
A user can create a hierarchy of mailboxes in a folder for e-mail storage.
The control connection remains connected during the entire interactive FTP session. The data connection
is opened and then closed for each file transferred. When a user starts an FTP session, the control
connection opens. While the control connection is open, the data connection can be opened and closed
multiple times if several files are transferred.
File Type
FTP can transfer one of the following file types across the data connection: an ASCII file, EBCDIC file, or
image file.
The ASCII file is the default format for transferring text files. Each character is encoded using 7-bit
ASCII. The sender transforms the file from its own representation into ASCII characters, and the receiver
transforms the ASCII characters to its own representation.
If one or both ends of the connection use EBCDIC encoding (the file format used by IBM), the file can be
transferred using EBCDIC encoding.
The image file is the default format for transferring binary files. The file is sent as continuous streams of
bits without any interpretation or encoding. This is mostly used to transfer binary files such as compiled
programs.
Data Structure
FTP can transfer a file across the data connection by using one of the following interpretations about the
structure of the data: file structure, record structure, and page structure.
In the file structure format, the file is a continuous stream of bytes.
In the record structure, the file is divided into records. This can be used only with text files.
In the page structure, the file is divided into pages, with each page having a page number and a page header.
The pages can be stored and accessed randomly or sequentially.
Transmission Mode
FTP can transfer a file across the data connection by using one of the following three transmission modes:
stream mode, block mode, and compressed mode.
The stream mode is the default mode. Data are delivered from FTP to TCP as a continuous stream of
bytes. TCP is responsible for chopping data into segments of appropriate size. If the data are simply a
stream of bytes (file structure), no end-of-file is needed. End-of-file in this case is the closing of the data
connection by the sender. But if the data are divided into records (record structure), each record will have a 1-
byte end of record (EOR) character and the end of the file will have a 1-byte end-of-file (EOF) character.
In block mode, data can be delivered from FTP to TCP in blocks. In this case, each block is preceded by a 3-
byte header. The first byte is called the block descriptor; the next 2 bytes define the size of the block in
bytes.
In the compressed mode, if the file is big, the data can be compressed. The compression method normally
used is run-length encoding. In this method, consecutive appearances of a data unit are replaced by one
occurrence and the number of repetitions. In a text file, this is usually spaces (blanks). In a binary file, null
characters are usually compressed.
ANONYMOUS FTP
To use FTP, a user needs an account (user name) and a password on the remote server.
Some sites have a set of files available for public access, to enable anonymous FTP.
To access these files, a user does not need to have an account or password. Instead, the user can use
anonymous as the user name and guest as the password.
User access to the system is very limited. Some sites allow anonymous users only a subset of commands. For
example, most sites allow the user to copy some files, but do not allow navigation through the directories.
FTP COMMANDS