CN Unit 5
CN Unit 5
Unit-V
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.
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
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 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
Used to link web pages on different websites Used to link web pages within the same website.
Changes when the server name or directory name Remains same even of we change the server name or directory
changes name.
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:
Edu Education
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
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.
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>
<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>
Important Question
1. Cryptography
2. Network Security