0% found this document useful (0 votes)
7 views

CNW MOD2

Uploaded by

2361
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

CNW MOD2

Uploaded by

2361
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 121

MODULE 2

APPLICATION LAYER
APPLICATION LAYER

•The application layer provides services to the user.


•It defines how processes in different end system pass messages to
each other.
•The communication at the application layer is logical, not
physical.
•The application layer different from other layers in that it is
the highest layer in the suite.
•the application-layer protocols can be both standard and
nonstandard.
• Application layer protocols are:
1. HTTP
2. FTP
3. SMTP
4. DNS (Domain Name System)
5. Telnet
6. DHCP (Dynamic host configuration protocol)
Application Architecture
• The application architecture is designed by the application
developer and defines how the application should be
structured over the various end systems.
• There are 3 types of architectures:
1. client server
2. peer to peer
3. hybrid of above two
Client Server Architecture
• Client-server architecture: An application program running on the
local machine sends a request to another application program is
known as a client, and a program that serves a request is known as
a server.
• For example, when a web server receives a request from the client
host, it responds to the request to the client host.
•In this paradigm, the service provider is an application
program, called the server process.It runs continuously
(infinite), waiting for another application program, called the
client process (finite), to make a connection through the
Internet and ask for service.
Server
• The server process must
be running all the time;
the client process is
started when the client
needs to receive service.
• The server handles the
request received from a
client, prepares a result,
and sends the result
back to the client.
• A server has a fixed well-known address known as IP
address because the server is always on while the client
can always contact the server by sending a packet to the
sender's IP address.
• Dissadvantage:
It is a single-server based architecture which is incapable
of holding all the requests from the clients. For example, a
social networking site can become overwhelmed when there
is only one server exists.
Peer to Peer Architecture
•In peer to peer architecture there is no need for a server
process to be running all the time and waiting for the client
processes to connect.The responsibility is shared between
peers.
•A computer connected to the Internet can provide service at
one time and receive service at another time. It changes IP
address each time.
•A computer can even provide and receive services at the
same time.Peer requesting the service become client and the
other peer becomes server.
•Internet telephony and file sharing is indeed a peer-to-peer
activity.
•Eg : Gnutella
• Advantage:
• Self scalability: In a file sharing system, although each
peer generates a workload by requesting the files, each
peer also adds a service capacity by distributing the files
to the peer.
• Cost-effective: It is cost-effective as it does not require
significant server infrastructure and server bandwidth.
• Dissadvantage:
•The main challenge has been security.It is more difficult to
create secure communication between distributed services.
•The other challenge is applicability. It appears that not all
applications can use this new paradigm.
•BitTorrent, Skype, IPTV, and Internet telephony, use this
paradigm.
Hybrid

•Combining the advantages of both.


•For example, a light-load client-server communication can be
used to find the address of the peer that can offer a service.
•When the address of the peer is found, the actual service
can be received from the peer by using the peer-to peer
paradigm.
• Eg Napster, instant messaging
Process Communication
• Proccess is a program that is running within an end
system.
• Interprocess Communication - When process are running
on same end system then they communicate using
interprocess communication.
• Process on different end system communicate using
messages across computer network.
• Fig 2.1
Sockets
• Sockets allow communication between two different processes
on the same or different machines.
• It is a set of instructions that can be used by a process to
communicate with another process.
• A process sends and receives message from the network
through socket.
• It is an API (application programming interface)
• Consider it analogous to house.
• Sockets allows us to use
the set of all instructions
already designed in a
programming language.
• It is an interface between
application layer and
transport layer within a
host.
Address Processing
• In order for a process to send message to another
process it should identify the receiver process.
• To identify receiver process two information required:
1. IP address to identify host
2. Port number to identify the process in host
• Application layer protocol defines:
1. Types of messages - request or response message
2. Syntax of various messages - fields in messages
3. Semantics of fields - meaning of information in fields
4. Rules to determine how and when process to send
message and respond.
Transport services for an application layer
• There are different types of transport layer protocols.We
study the services and choose most appropriate protocol
for our application needs.
• Application service requirement can be broadly divided into
3
1. Reliable data transfer - no data loss should occur
2. Bandwidth - Bandwidth sensitive applications needs
transmit data at a cretain rate to be effective.So if the
specific bandwidth is not available then it should encode
at different rate or give up.
• But elastic applications can make use of as much as
bandwidth available.It encodes in the rate of available
bandwidth.
3. Timing : Some applications like interactive real time
applications require very low delay inorder to be effective.
TCP

