0% found this document useful (0 votes)
14 views17 pages

CN Unit 5

Computer network

Uploaded by

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

CN Unit 5

Computer network

Uploaded by

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

Computer Networks

Unit-V

DATA COMMUNICATION & COMPUTER NETWORKS Page 1


USER DATAGRAM
PROTOCOL
 The User Datagram Protocol (UDP) is a connectionless, unreliable transport protocol. UDP is a
very simple protocol using a minimum of overhead.
 If a process wants to send a small message and does not care much about reliability, it can use
UDP. Sending a small message using UDP takes much less interaction between the sender and
receiver than using TCP.

User Datagram:
 UDP packets, called user datagrams, have a fixed-size header of 8 bytes made of four fields,
each of 2 bytes (16 bits). The first two fields define the source and destination port numbers.
The third field defines the total length of the user datagram, header plus data.

Fig: User datagram packet format

Example:
The following is the content of a UDP header in hexadecimal format.

CB84000D001C001C
a. What is the source port number?
b. What is the destination port number?
c. What is the total length of the user datagram?
d. What is the length of the data?
e. Is the packet directed from a client to a server or vice versa?
f. What is the client process?

Solution
a. The source port number is the first four hexadecimal digits (CB84)16, which means that
the source port number is 52100.
b. The destination port number is the second four hexadecimal digits (000D)16, which
means that the destination port number is 13.
c. The third four hexadecimal digits (001C)16 define the length of the whole UDP packet
as 28 bytes.
d. The length of the data is the length of the whole packet minus the length of the header, or
28 −8 20 bytes.
e. Since the destination port number is 13 (well-known port), the packet is from the client
to the server.
f. The client process is the Daytime (see Table1).

UDP Services:
Process-to-Process Communication:
 UDP provides process-to-process communication using socket addresses, a combination of IP
addresses and port numbers.

Connectionless Services:
 UDP provides a connectionless service. This means that each user datagram sent by UDP is an
independent datagram. There is no relationship between the different user datagrams even if they
are coming from the same source process and going to the same destination program.
 The user datagrams are not numbered. Also, unlike TCP, there is no connection establishment
and no connection termination. This means that each user datagram can travel on a different path.

Flow Control:
 UDP is a very simple protocol. There is no flow control, and hence no window mechanism. The
receiver may overflow with incoming messages.

Error Control:
 There is no error control mechanism in UDP except for the checksum. This means that the
sender does not know if a message has been lost or duplicated.
 When the receiver detects an error through the checksum, the user datagram is silently discarded.

Checksum:
 UDP checksum calculation includes three sections: a pseudo header, the UDP header, and the
data coming from the application layer. The pseudo header is the part of the header of the IP
packet in which the user datagram is to be encapsulated with some fields filled with 0s.
TELNET

TELNET (TELecommunication NETwork) is a network protocol used on the Internet or local


