The Application Layer: Lecture-9
The Application Layer: Lecture-9
The Application Layer: Lecture-9
3
Domain Name System (DNS)
Although programs theoretically could refer to hosts, mailboxes,
and other resources by their network (e.g., IP) addresses, these
addresses are hard for people to remember. Nevertheless, the
network itself understands only numerical addresses, so some
mechanism is required to convert the ASCII strings to network
addresses.
DNS is a distributed hierarchical and global directory that
translates machine or domain names to numerical IP address. DNS
can be thought as a distributed database system used to map host
names to IP address and vice-versa.
A distributed database is a database in which storage devices are not all attached
to a common processing unit such as the CPU, and which is controlled by a
distributed database management system (together sometimes called a distributed
database system). It may be stored in multiple computers, located in the 4same
physical location; or may be dispersed over a network of interconnected
DNS is an application layer protocol, and every Internet service
provider has a DNS server. In the normal mode of operation, a hosts
send UDP (connection less) queries to a DNS server. The DNS
server either replies or directs the queries to another server.
5
The DNS Name Space
In theory at least, a single name server could contain the entire DNS
database and respond to all queries about it. In practice, this server
would be so overloaded as to be useless.
To avoid the problems associated with having only a single source
of information, the DNS name space is divided into nonoverlapping
zones.
Conceptually, the Internet is divided into over 200 top-level
domains, where each domain covers many hosts. Each domain is
partitioned into sub-domains, and these are further partitioned, and
so on.
All these domains can be represented by a tree, as shown in fig.1 of
next slide. The leaves of the tree represent domains that have no
sub-domains (but do contain machines, of course). A leaf domain
may contain a single host, or it may represent a company and
6
contain thousands of hosts.
The top-level domains come in two flavors: generic and countries.
The original generic domains were com (commercial), edu
(educational institutions), gov (the U.S. Federal Government), int
(certain international organizations), mil (the U.S. armed forces), net
(network providers), and org (nonprofit organizations). The country
domains include one entry for every country
8
Example-1
The domain name cs.purdue.edu contains three labels: cs, purdue
and edu. It gives the domain name for Computer Science
Department at Purdue University. Again purdue.edu gives the
domain name of Purdue University.
The domain names are written with the local label first and the top
domain last.
9
Example-2
Let the host private (whose machine/domain name is private.pbhs.brevard.k12.fl.us and IP
address is 204.128.68.25) wants to connect the Web server raider, which is in the
rhs.brevard.k12.fl.us domain. The web browser on private places a DNS query to the DNS
server for brevard.k12.fl.us, which is authorized for the brevard.k12.fl.us domain. This DNS
server looks up the information in its database and returns the IP address.
rhs.brevard.k12.fl.us
pbhs.brevard.k12.fl.us
A Web server is a program that uses HTTP (Hypertext Transfer Protocol) to serve the files that
form Web pages to users, in response to their requests, which are forwarded by their computers'
10
HTTP clients. Dedicated computers and appliances may be referred to as Web servers as well.
Root Server Root Server Root Server
rhs.brevard.k12.fl.us
pbhs.brevard.k12.fl.us
If DNS server can not resolve the name it replies by specifying the
name server that should be connected next. Eventually a root
server gets involved. Root server maintain information about all
the authorative name server for each top level domain. A root
server will eventually provide it with the att.com DNS server’s
address. The brevard name server then contacts the att.com name
server, which will return the address 192.20.3.54
12
DNS Name Resolution
14
Resource Records
15
Every domain, whether it is a single host or a top-level domain, can
have a set of resource records associated with it. For a single host,
the most common resource record is just its IP address, but many
other kinds of resource records also exist. The primary function of
DNS is to map domain names onto resource records.
The Time_to_live field gives an indication of how stable the record is.
The third field of every resource record is the Class. For Internet
information, it is always IN. For non-Internet information, other
codes can be used, but in practice, these are rarely seen.
16
The Type field tells what kind of record this is. The most important
types are listed in Table. below.
17
Example-3 What do you mean by record:
ait.ac.th 86400 IN MX kuddus.ait.ac.th
21
The flits is a Sun workstation running UNIX and giving both of
its IP addresses. Then three choices are given for handling e-mail
sent to flits.cs.vu.nl. First choice is naturally the flits itself, but if
it is down, the zephyr and top are the second and third choices..
26
Example-1
In fig. of next slide, user1 is in a residential area, has an Internet
Service Provider (ISP), and is sending an e-mail to user2 working in
an organization. Suppose that the mail servers are isp.com and
organization.com respectively. The e-mail addresses of user1 and
user2 are [email protected] and [email protected]
respectively.
27
User-1
[email protected]
R3 R5
R1
LAN-1 User-2
[email protected]
R2
R6 SMTP
R4
Organization campus
31
Multipurpose Internet Mail Extensions (MIME)
The multipurpose Internet mail Extensions (MIME) were defined to
allow transmission of non-ASCII data through e-mail. MIME does
not change or replace protocols such as SMTP, POP3. Instead MIME
allows arbitrary data to be encoded in ASCII and then transmitted in a
standard e-mail message.
Fig. below illustrates a MIME message that contains a JPEG where
the image is converted to 7-bit ASCII (base64 encoding)
representation.
From: [email protected]
To: [email protected]
MIME-Version:1.0
Content-Type: Image/jpeg
Content-Transfer-Encoding: base64
33
The World Wide Web
Conceptually, the web consists of a vast, worldwide collection of
contents in the form of Web pages, often called pages for short. The
Web pages are accessible over the Internet. Each page may contain
links to other pages anywhere in the world.
The hyperlink needs a way to name any other page on the Web.
Pages are named using URLs (Uniform Resource Locators). A
typical URL is
http://www.abcd.com/products.html
36
For the moment, it is sufficient to know that a URL has three parts:
the name of the protocol (http), the DNS name of the machine
where the page is located (www.abcd.com), and (usually) the name
of the file containing the page (products.html).
37
Let us trace the steps that occur when this link is selected.
1. The browser determines the URL (by seeing what was selected).
2. The browser asks DNS for the IP address of www.itu.org.
3. DNS replies with 156.106.192.32.
4.The browser makes a TCP connection to 156.106.192.32 on port
80 i.e. HTTP protocol.
5. It then sends over an HTTP request asking for file
/home/index.html.
6. The www.itu.org server sends the file /home/index.html as an
HTTP response.
7. The TCP connection is released.
8. The browser displays all the text in /home/index.html.
9. The browser fetches and displays all images in this file.
38
Although a browser is basically an HTML interpreter, most
browsers have numerous buttons and features to make it easier to
navigate the Web. Most have a button for going back to the
previous page, a button for going forward to the next page (only
operative after the user has gone back from it), and a button for
going straight to the user's own start page.
39
The Server Side
When the user types in a URL or clicks on a line of hypertext, the
browser parses the URL and interprets the part between http://
and the next slash as a DNS name to look up. Armed with the IP
address of the server, the browser establishes a TCP connection to
port 80 on that server. Then it sends over a command containing
the rest of the URL, which is the name of a file on that server. The
server then returns the file for the browser to display.
The steps that the server performs in its main loop are:
1. Accept a TCP connection from a client (a browser).
2. Get the name of the file requested.
3. Get the file (from disk).
4. Return the file to the client.
5. Release the TCP connection.
40
A problem with this design is that every request requires making a
disk access to get the file. The result is that the Web server cannot
serve more requests per second than it can make disk accesses. A
high-end SCSI disk has an average access time of around 5 msec,
which limits the server to at most 200 requests/sec, less if large files
have to be read often. For a major Web site, this figure is too low.
41
The next step for building a faster server is to make the server
multithreaded. In one design, the server consists of a front-end
module that accepts all incoming requests and k processing modules,
as shown in Fig. below. When a request comes in, the front end
accepts it and builds a short record describing it. Then it hand the
record to one of the processing modules.
42
Figure . A multithreaded Web server with a front end and processing modules
The processing module first checks the cache to see if the file
needed is there. If so, it updates the record to include a pointer to
the file in the record. If it is not there, the processing module starts
a disk operation to read it into the cache (possibly discarding some
other cached files to make room for it). When the file comes in
from the disk, it is put in the cache and also sent back to the client.
43
URLs—Uniform Resource Locators
If every page were somehow assigned a unique name, there would
not be any ambiguity in identifying pages.
URLs have three parts: the protocol (also known as the scheme), the
DNS name of the machine on which the page is located, and a local
name uniquely indicating the specific page (usually just a file name
on the machine where it resides). As an example, the Web site for
the author's department contains several videos about the university
and the city of Amsterdam. The URL for the video page is
http://www.cs.vu.nl/video/index-en.html
This URL consists of three parts: the protocol (http), the DNS name
of the host (www.cs.vu.nl), and the file name (video/index-en.html),
with certain punctuation separating the pieces. The file name is a
path relative to the default Web directory at cs.vu.nl.
44
URL scheme is open-ended in the sense that it is straightforward
to have browsers use multiple protocols to get at different kinds
of resources. In fact, URLs for various other common protocols
have been defined. Slightly simplified forms of the more
common ones are listed in Table-1
45
HTTP Overview
The request-response protocol for fetching pages is a simple text-
based protocol that runs over TCP, called HTTP (Hyper Text
Transfer Protocol). The most typical use of HTTP is between a Web
browser and a Web server or between intermediate machines and a
Web browser.
In most cases, a browser requests a Web page, and the server
transfers a copy to the browser. HTTP also allows transfers
from browser to server (form upload).
In the simplest form, web pages are static. That is, they are just files
sitting on some server that present themselves in the same way each
time they are fetched and viewed.
49
Markup languages thus contain explicit commands for
formatting. For example, in HTML, <b> means start boldface
mode, and </b> means leave boldface mode. The advantage of a
markup language over one with no explicit markup is that
writing a browser for it is straightforward: the browser simply
has to understand the markup commands.
50
<html>
<head>
<title> Example
<h1>This is CSE of Jahangirnagar University</h1>
</title>
</head>
<body style="backgroung-color:yellow;">
This is fourth year student <br/>
<i> Our favorite course is CSE-108 </i> <br/>
<h3> We will take thesis in next year </h3> <br/>
<p style="font-size:36px; text-align:center;">
Our M.Sc class will star soon </p>
<h3 style="font-family:arial;color:blue;"> We will take thesis in next year </h3> <br/>
</body>
</html>
Static Documents
Static documents are fixed-content documents that are created
and stored in a server. The client can get only a copy of the
document. In other words, the contents of the file are determined
when the file is created, not when it is used. Of course, the
contents in the server can be changed, but the user cannot change
them.
52
Dynamic Documents
A dynamic document is created by a Web server whenever a
browser requests the document. When a request arrives, the Web
server runs an application program or a script that creates the
dynamic document. The server returns the output of the program
or script as a response to the browser that requested the document.
54
Web Caching (Proxy Server)
An HTTP request from a user is first directed to the network proxy
server or web cache. Normally each organization or ISP should
have its own cache providing a high speed link to its user.
Individual PCs often run proxies so they can quickly look up pages
previously visited. On a company LAN, the proxy is often a
machine shared by all the machines on the LAN, so if one user
looks at a certain page and then another one on the same LAN
wants the same page, it can be fetched from the proxy's cache. 55
Requests first go to the local proxy. If that fails, the local proxy
queries the LAN proxy. If that fails, the LAN proxy tries the ISP
proxy. The latter must succeed, either from its cache, a higher-level
cache, or from the server itself. A scheme involving multiple
caches tried in sequence is called hierarchical caching. A possible
implementation is illustrated in fig. below.
The user browser transmits its HTTP request to the Web cache.
If the Web cache has a copy of the requested object , the Web
cache forwards the object to the user browser.
57
Figure below shows three Internet service providers (ISPs). A user in ISP domain 3
is browsing to find and watch an object namedhttp://www.filmmaker.comin ISP
domain 1. The request for this object is directed to the Web cache, shown by dashed
lines. In this example, the Web cache has no record of the requested object and
therefore is establishing another TCP connection to update its record.
59
File Transfer Protocol (FTP)
File transfer is an important computer networking application. It is
always essential that files and information geographically
distributed over different location be shared among the numbers of
working group.
File Transfer Protocol (FTP) is part of the TCP/IP suite and is very
similar to TELNET. Both FTP and TELNET are built on the client
server paradigm, and both allow a user to establish a remote
connection. However, TELNET provides a broader access to a user,
whereas FTP allows access only to certain files. The sequence of
operation of FTP is like:
60
1. A user requests a connection to a remote server
2. The user waits for an acknowledgement.
3. Once connected, the user must enter a user ID, followed by
password.
4. The connection is established over TCP session.
5. The desired files are transferred.
6. The user closes the FTP connection.
FTP can also run through a Web browser.
61
Well-Known TCP Port Numbers
In TCP/IP and UDP networks, a port is an endpoint to a logical
connection and the way a client program specifies a specific server
program on a computer in a network. The port number identifies what
type of port it is. For example, port 80 is used for HTTP traffic.
20 FTP -- Data
21 FTP -- Control
22 SSH Remote Login Protocol
23 Telnet
25 SMTP
53 DNS
80 HTTP
110 POP3
161 SNMP
62
Network Management
The main purpose of network management is to monitor, manage,
and control a network. A network can be structured with many
links, routers, servers, and other physical-layer devices, which can
be equipped with many network protocols that coordinate them.
64
Network failure management. Any fault in a network, such as link, host, or router
hardware or software outages, must be detected, located, and responded to by the
network. Typically, increased checksum errors in frames is an indication of possible
error. Figure shows adapter failures at router R3 and host H37; these failures can be
detected through network management.