• Transmission Control Protocol provides connection-oriented,


reliable.
• TCP requires that two ends first create a logical connection
between themselves by exchanging some connection-
establishment packets.
• This phase is sometimes called handshaking.
• After the handshaking process, the two ends can send
chunks of data in segments in each direction.
• It provides flow control and congestion control
• Drawback - it is stream oriented.
UDP

• User Datagram Protocol provides connectionless,


unreliable, datagram service.
• Connectionless service means that there is no logical
connection between the two ends exchanging messages.
• UDP is not a reliable protocol.Although it may check that
the data is not corrupted during the transmission,it does
not ask the sender to resend the corrupted or lost
datagram.
• For some applications, UDP has an advantage: it is
message-oriented.
• An application program may be designed to use UDP if it
is sending small messages.
• the simplicity and speed is more important for the
application than reliability.
SCTP
• Stream Control Transmission Protocol provides a service
which is a combination of TCP and UDP.
• Like TCP, SCTP provides a connection-oriented, reliable
service, but it is not byte-stream oriented.
• It is a message-oriented protocol like UDP.
• In addition, SCTP can provide multistream service by
providing multiple network-layer connections.
• SCTP is normally suitable for any application that needs
reliability and at the same time needs to remain connected,
even if a failure occurs in one network-layer connection
The Web and HTTP
• Web page consist of objects
• Object can be HTML files, JPEG image, audio file, java
applets etc.
• Web pages usually consist of base html file and many
objects..
• The base HTML file refrences other object using URL’s.
• Hyperlinks and search engine help us navigate through
ocean of websites.
• Forms, applets etc allow us to interact with pages and sites.
• Multimedia can be accessed on demand.
• Web browsers is user agent of web.That is display requested
web page to user.Eg Internet Explorer
• Web server houses the web objects by URL. Eg Apache
server.

• URL : https://www.javatpoint.com/url
1. https: protocol
2. javatpoint : domain web page
3. .com : stands for type of website
4. /url : path and name of accessing web page
HTTP
• HyperText Transfer Protocol is an application layer
protocol.
• It is implemented using client and server programs.
• Client and server program running in different end system
communicate using HTTP messages.
• Web browser is client side and web server is a server side.
• HTTP defines how web clients request web pages from
web servers and how server transfer web pages to clients.
• The browser sends HTTP request message to server and
server sends HTTP response message back to browser.
• HTTP uses TCP as its underlying transport protocol.
1. HTTP client initiates TCP connection with server.
2. Once connection established the client and server
processes access TCP through socket interfaces.
3. The client side sends HTTP request message through
socket interface and receive HTTP response message
through socket interface
4. The server side sends HTTP response message through
socket interface and receive HTTP request message
through socket interface
• Once client send request then TCP handles delivery. There
is no chances of data loss.
• Server sends requested files to client without storing any
state information about client.
• So if client sends request for same object twice within few
seconds the server doesnt send a message saying it just
serve the object now instead server responds again as it
has completely forgotten.
• Since HTTP server maintains no information about client it
is known as stateless protocol.
NonPersistent and Persistent Connections
•If the web pages, objects to be retrieved, are located on
different servers, create a new TCP connection for
retrieving each object.
•If some of the objects are located on the same server, we
have two choices:
• retrieve each object using a new TCP connection or
make a TCP connection and retrieve them all.
•The first method is referred to as nonpersistent
connections, the second as persistent connections.
NonPersistent Connections