area network (LAN) connections. It was developed in 1969 beginning with RFC 15 and
standardized as IETF STD 8, one of the first Internet standards. Telnet was developed in 1969
to aid in remote connectivity between computers over a network.
It is a network protocol used on the Internet or local area networks to provide a bidirectional
interactive communications facility. Typically, telnet provides access to a command-line interface on
a remote host via a virtual terminal connection which consists of an 8-bit byte oriented data
connection over the Transmission Control Protocol (TCP). User data is interspersed in-band with
TELNET control information. The user's computer, which initiates the connection, is referred to
as the local computer.
The computer being connected to, which accepts the connection, is referred to as the remote
computer. The remote computer can be physically located in the next room, the next town or in
another country.
The network terminal protocol (TELNET) allows a user to log in on any other computer on the
network. We can start a remote session by specifying a computer to connect to. From that time until
we finish the session, anything we type is sent to the other computer.
The Telnet program runs on the computer and connects your PC to a server on the network. We can
then enter commands through the Telnet program and they will be executed as if we were entering
them directly on the server console. This enables we to control the server and communicate with other
servers on the network. To start a Telnet session, we must log in to a server by entering a valid
username and password. Telnet is a common way to remotely control Web servers.
The term telnet also refers to software which implements the client part of the protocol. TELNET
clients have been available on most Unix systems for many years and are available virtually for all
platforms. Most network equipment and OSs with a TCP/IP stack support some kind of TELNET
service server for their remote configuration including ones based on Windows NT. TELNET is a
client server protocol, based on a reliable connection oriented transport. Typically this protocol used
to establish a connection to TCP port 23, where a getty-equivalent program (telnetd) is listening,
although TELNET predates.
Connecting to a Remote Host
Follow these steps to connect to a remote host using Telnet
1. Open Telnet by clicking on Start menu and choose run. Now type Telnet, and press
Enter key from the keyboard or by clicking on the OK button.
2. From the Menu, choose Connect. Remote
3. Enter the name or IP address of the system that you want to connect to in the Host
Name Field.
4. If required, a port in the Port field.
5. In the term Type, select the type of terminal that you want Telnet to emulate.
6. After you are finished with the remote host, you can disconnect from a remote host by
choosing Connect, Disconnect.

File Transfer Protocol

File Transport Protocol, or FTP, is an open protocol standard that is widely used to transport and
receive large files. FTP can be used to send and receive large files. FTP can also be used to send
configuration files and software updates for network switches and routers. It uses ports for
communications and also uses encryption to protect the information being received and sent. In this
lesson, we will go over these topics so that you can be familiar with FTP and what it has to offer.
Establishing the FTP Connection using Port 21 on the FTP Server
1. The FTP Client opens a random port on itself to initiate the request. In this case, the FTP client
chooses
Port 1.
2. The FTP Client will then forward its requests for FTP connection using its own Port 1 (this is
used to
tell the FTP server what to do i.e., 'Download', 'Stop' and 'Cancel Download') to the FTP server
which
is listening on Port 21.
3. Once the FTP server receives the FTP connection requests on its Port 21, the FTP Server will
then send
an acknowledgment back to the FTP Client using its address of Port 1 saying that the connection is
now established and download may commence.
At this point, the connection is only established between the FTP Client and the FTP Server.

Establishing the FTP client to download data from Port 20 on the FTP Server

1. The FTP Client will now send a data request signal to the FTP server. In this data request, the
FTP client tells the FTP server 'Hey, send me the data I want to download. Use Port 2 as my
delivery address.’
2. Now that the FTP server knows to send the data to Port 2 on the FTP client, The FTP server
will now
open a new port which is Port 20. Port 20 is solely used to send the data to the FTP client, nothing
more. Now, using its Port 20, the FTP server will send the data to the client, using the client's Port
2 as
its delivery address.
3. Once the download is complete, the client will tear down the connection if the download
is successful.

Domain Name System

Domain Name System helps to resolve the host name to an address. It uses a hierarchical naming
scheme and distributed database of IP addresses and associated names.
IP Address
IP address is a unique logical address assigned to a machine over the network. An IP address
exhibits the following properties:
 IP address is the unique address assigned to each host present on Internet.
 IP address is 32 bits (4 bytes) long.
 IP address consists of two components: network component and host component.
Each of the 4 bytes is represented by a number from 0 to 255, separated with dots. For
example 137.170.4.124
IP address is 32-bit number while on the other hand domain names are easy to remember names.

URL Types

There are two forms of URL as listed below:


1. Absolute URL
2. Relative URL

Absolute URL Relative URL

Used to link web pages on different websites Used to link web pages within the same website.

Difficult to manage. Easy to Manage

Changes when the server name or directory name Remains same even of we change the server name or directory
changes name.

Take time to access Comparatively faster to access.

Domain Name System Architecture

The Domain name system comprises of Domain Names, Domain Name Space, Name Server that
have been described below:

Domain Names

Domain Name is a symbolic string associated with an IP address. There are several domain names
available; some of them are generic such as com, edu, gov, net etc, while some country level domain
names such as au, in, za, us etc.
The following table shows the Generic Top-Level Domain names:

Domain Name Meaning

Com Commercial business

Edu Education

Gov U.S. government agency


Int International entity

Mil U.S. military

Net Networking organization

Org Non profit organization

The following table shows the Country top-level domain names:

Domain Name Meaning

Au Australia

In India

Cl Chile

Fr France

Us United States

Za South Africa

Uk United Kingdom

Jp Japan

Es Spain

De Germany

Ca Canada

Ee Estonia

Hk Hong Kong

Domain Name Space


The domain name space refers a hierarchy in the internet naming structure. This hierarchy has
multiple levels (from 0 to 127), with a root at the top. The following diagram shows the domain name
space hierarchy:
In the above diagram each subtree represents a domain. Each domain can be partitioned into sub domains and
these can be further partitioned and so on.

Name Server
Name server contains the DNS database. This database comprises of various names and their
corresponding IP addresses. Since it is not possible for a single server to maintain entire DNS
database, therefore, the information is distributed among many DNS servers.
 Hierarchy of server is same as hierarchy of names.
 The entire name space is divided into the zones.
Types of Name Servers
Following are the three categories of Name Servers that manages the entire Domain Name System:
 Root Server
 Primary Server
 Secondary Server
Root Server
Root Server is the top level server which consists of the entire DNS tree. It does not contain the
information about domains but delegates the authority to the other server.
Primary Server
Primary Server stores a file about its zone. It has authority to create, maintain, and update the zone
file.
Secondary Server
Secondary Server transfers complete information about a zone from another server which may be
primary or secondary server. The secondary server does not have authority to create or update a zone
file.
DNS Working
DNS translates the domain name into IP address automatically. Following steps will take you through
the steps included in domain resolution process:
 When we type www.point.com into the browser, it asks the local DNS Server for its IP
address.
Here the local DNS is at ISP end.
 When the local DNS does not find the IP address of requested domain name, it forwards
the request to the root DNS server and again enquires about IP address of it.
 The root DNS server replies with delegation that I do not know the IP address
of www.point.com but know the IP address of DNS Server.
 The local DNS server then asks the com DNS Server the same question.
 The com DNS Server replies the same that it does not know the IP address of www.point.com
but knows the address of point.com.
 Then the local DNS asks the point.com DNS server the same question.
 Then point.com DNS server replies with IP address of www.point.com.
 Now, the local DNS sends the IP address of www.point.com to the computer that sends the
request.