•One TCP connection is made for each request/response.


•The following lists the steps in this strategy:
1. The client initiates a TCP connection to server on port no. 80
2. client sends HTTP request message to server via its socket.The
request method contains path name.
3. The server receives the request ,retreive the object based on
path and encapsulate object with response message and send
response via its socket.
4. Server process tells to close connection.
5.The client receives the data , terminates connection ,extract file
from response message.
• In this strategy, if a file contains links to N different pictures in
different files (all located on the same server), the connection
must be opened and closed N + 1 times.
•The nonpersistent strategy imposes high overhead on the
server because the server needs N + 1 different buffers
each time a connection is opened.
•RTT (Round trip time) -time taken for a packet to travel from
client to server and back to client.
• Total response time - 2RTT + transmission time at
server for HTML file.
Persistent Connections
•The server leaves the connection open for more requests
after sending a response.
• The server can close the connection at the request of a client
or if a time-out has been reached.
• Time and resources are saved using persistent connections.
•Only one set of buffers and variables needs to be set for the
connection at each site.
• The round trip time for connection establishment and
connection termination is saved.
•By default HTTP uses persistent connection.
• Two types of persistent connection
1. Non Pipeling - new request send only when previous
request reponse is received by client.
drawback - connection idle
2. Pipelining - new request is send back to back , not
waiting for response to reach.
HTTP Message Format
• The HTTP protocol defines the format of the request and
response messages.
•Each message is made of four sections.
•The first section in the request message is called the request
line;
•the first section in the response message is called the status
line.
•Other three sections have the same names in the request
and response messages.
HTTP Request Message

cr - carraige
return
lf - line field
sp - space
Example
• GET /hello.htm HTTP/1.1
• User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows
NT)
• Host: www.tutorialspoint.com
• Accept-Language: en-us
• Accept-Encoding: gzip, deflate
• Connection: Keep-Alive
HTTP Response Message
•A response message consists of a status line, header lines, a
blank line, and sometimes a body.
•The first line in a response message is called the status line.
•There are three fields in this line separated by spaces and
terminated by a carriage return and line feed.
•The first field defines the version of HTTP protocol, currently
1.1.
•The status code field defines the status of the request.
• It consists of three digits.
• The status phrase explains the status code in text form.
Status code
• 1xx: Informational :It means the request was received and
the process is continuing.
• 2xx: Success :It means the action was successfully
received, understood, and accepted.
• 3xx: Redirection: It means further action must be taken in
order to complete the request.
• 4xx: Client Error: It means the request contains incorrect
syntax or cannot be fulfilled.
• 5xx: Server Error:It means the server failed to fulfill an
apparently valid request.
Example
• HTTP/1.1 200 OK
• Date: Mon, 27 Jul 2009 12:28:53 GMT
• Server: Apache/2.2.14 (Win32)
• Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT
• Content-Length: 88
• Content-Type: text/html
• Connection: Closed
• (data data data.....)
Cookies
•The World Wide Web was originally designed as a stateless entity.A
client sends a request; a server responds. Their relationship is over.
•Today the Web has other functions that need to remember some
information about the clients.Websites may allow access to
registered clients only.
•Cookies are HTTP messages that carry state and it permits sites to
learn about you.
•Cookie can be used for authorization,shopping carts,
recommendation,session state etc.
•When a server receives a request from a client, it stores
information about the client in a file or a string.
•The contents of the cookie (information the server has
gathered about the client such as name, registration number,
and so on), a timestamp, and other information depending on
the implementation.
•The server includes the cookie in the response that it sends
to the client.
•When the client receives the response, the browser stores the
cookie in the cookie directory, which is sorted by the server
domain name.
•When a client sends a request to a server, the browser looks
in the cookie directory to see if it can find a cookie sent by
that server.
• If found, the cookie is included in the request.
•When the server receives the request, it knows that this is
an old client, not a new one.
•Note that the contents of the cookie are never read by the
browser or disclosed to the user.
• It is a cookie made by the server and eaten by the server.
Web Caching

•HTTP supports proxy servers.A proxy server is a computer that


keeps copies of responses to recent requests.
1. The HTTP client sends a request to the proxy server.
2. The proxy server checks its cache.
3. If the response is not stored in the cache, the proxy server sends
the request to the corresponding server.
4. Incoming responses are sent to the proxy server and stored for
future requests from other clients.
•The proxy server reduces the load on the original server, decreases
traffic, and improves latency.
•However, to use the proxy server, the client must be configured to
access the proxy instead of the target server.

Conditional GET
• Conditional get is send by proxy server to main server to
check if specific cache copy has been modified since a
specific date .
• That is if the website has been modified in main server .
• Syntax : If - modified - since !<date>
• The server sends:
• Tells the proxy server that the content was not modified –
HTTP 304 status code, or
• Sends the updated content (in case there was some
modification done) – HTTP 200 response-message code
• If the Proxy server gets a 304 – “No Modification”
message, it forwards its local copy to the client. If
modification had been there, the Cache forwards the new
object, whilst storing it locally along with the date and time
it received the new object
• Eg :HTTP/1.1 200 OK
<data,data>
Proxy Server Location

•The proxy servers are normally located at the client site.


•This means that we can have a hierarchy of proxy servers.
1.A client computer can also be used as a proxy server, in a small
capacity, that stores responses to requests often invoked by the
client.
2.In a company, a proxy server may be installed on the computer
LAN to reduce the load going out of and coming into the LAN.
3.An ISP with many customers can install a proxy server to reduce
the load going out of and coming into the ISP network.
FTP
• File Transfer Protocol (FTP) is the standard protocol provided by
TCP/IP for copying a file from one host to another.
• Two systems may use different file name conventions.Two
systems may have different ways to represent data, different
directory structures.
• All of these problems have been solved by FTP.
• When user starts a FTP session the client side of FTP first
intiate a control TCP connection with server side through port
no 21.
• client side send user identification and password over control
connection.
• When server receive control connection, a command for file
transfer that is server side initiates a TCP data connection to
client side through port no 20.
• FTP send exactly one file over connection and closes the
data connection.
• Control connection remain open throughout duration of user.
• Data connection for each file transfer.
• FTP must maintain state about the user.
• FTP is said to send its control information out of band.
• FTP Commands: Send across control connection is 7 bit
ASCII.
1. USER username : send user identification to server
2. PASS password : send user password to server
3. LIST : send back list of all files in current directory
4. RETR filename: retreive file from current directory of remote
host.
• STOR filename: store file into current directory of remote
host.
• To these commands server sends response through 3 digit
code with optimal message.
• 331 Username OK, password required
• 125 Data connection alredy open; transfer starting
• 425 Can’t open data connection
• 452 Error writing file
Electronic Mail in Internet
• Electronic mail (or e-mail) allows users to exchange messages.
• E-mail is considered a one-way transaction.
• May or may not respond.
• The idea of client/ server programming should be implemented
in another way:
• using some intermediate computers (servers).
• The users run only client programs when they want and
the intermediate servers apply the client/server paradigm.
Architecture of Email
• In the common scenario, the sender and the receiver of the e-mail,
Alice and Bob respectively, are connected via a LAN or a WAN
to two mail servers.
• The administrator has created one mailbox for each user where
the received messages are stored.
• A mailbox is part of a server hard drive, a special file with
permission restrictions.
• Only the owner of the mailbox has access to it.
• The administrator has also created a queue (spool) to store
messages waiting to be sent.
• A simple e-mail from Alice to Bob takes nine different steps.
• Alice and Bob use three different agents: a User Agent (UA), a Mail
Transfer Agent (MTA), and a Message Access Agent (MAA).
• When Alice needs to send a message to Bob, she runs a UA
program to prepare the message and send it to her mail server.
• The mail server at her site uses a queue (spool) to store
messages waiting to be sent.
• The message, however, needs to be sent through the Internet
from Alice’s site to Bob’s site using an MTA.
• Here two message transfer agents are needed: one client and one
server.
• The server MTA needs to run all the time because it does not
know when a client will ask for a connection. The client, on the
other hand, can be triggered by the system when there is a
message in the queue to be sent.
• The user agent at the Bob site allows Bob to read the received
message.
• Bob later uses an MAA client to retrieve the message from an
MAA server running on the second server.
User Agent