SMTP
SMTP stands for Simple Mail Transfer Protocol. It is a TCP/IP protocol that specifies how
computers exchange electronic mail. It works with post office protocol (POP).
SMTP is used to upload mail directly from the client to an intermediate host, but only computers
constantly connected such as Internet Service Providers (ISP) to the Internet can use SMTP to receive
mail. The ISP servers then offload the mail to the users to whom they provide the Internet service.
SMTP uses TCP port number 25 for his service. Therefore e-mail is delivered from source to
destination by having the source machine established a TCP connection to port 25 of the destination
machine.
To send a mail, a system must have a client MTA, and to receive a mail, a system must have a
server MTA. SMTP transfers this message from client MTA to server MTA. SMTP uses commands
and responses to transfer the message between an MTA client and MTA server In order to send a
mail, SMTP is used two times: one between the sender and the sender's mail server, and the other
between the two mail servers.
Each command or response ends with two characters (CR and LF) CR stands for Carriage Return
and LF stands for Line Feed.
Windows NT Option Pack 4 includes an SMTP mail client so do the Windows NT Resource Kit.
Microsoft Exchange Server will route your LAN mail on and off the Internet.
Working of SMTP
SMTP is a simple ASCII protocol that is based on client-server model. After establishing the TCP
connection, the sending machine, operating as the client, waits for the receiving machine, operating
as the server, to talk first. The server starts by sending a line of text giving its identity and telling
whether or not it is prepared to receive mail. If it is not, the client releases the connection and tries
again later.
If the server is willing to accept e-mail, the client announces whom the e-mail is coming from and
destination, the server gives the client the go ahead to send the message. Then the client sends the
message and the server acknowledges it.
The problems that may arise with SMTP protocol are as follows:
Some older version of SMTP implementations cannot handle messages exceeding 64KB.
If the client and server have different timeouts, one of them may give up while the other is still busy,
unexpectedly terminating the connection.
To get around these problems, extended SMTP (ESMTP) has been defined in RFC 1425.
SMTP Commands
• SMTP commands are sent from the client to the server.
• Each command consists of a keyword or command name followed by zero or more argument.
It means some keywords do not contain any argument.
• The format of command is:
Keyword: argument(s)
• There are 14 different SMTP commands listed in the table below:
SMTP Responses
• SMTP responses are sent from server to client.
• Each response begins with a three digit code and may be followed by additional textual information.
• The leading digits indicate the category of the response.
The difference categories of response are:
1. Positive completion reply. It indicates that the requested action has been successfully completed.
A new request may be initiated.
2. Positive Intermediate reply. It indicates that the command has been accepted, but the
requested action is being held in abeyance, pending receipt of further information.
3. Transient Negative Completion reply. It indicates that the command was not accepted and
the requested action did not occur. However, the error condition is temporary and the action may
be requested.
4. Permanent Negative Completion reply. It indicates the command was not accepted and
the requested action did not occur.
The various SMTP responses are listed in the table below:
Mail Transfer Phases
The basic SMTP operation occurs in three phases:
1. Connection set up
2. Mail transfer
3. Connection termination
Connection Setup
An SMTP sender will attempt to set up a TCP connection with a target host when it has one or more
mail message to deliver to that host. The following sequence occurs during connection setup:
1. The sender opens a TCP connection with the receiver.
2. Once the connection is established, the receiver identifies itself with '220 Service Ready".
3. The sender identifies itself with the HELO command.
4. The receiver accepts the sender's identification with "250 'OK".
5. If the mail service on the destination is not available, the destination host returns a "421
Service Not
Available" reply in step 2 and the process is terminated.
Mail transfer
• Once the connection has been established, the SMTP sender may send one or more messages to the
SMTP receiver.
• There are three logical phases to the transfer of a message:
1. A MAIL command identifies the originator of the message.
2. One or more RCPT commands identify the recipients of this message.
3. A DATA command transfers the message text.
Connection termination
• The SMTP sender closes the connection in the following manner:
1. The sender sends a QUIT command and waits for a reply.
2. Sender initiates TCP close operation for the TCP connection.
3. The receiver initiates its TCP close after sending is reply to the QUIT command.

HTTP (HyperText Transfer Protocol)


Introduction
The WEB
Internet (or The Web) is a massive distributed client/server information system as depicted in the
following diagram.
Many applications are running concurrently over the Web, such as web browsing/surfing, e-mail,
file transfer, audio & video streaming, and so on. In order for proper communication to take place
between the client and the server, these applications must agree on a specific application-level
protocol such as HTTP, FTP, SMTP, POP, and etc.
Hyper Text Transfer Protocol (HTTP)
HTTP (Hypertext Transfer Protocol) is perhaps the most popular application protocol used in the
Internet (or The WEB).
HTTP is an asymmetric request-response client-server protocol as illustrated. An HTTP client
sends a request message to an HTTP server. The server, in turn, returns a response message. In other
words, HTTP is a pull protocol, the client pulls information from the server (instead of server pushes
information down to the client).
 HTTP is a stateless protocol. In other words, the current request does not know what has