• The first component of an electronic mail system.


• It provides service to the user to make the process of sending
and receiving a message easier.
• A user agent is a software package (program) that composes,
reads, replies to, and forwards messages.
• It also handles local mailboxes on the user computers.
• There are two types of user agents: command-driven and GUI-
based.
• Some examples of command driven user agents are mail, pine,
and elm.
• Some examples of GUI-based user agents are Eudora and
Outlook.
SMTP
• It is the principal application layer protocol for electronic mail.
• SMTP transfer messages from sender mail servers to recipients
mail server.
• The formal protocol that defines the MTA client and server in
the Internet is called Simple Mail Transfer Protocol (SMTP)
• SMTP older than HTTP - drawback (ASCII restriction)
• Direct SMTP connection between mail servers.No intermediate
server.
• SMTP is used two times,
• Between the sender and the sender’s mail server
• Between the two mail servers.
• SMTP simply defines how commands and responses must be
sent back and forth.
• Each command or reply is terminated by a two character
(carriage return and line feed) end-of-line token.
SMTP Commands
SMTP Responses
Mail Transfer Phases

• The process of transferring a mail message occurs in three


phases:
• Connection establishment
• Mail transfer
• Connection termination
Connection Establishment

• After a client has made a TCP connection to the port 25,


• the SMTP server starts the connection phase.
• This phase involves the following three steps:
• 1. 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).
• 2. The client sends the HELO message to identify itself, using its
domain name address to inform the server of the domain name
of the client.
• 3. The server responds with code 250 (request command
completed) or some other code depending on the situation.
Mail Transfer

• This phase involves eight steps.


• Steps 3 and 4 are repeated if there is more than one recipient.

• 1. The client sends the MAIL FROM message to introduce the sender
of the message. It includes the mail address of the sender (mailbox
and the domain name). This step is needed to give the server the
return mail address for returning errors and reporting messages.
• 2. The server responds with code 250 or some other appropriate
code.
• 3. The client sends the RCPT TO (recipient) message, which
includes the mail address of the recipient.
• 4. The server responds with code 250 or some other appropriate
code.
• 5. The client sends the DATA message to initialize the message
transfer.
• 6. The server responds with code 354 (start mail input)
or some other appropriate message.
• 7. The client sends the contents of the message in consecutive
lines. The message is terminated by a line containing just one
period.
• 8. The server responds with code 250 (OK) or some other
appropriate code.
Connection Termination
• After the message is transferred successfully, the client terminates
the connection.
• This phase involves two steps.
• 1. The client sends the QUIT command.
• 2. The server responds with code 221 or some other appropriate
code.
• SMTP is a push protocol; it pushes the message from the client
to the server.
• The receiver needs a pull protocol; the client must pull
messages from the server.
• Two message access protocols are available: Post Office Protocol
version 3 (POP3) and Internet Mail Access Protocol version 4
(IMAP4).
• Difference between HTTP and SMTP
POP3
• Post Office Protocol, version 3 (POP3) is simple but 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
its 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
• 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 (for example, from a laptop).
The mail is read but kept in the system for later retrieval and
organizing
POP3 Drawbacks

• POP3 is deficient in several ways.


• It does not allow the user to organize her mail on the server;
• the user cannot have different folders on the server.
• In addition, POP3 does not allow the user to partially check
the contents of the mail before downloading.
IMAP4
• Internet Mail Access Protocol, version 4 (IMAP4).
• IMAP4 is similar to POP3, but it has more features;
• IMAP4 is more powerful and more complex.
• IMAP4 provides the following extra functions:
• A user can check the e-mail header prior to downloading and 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 hierarchy of mailboxes in a folder ,create, delete, or
rename mailboxes on the mail server.
MIME
• Multipurpose Internet Mail Extensions (MIME) is a supplementary
protocol that allows non-ASCII data to be sent through e-mail.
• MIME is a set of software functions that transforms non-ASCII data
to ASCII data and vice versa.

• Normally E-mail can send messages only in NVT 7-bit ASCII


format.
• It cannot be used for languages other than English.
• It cannot be used to send binary files or video or audio data.

• MIME transforms non-ASCII data at the sender site to NVT ASCII


data and delivers it . The message at the receiving site is
transformed back to the original data.
• NVT is a Network Virtual Terminal which gives facilities in
networks.
MIME Headers

• MIME defines five headers.


• MIME-Version :This header defines the version of MIME
used. The current version is 1.1.
• Content-ID :This header uniquely identifies the whole
message in a multiple message environment.
• Content-Description : This header defines whether the body is
image, audio, or video.
Content Transfer Encoding
Peer to Peer Paradigm
•The first instance of peer-to-peer file sharing goes back to
December 1987 when Wayne Bell created WWIVnet.
•Freenet 1999
• Napster (1999–2001)
•Gnutella 2000
•Fast-Track (used by the Kazaa), BitTorrent, WinMX, and
GNUnet in 2001.
•Internet users that are ready to share their resources become
peers and form a network.
•When a peer in the network has a file (for example, an audio or
video file) to share, it makes it available to the rest of the peers.
•An interested peer can connect itself to the computer where the
file is stored and download it.
•The P2P networks can be divided into two categories:
centralized and decentralized.
Centralized network
•In a centralized P2P network, the directory system⎯listing of the
peers and what they offer⎯uses the client-server paradigm, but
the storing and downloading of the files are done using the peer-
to-peer paradigm.
•For this reason, a centralized P2P network is sometimes referred
to as a hybrid P2P network.
•Napster was an example of a centralized P2P.
•In this type of network, a peer first registers itself with a
central server.
• The peer then provides its IP address and a list of files it has
to share.
•A peer, looking for a particular file, sends a query to a central
server.
•The server searches its directory and responds with the IP
addresses of nodes that have a copy of the file.
•The peer contacts one of the nodes and downloads the file.
The directory is constantly updated.
•Centralized networks make the maintenance of the directory
simple but have several drawbacks.
•Accessing the directory can generate huge traffic and slow down
the system.
•The central servers are vulnerable to attack, and if all of them fail,
the whole system goes down.
Decentralized Network
•A decentralized P2P network does not depend on a
centralized directory system.
• In this model, peers arrange themselves into an overlay
network, which is a logical network made on top of the
physical network.
• Depending on how the nodes in the overlay network are
linked, a decentralized P2P network is classified as either
unstructured or structured.
Unstructured

•In an unstructured P2P network, the nodes are linked randomly.