been done in the previous requests.
 HTTP permits negotiating of data type and representation, so as to allow systems to be built
independently of the data being transferred.
 Quoting from the RFC2616: "The Hypertext Transfer Protocol (HTTP) is an application-
level protocol for distributed, collaborative, hypermedia information systems. It is a generic,
stateless, protocol which can be used for many tasks beyond its use for hypertext, such as
name servers and distributed object management systems, through extension of its request
methods, error codes and headers."
Browser
Whenever you issue a URL from your browser to get a web resource using HTTP, e.g.
http://www.nowhere123.com/index.html, the browser turns the URL into a request message and sends it
to the HTTP server. The HTTP server interprets the request message, and returns you an appropriate
response message, which is either the resource you requested or an error message. This process is
illustrated below:

World Wide Web


The Internet and the World Wide Web
The Internet is a collection of computers, all connected to one another. It first got its start in 1966
as the ARPANET, a project of the Defense Department’s Advanced Research Projects Agency. At
some point it was opened up to university researchers, and, for many years, was used primarily for
transferring email and files among university researchers and for exchanging information via
newsgroups. Each computer that is connected to the network is called an internet host. In 1986 there
were 5,000 hosts and 241 newsgroups.
In 1990, Tim Berners-Lee came up with the idea of having a large number of documents, all of
which could be linked together and refer to one another. He called this set of documents the World
Wide Web (WWW). Each person or organization’s collection of documents was called a website. The
idea caught on quickly. In 1993 there were 600 websites. (The Internet itself was still growing; there
were now two million Internet hosts.) In 1995 there were 100,000 websites. Today there are literally
millions of websites, and the number of Internet hosts has grown as well.
Clients and Servers
Each Internet host can act as a server, or a repository files. Some hosts hold email files, some hold
newsgroup postings, and others hold web pages. A server’s purpose in life is to wait for requests to
come in from some client, find the requested file or page, and send it back to the client. A client is
usually an end user’s computer.
Think of it as a store. You’re the client; you go in and ask the server for a particular item. He goes
back to where all the products are stored, prepares the item, and brings it out to you.
Similarly, when you sit at your computer, you request a particular file. That request goes to the
appropriate server, which finds the file and sends it back to you. The software that you use depends
on the kind of files you want. If you are requesting web pages, you use a browser. If you are
requesting email, you use a program designed for reading mail. If you’re reading newsgroup posts,
you may use a special news reader program. For your convenience, the latest browsers have
combined all these functions into various sections of a single program.
In the first assignment for this course, you will set up an account for yourself on a
Windows machine, which will be the machine that you use as a client. You will also set up an
account on a UNIX machine which will serve files to you.
HTML
Before the WWW, people exchanged just plain text files or they exchanged files in some
proprietary format. One of Berners-Lee’s objectives was to create a way to write files that would
improve upon plain text, but be open to everyone. That method is HTML, which stands for Hyper
Text Markup Language.
Markup
Markup comes from the bad old days before word processors. If you needed a brochure, you’d
type it on a typewriter, and then literally mark it up with a red pen to tell the typesetter what you
wanted it to look like. The typesetter would follow your instructions and return a finished document to
you.
Hypertext
In addition to elements that let you specify how a document should be structured and presented,
HTML has tags that let you tell how your document should be linked to other documents on the
WWW. This ability to link documents together is called hypertext. The term was invented in 1965 by
Ted Nelson, but the idea itself has been around since 1945.
HTML, XHTML, and HTML5
The rules for how you write proper HTML (before version 5) are defined by the Standard
Generalized Markup Language (SGML) rulebook. In recent years, a new rulebook known as XML, the
Extensible Markup Language has emerged. It is not as powerful as the SGML rulebook, but it is far
simpler. When we write HyperText Markup Language according to the rules of SGML, we call it
HTML. When we write the same elements according to the rules of XML, we call it XHTML. The
newest version, HTML5, lets you write your markup in either HTML or XHTML syntax.
HTML Documents
HTML documents consist of text with tags. Tags are commands written between less than (<) and
greater than (>) signs, also known as angle brackets. Here’s an example of the tag that tells the
browser to use boldface text:
This is a <b>special message</b> for you!
The opening tag, closing tag, and the content in between are collectively called an HTML element.
Technically, tags and elements are very different, but most people use the terms interchangeably.
Things to remember about tags:
 Don’t leave a space after the opening < sign.
 The closing tag has the same command name as the opening tag, and it has a forward slash (/)
after the <.
 When using XHTML syntax, every opening tag must have a closing tag.
 In XHTML syntax, the tag names and attribute names must be written entirely in lowercase.
XHTML is known as a case-sensitive markup language.
The Document Template
Build a template HTML5 file; a “framework” that can be copied and filled in. All our HTML5 files
will be built on this framework.

1. Open a new file, and type the opening and closing <html> tag. This tag is a structure tag; it
tells the browser that the entire document will be between these tags. Leave some blank
lines between the opening and closing tags; you’ll be putting things in between them later.
2. <html>
3.
</html>

4. Now add this to the opening tag; it lets the browser know that the primary language of
this document is English:
5. <html xml:lang="en" lang="en">
6.
</html>

7. Business letters have a head and a body. The head gives identifying information (who it’s
from, whom it’s to, the date, etc.). The body contains the actual content of the letter.
Similarly, our HTML documents will also have a head and a body. Add the opening and
closing <head> and <body> tags to your template:
8. <html xml:lang="en" lang="en">
9. <head>
10.
11. </head>
12.
13. <body>
14.
15. </body>
</html>

16. Put a title in the head of the document. This is identifying information. Some search
engines use it to index your files. If you bookmark a page, the title of the document is used
as the bookmark text. Add a <title> tag:
17. <html xml:lang="en" lang="en">
18. <head>
19. <title>Put a Title Here</title>
20. </head>
21.
22. <body>
23.
24. </body>
</html>
Since it is the world wide web, not all web pages are in English. You can specify, for example,
that a page is written entirely with Russian or Chinese characters. In our case, we’ll add the <meta>
element to specify that we are using a “universal” character set called Unicode.
<html xml:lang="en" lang="en">
<head>
<title>Put a Title Here</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>

</body>
</html>
Note: there is a simpler way to specify the character set, but it does not work on all browsers. The
<meta> element given here works on all modern browsers.
In order to get the best of all possible worlds—a document that can be processed either as XHTML
or HTML5, you must add a namespace declaration; it lets XML processing tools know which
elements are part of HTML. This is useful when you have a document that contains markup from
several different markup languages.
<html xml:lang="en" lang="en"
xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Put a Title Here</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>

</body>
</html>

The template is almost finished. Two things must be added at the beginning of the document. The
first thing is a Document Type Declaration. The Document Type Declaration (DTD) must be the very
first line in your document; do not leave a blank line before it. The DTD is not a tag! It is a
declaration, which declares to the browser precisely which “flavor” of HTML the document uses. The
very latest browsers will use the declaration to determine how certain tags should be displayed. When
using HTML5, the document type declaration is very simple.

<!DOCTYPE html>

<html xml:lang="en" lang="en"


xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Put a Title Here</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>

</body>
</html>

Finally, add an HTML comment to tell who wrote the file. You put comments in a document for the
benefit of other humans who will be reading it. The browser ignores it completely. Your comments
(and they can be more than one line long) go between the opening <!-- and the closing -->. This is a
comment, it’s not a tag, so it has its own rules.

<!DOCTYPE html>

<!-- Written by E.G. Valley, 4 Sep 2010 -->

<html xml:lang="en" lang="en"


xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Put a Title Here</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
</body>
</html>

To prepare notes the following questions

Important Question
1. Cryptography
2. Network Security

You might also like