• A search in an unstructured P2P is not very efficient because a
query to find a file must be flooded through the network,
which produces significant traffic and still the query may not be
resolved.
•Two examples of this type of network are Gnutella and Freenet.
Structured
•A structured network uses a predefined set of rules to link
nodes so that a query can be effectively and efficiently
resolved.
•The most common technique used for this purpose is the
Distributed Hash Table (DHT).
•One popular P2P file sharing protocol that uses the DHT is
BitTorrent.
Domain Name System (DNS)
• This is a client-server application program designed to help
other application programs.
• To identify an entity, TCP/IP protocols use the IP address,
which uniquely identifies the connection of a host to the
Internet.
• However, people prefer to use names instead of numeric
addresses.
• Therefore, the Internet needs to have a directory system
that can map a name to an address.
•Since the Internet is so huge today, a central directory system
cannot hold all the mapping.
•In addition, if the central computer fails, the whole
communication network will collapse.
•A better solution is to distribute the information among
many computers in the world.
•In this method, the host that needs mapping can contact the
closest computer holding the needed information.
• This method is used by the Domain Name System (DNS).
•The following six steps map the host name to an IP address:
•1. The user passes the host name to the file transfer client.
•2. The file transfer client passes the host name to the DNS client.
•3. 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.
•4. The DNS server responds with the IP address of the desired
file transfer server.
•5. The DNS client passes the IP address to the file transfer
client.
•6. The file transfer client now uses the received IP address to
Other Services
• Host aliasing:
– relayl.west-coast.enterprise.com is said to be canonical hostname.
– two aliases such as enterprise.com and www.enterprise.com
• Mail server aliasing:
– mail address is mnemonic.
– email address such as [email protected] here name of gmail mail
server is more complicated and we are using alias name.
• Load distribution:
– Allow load distribution among replicated servers, such as web
severs.
– each server running in different end systems and different IP
address and one host name.
– When client makes DNS query for a name it is mapped to set
of IP addresses , the server responds with entire list
– the IP address is rotated .First one is served the move to end of
list.
Distributed Heirarchical Database
• use large number of servers in heirarchical structure
distributed across world.
• There are 3 classes of DNS servers
1. Root DNS servers: 13 root DNS server, most of it located in
north america
2. Top level domain DNS servers: Responsible for TLD such as
com,gov,org,net,edu and country TLD like in,uk,jp etc.
Company network solutions maintain com TLD.
Company educase maintains edu TLD.
3. Authoritative DNS servers: Every organization with
publicly accessible host on internet must provide publicly
accessible DNS records that maps names to ip address.
Organizations authoritative DNS servers houses these
records.
4. Local DNS Server: A university,employee
company,academic department etc has a local DNS
server also known as default name server.

Q: Why not centralize DNS ?


• Step by step communication
• host cis.poly.edu desire IP address of host
gaia.cs.umass.edu
• cis.poly.edu -local DNS - dns.poly.edu
• gaia.cs.umass.edu - authoritative DNS - dns.umass.edu

• Two types DNS queries


1. Recursive query: Ask another server to obtain
mapping on its behalf
2. Iterative query : Obtain mapping directly
DNS Caching
• When DNS server receives a DNS reply that is hostname
with its IP address mapping it can cache information in
local memory.
• If DNS query for same hostname arrives it can provide IP
address directly.
• Since mapping is not permanent DNS server discard
cache information after two days.
• Explain with an example.
DNS Records and Messages
• DNS resource records (RR) contains hostname to IP
address mapping.
• DNS reply message contains 1 or more RR.
• it consist of four tuples and the fields are:
(name,value,type,TTL)
• TTL - time to live in resource records. That is when it
should be removed from cache.
• Depending on the type the meaning of name and value
changes
• There are totally 4 types :
1. Type =A, name= hostname value = ip address
2. Type = NS name= domain value = hostname
3. Type = CNAME name= alias hostname value =
canonical hostname
4. Type = MX name= alias hostname value = canonical
name of mail server
DNS Messages
• Two types of message DNS query and reply message.
• Same format
• Format as follows:
1. first 12 byte header section:
1st field - 16 bit number identifies the query, identifier is
copied to reply message for client to match query and reply.
Flag field -
1 bit flag to indicate if message is query or reply.
1 bit authoritative flag is set when DNS server is
authoritative server.
1 bit recursion desired flag when client requires DNS to
perform recursion.
4 number fields:
numbers of questions,
numbers of answer RRs,
numbers of authority RRs,
numbers of additional RRs
2.Question Section: information about query , it contains
name and type field.
3. Answer Section: Resource records for the query.
4.Authority Section : Record of authority servers.
5.Additional Section: Other helpful records.

You might also like