5 th unit cn
5 th unit cn
Networks
Domain Name
System (DNS)
Content
s
Need for DNS
Name Spaces
FQDN and PQDN
name-address
resolution
NEED FOR DNS
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, we need a
system that can map a name to an address
or an address to a name.
Purpose of DNS
U ser
1
Host
name
Host
name
2
5
IP address
6 Query
3
IP address
Response 4
Tr a n s p o r t l a ye r
NAME SPACE
To be unambiguous, the names assigned to machines
must be carefully selected from a name space with
complete control over the binding between the
names and IP addresses. In other words, the names
must be unique because the addresses are unique.
A name space that maps each address to a unique
name can be organized in two ways:
Flat OR Hierarchical.
Flat name spaces do not scale well because they can grow only so
large before all available names are used up. Once a name is used more
than once in a name space, the name space violates the unambiguously
resolvable requirement.
A hierarchical name space is divided into different
areas, which can be thought of as subname spaces. Each
area is its own subname space within the overall name
space. Therefore, each object must have a unique name
only within its subname space in order to have an
unambiguously resolvable name within the name space
hierarchy. Hierarchical name spaces, then, can scale to
extremely large networks — as you add more objects to
the overall
name space, you have to find unique
names for them within only the subname
space to which they belong.
Domain name space
The Domain Name System is a hierarchical and distributed naming system for
computers, services, and other resources in the Internet or other Internet
Protocol networks. It associates various information with domain names
assigned to each of the associated entities.
Domain names and labels
FQDN and PQDN
The format of country domain is same as a generic domain, but it uses two-
character country abbreviations (e.g., us for the United States) in place of
three-character organizational abbreviations.
Inverse domain
The inverse domain is used
for mapping an address to a
name. When the server has
received a request from the
client, and the server
contains the files of only
authorized clients. To
determine whether the client
is on the authorized list or
not, it sends a query to the
DNS server and ask for
mapping an address to the
name.
14
RESOLUTION
Mappinga name to an address or an address
to a name is called name-address resolution.
2 5
9
6
10
Iterative resolution 5
3
4
1
2
7
8
10
Referenc
es
❑
❑
Behrouz Forouzan, “Data Communication and Networking”, McGraw Hill
Andrew Tanenbaum “Computer Networks”, Prentice Hall.
❑ William Stallings, “Data and Computer Communication”, Pearson.
❑ Kurose and Ross, “Computer Networking- ATop-Down Approach”, Pearson.
❑ Peterson and Davie, “Computer Networks: A Systems Approach”, Morgan Kaufmann
❑ W. A. Shay, “Understanding Communications and Networks”, Cengage Learning.
❑ D. Comer, “Computer Networks and Internets”, Pearson.
❑ Behrouz Forouzan, “TCP/IP Protocol Suite”, McGraw Hill.
Than
k
Compute
Networks
WWW and HTTP
Content
s
Architecture of WWW
Web documents
Hypertext Transfer
Protocol
Persistent vs
Nonpersistent
ARCHITECTUR
E
The WWW today is a distributed client/server service,
in which a client using a browser can access a service
using a server. However, the service provided is
distributed over many locations called sites.
27.25
Architecture of
WWW
27.26
Browse
r
27.27
UR
L
http:// 80 by default
https://
ftp://
27.28
Cooki
es
•The WWW was originally designed as a stateless entity.
•Cookies are needed for extending functionalities of the Web,
such as:
•To remember past client in order to show a customized
webpage.
27.29
Cookies: Creation and
storage
•When a server receives a request from a client, it stores
information about the client in a file or a string.
•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.
27.30
WEB
DOCUMENTS
The documents in the WWW can be grouped into three
broad categories: static, dynamic, and active. The
category is based on the time at which the contents of
the document are determined.
27.31
Static
document
27.32
Dynamic document
using CGI
27.33
Dynamic document using server-
site script
Dynamic website content is made possible by using scripting
languages. A scripting language is a type of computer programming
that allows a developer to create a series of tasks that are completed
as a computer interprets the code. When dealing with website, there
are two fundamental types of scripting languages — server side and
client side.
27.34
Note
Dynamic documents are sometimes referred to as server-site dynamic documents.
27.35
Active document using Java
Anapplet
applet is an embedded
application, like Flash or Java (not to
be confused with JavaScript). To
execute an applet, you most likely
need a browser plugin. Because the
applet is executed by the plugin and
your browser, it is active and not
dynamic
27.36
Active document using client-
site script
An active web page is a page where
the browser performs the logic
instead of the server. So for example
when you've got a page where you're
showing share prices, then you want
it to update e.g. every 5 seconds. A
solution would be to use AJAX with
JavaScript. I
27.37
Note
Active documents are sometimes referred to as client-site dynamic documents.
27.38
HTT
P
The Hypertext Transfer Protocol (HTTP) is a
protocol used mainly to access data on the World Wide
Web.
27.39
HTTP
transaction
27.40
Request and response messages (all in
Plain Text)
27.41
Note
HTTP version 1.1 specifies a persistent connection by default.
27.42
Persistent vs
Nonpersistent
Connection
• In a nonpersistent connection, one TCP connection is made for each
request/response.
• In a persistent connection, 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.
27.43
Referenc
es
❑
❑
Behrouz Forouzan, “Data Communication and Networking”, McGraw Hill
Andrew Tanenbaum “Computer Networks”, Prentice Hall.
❑ William Stallings, “Data and Computer Communication”, Pearson.
❑ Kurose and Ross, “Computer Networking- ATop-Down Approach”, Pearson.
❑ Peterson and Davie, “Computer Networks: A Systems Approach”, Morgan Kaufmann
❑ W. A. Shay, “Understanding Communications and Networks”, Cengage Learning.
❑ D. Comer, “Computer Networks and Internets”, Pearson.
❑ Behrouz Forouzan, “TCP/IP Protocol Suite”, McGraw Hill.
Than
k
Electronic Mail
Contents
Email
Email Scenario
SMTP
POP3
IMAP
Electronic Mail (EMAIL)
One of the most popular Internet services is electronic mail (e-mail).
The general architecture of an e-mail system including the three main
components:
User agent (UA)
Message transfer agent (MTA)
Message access agent (MAA)
To explain the architecture of e-mail, four scenarios will be discussed from simple
to complex level.
Electronic Mail (EMAIL) Architecture: First Scenario
System
Two user agents are used while the sender and the receiver
of an e-mail are on the same system.
Electronic Mail (EMAIL) Architecture Second Scenario
MTA Internet
MTA
Client Server
System’ System’
(mail Server) (mail Server)
When the sender and the receiver of an e-mail are on
different systems, we need two UAs and a pair of
(Message transfer agent )MTAs (client and server).
Electronic Mail (EMAIL) Architecture Third Scenario
MTA
UA Sender Client
MTA
Server UA: User Agent
Receiver
LAN
or
WAN
MTA Internet
MTA
Client Server
The sender is
connected to the System
mail server via a
System
LAN or a WAN. (mail Server) (mail Server)
Electronic Mail (EMAIL) Architecture Fourth Scenario
Receiver
MAA UA
UA: User Agent MTA Client
Client
Sender MAA
MTA
Server Server
LAN
or LAN
WAN or
WAN
Responses
Responses are sent from the server to the client. A response is a three
digit code that may be followed by additional textual information
Mail Transfer Phases
The process of transferring a mail message occurs in three phases:
connection establishment, mail transfer, and connection termination.
Message Access Agent: POP and IMAP
The first and the second stages of mail delivery use SMTP.
However, SMTP is not involved in the third stage because SMTP
is a push protocol; it pushes the message from the client to the
server. In other words, the direction of the bulk data (messages) is
from the client to the server.
On the other hand, the third stage needs a pull protocol; the
client must pull messages from the server. The direction of the
bulk data is from the server to the client.
The third stage uses a message access agent.
Currently two message access protocols are available: Post
Office Protocol, version 3 (POP3) and Internet Mail Access
Protocol, version 4 (IMAP4).
POP3
Post Office Protocol, version 3 (POP3) is simple and limited in
functionality.
The client POP3 software is installed on the recipient computer;
the server POP3 software is installed on the mail server.
Mail access starts with the client when the user needs to download
e-mail from the mailbox on the mail server.
The client opens a connection to the server on TCP port 110.
It then sends its user name and password to access the mailbox.
The user can then list and retrieve the mail messages, one by one.
POP3 has two modes: the delete mode and the keep mode
POP3
In the delete mode, the mail is deleted from the mailbox after each
retrieval.
In the keep mode, the mail remains in the mailbox after retrieval.
The delete mode is normally used when the user is working at her
permanent computer and can save and organize the received
mail after reading or replying.
The keep mode is normally used when the user accesses her mail
away from her primary computer (e.g., a laptop).
The mail is read but kept in the system for later retrieval and
organizing.
IMAP4
FTP uses two well-known TCP ports: Port 21 is used for the
control connection, and port 20 is used for the data connection.
Figure shows the basic model of FTP.
The client has three components: user interface, client control
process, and the client data transfer process
The server has two components: the server control process and
the server data transfer process.
The control connection is made between the control processes.
The data connection is made between the data transfer processes.
FTP Process
FTP
The control connection remains connected during the entire
interactive FTP session.
The data connection is opened and then closed for each file
transferred.
It opens each time commands that involve transferring files are used,
and it closes when the file is transferred.
In other words, when a user starts an FTP session, the control
connection opens.
While the control connection is open, the data connection can be
opened and closed multiple times if several files are transferred.
FTP: Communication over Control Connection
FTP uses the same approach as SMTP to communicate across the control
connection.
It uses the 7-bit ASCII character set. Communication is achieved through
commands and responses. This simple method is adequate for the control
connection because we send one command (or response) at a time.
FTP: Communication over Data Connection
File transfer occurs over the data connection under the control of the
commands sent over the control connection.
File transfer in FTP means one of three things:
1. A file is to be copied from the server to the client. This is called retrieving
a file. It is done under the supervision of the RETR command.
2. A file is to be copied from the client to the server. This is called storing a
file. It is done under the supervision of the STOR command.
3. A list of directory or file names is to be sent from the server to the
client. This is done under the supervision of the LIST command. Note
that FTP treats a list of directory or file names as a file. It is sent over the
data connection.
FTP: Communication over Data Connection
The client must define the type of file to be transferred, the structure of
the data, and the transmission mode.
Before sending the file through the data connection, we prepare for
transmission through the control connection.
The heterogeneity problem is resolved by defining three attributes of
communication: file type, data structure, and transmission mode.
FTP: Communication over Data Connection
File Type FTP can transfer one of the following file types across the data
connection: an ASCII file, EBCDIC file, or image file. Data Structure FTP can
transfer a file across the data connection by using one of the following
interpretations about the structure of the data: file structure, record
structure, and page structure.
Transmission Mode: FTP can transfer a file across the data connection by
using one of the following three transmission modes:
1. The stream mode is the default mode. Data are delivered from FTP to
TCP as a continuous stream of bytes. TCP is responsible for chopping data
into segments of appropriate size. If the data are simply a stream of bytes
(file structure), no end-of-file is needed. End-of-file in this case is the
closing of the data connection by the sender. If the data are divided into
records (record structure), each record will have a 1-byte end of- record
(EOR) character and the end of the file will have a 1-byte end-of-file (EOF)
character.
FTP: Communication over Data Connection
2. In block mode, data can be delivered from FTP to TCP in blocks. In
this case, each block is preceded by a 3-byte header. The first byte
is called the block descriptor; the next 2 bytes define the size of the
block in bytes.
3. In the compressed mode, if the file is big, the data can be
compressed. The compression method normally used is run-
length encoding. In this method, consecutive appearances of a
data unit are replaced by one occurrence and the number of
repetitions. In a text file, this is usually spaces (blanks). In a binary
file, null characters are usually compressed.
References
Behrouz A Forouzan, “Data Communication and Networking”
Chapter 28
Network Management:
SNMP
28.90
Network management
Monitoring
Testing
Configuring
Troubleshooting, of network
components.
28.91
28-1 NETWORK MANAGEMENT SYSTEM
28.92
Figure 28.1 Functions of a network management system
detecting,
isolating,
correcting,
recording
faults
28.93
28-2 SIMPLE NETWORK MANAGEMENT
PROTOCOL (SNMP)
28.94
Figure 28.2 SNMP concept
28.95
Figure 28.3 Components of network management on the Internet
28.96
Note
SNMP defines the format of packets exchanged
between a manager and
an agent. It reads and changes the status (values)
of objects (variables)
in SNMP packets.
28.97
Note
SMI defines the general rules for naming objects,
defining object types (including
range and length), and showing how to encode
objects and values. SMI does not define the
number of objects an entity should manage or
name the objects to be managed or define the
association between the objects and their values.
28.98
Note
28.99
Note
28.101
SMI
Structure of
Management
Information
28.102
Figure 28.5 Object attributes of SMI
28.103
Figure 28.6 Object identifier: Name
28.104
Note
All objects managed by SNMP are given an object
identifier.
28.105
Figure 28.7 Data type of SMI
28.106
Table 28.1 Simple Data types
28.107
Figure 28.8 Conceptual data types
SMI defines two structured data types: sequence and
sequence of Sequence
28.108
Figure 28.9 Encoding format in SMI
universal (00),
simple (0)
applicationwide
or
(01),
structured
context-specific
(1)
(10), private (11)
28.109
Table 28.2 Codes for data types
28.110
Figure 28.10 Length format
28.111
Example 28.1
28.112
Example 28.2
28.113
Example 28.3
28.114
Example 28.4
28.115
Management Information
Base(MIB)
28.116
Figure 28.15 mib-2
28.117
sys This object (system) defines general information about
the node (system),
such as the name, location, and lifetime.
if This object (interface) defines information about all the
interfaces of the node including interface number, physical
address, and IP address.
at This object (address translation) defines the information
about the ARP table.
ip This object defines information related to IP, such as the
routing table and then IP address.
icmp This object defines information related to ICMP, such
as the number of packets sent and received, and total
errors created.
tcp This object defines general information related to TCP,
such as the connection table, time-out value, number of
ports, and number of packets sent and received.
udp This object defines general information related to UDP,
such as the number of ports and number of packets sent
and received.
snmp This object defines general information related to
SNMP
SNMP uses both SMI and MIB in Internet
network management. It is an application
program that allows
1. A manager to retrieve the value of an
object defined in an agent
2. A manager to store a value in an object
defined in an agent
3. An agent to send an alarm message
about an abnormal situation to the
manager
28.119
Figure 28.20 SNMP PDUs
28.120
• Get Request—A request to retrieve the value of a
variable or list of variables.
• Set Request—Sent by the SNMP manager to the
agent to issue configurations or commands.
• GetNext Request—Sent by the SNMP manager to
agent to find the values of the next record in the
MIB's hierarchy.
• GetBulk Request—Sent by the SNMP manager to
the agent to obtain large tables of data by
performing multiple GetNext Request commands.
• SNMP Response—Sent by the agent to the SNMP
manager, issued in reply to a request.
• SNMP Trap—Asynchronous trap messages from
SNMP agents alert an SNMP manager that a
significant event such as an error or failure, has
occurred.
• SNMP Inform—Confirms receipt of a trap.
Figure 28.21 SNMP PDU format
28.122
Table 28.4 Codes for SNMP messages
28.123
Table 28.3 Types of errors
28.124
Thank You
28.125
Figure 28.22 SNMP message
28.126
Figure 28.25 Port numbers for SNMP
28.127
Computer
Networks
Data Compression
Content
s
Why Data Compression?
Compression
Quantized values are read from the table and redundant 0s
are removed.
To cluster the 0s together, the table is read diagonally in an
zigzag fashion. The reason is if the table doesn’t have fine
changes, the bottom right corner of the table is all 0s.
JPEG usually uses lossless run-length encoding at the
compression phase.
MPEG
•Encoding
Spatial Compression
Each frame is spatially compressed by JPEG.
•Temporal Compression
Redundant frames are removed.
For example, in a static scene in which someone is talking, most
frames are the same except for the segment around the speaker’s
lips, which changes from one frame to the next.
Referenc
es
❑
❑
Behrouz Forouzan, “Data Communication and Networking”, McGraw Hill
Andrew Tanenbaum “Computer Networks”, Prentice Hall.
❑ William Stallings, “Data and Computer Communication”, Pearson.
❑ Kurose and Ross, “Computer Networking- ATop-Down Approach”, Pearson.
❑ Peterson and Davie, “Computer Networks: A Systems Approach”, Morgan Kaufmann
❑ W. A. Shay, “Understanding Communications and Networks”, Cengage Learning.
❑ D. Comer, “Computer Networks and Internets”, Pearson.
❑ Behrouz Forouzan, “TCP/IP Protocol Suite”, McGraw Hill.
Thank
You
Compute
Networks
Cryptography
Content
s
What is cryptography
Categories of
cryptography
Keys used in
cryptography
Traditional ciphers
What is Cryptography ?
30.3
Cryptography components
30.
144
Categories of cryptography
30.
145
Symmetric-key cryptography
30.
146
Note
In symmetric-key cryptography, the same key is used by the sender
(for encryption)
and the receiver (for decryption).
The key is shared.
30.
147
Asymmetric-key cryptography
30.
148
Comparison between two categories of cryptography
30.
149
Keys used in cryptography
30.
150
SYMMETRIC-KEY CRYPTOGRAPHY
30.
151
Traditional ciphers
30.
152
Note
30.
153
Note
The shift cipher is sometimes referred to as the Caesar cipher.
30.
154
Note
30.
155
Transposition cipher
30.
156
Information Security
We need information to share/express our ideas
Some Information are valuable. Hence we need Protection
One of Protection method is “Data Encryption“
Encryption : Transform usable information into a form
that renders it unusable by anyone other than an authorized
user Decryption : Information that has been encrypted
(rendered
unusable) can be transformed back into its original usable
form by an authorized user, who possesses the cryptographic
key
157
Cryptographic key : Specifies the particular transformation
of plaintext into ciphertext, or vice versa
Information Security
Contd.
Encryption
Key
Algorithm
Decryption
Cipher Text
158
Plain Text
Public Key Cryptoystems
Encryption procedure - E
Decryption procedure -
D Message - M
Cipher text - C
Parameters of E kept public
Parameters of D kept private
159
Examples
Public Key Cryptosystems
Contd.Deciphering the enciphered form of a message M yields M.
D(E(M)) = M
Both E and D are easy to compute
By publicly revealing E, the user does not reveal an easy
way to compute D (One-Way Functions)
If a message M is first deciphered and then enciphered, M is
the result
E(D(M)) = M
RSA
160 is an algorithm for public-key cryptography
Basic Concepts of RSA
RSA do – Encryption/Decryption/Key Generation
162
Digital Signatures
Proof for verifying the sender (Authentication)
Proof that message is not modified by someone
other than the sender (Integrity)
Preserve non-repudiation (Sender cannot
deny sending it)
Signature needs to be,
– Message-dependant
– Signer-dependant
163
Digital Signatures Contd.
• How to do it in RSA
– Alice sends a signed message to Bob
• Why we need to HASH the message ?
– Example :
• I have uploaded the “presentation-slides.pdf”
on Moodle
• Verify your SHA512sum Digest Code with Original
164
value posted at MyLinkedInProfile/Projects
Digital Signatures
Contd.
Sometimes you don't particularly mind letting the whole world read a
message (or would rather they did) yet want to provide a
mechanism to prove that you wrote the message. Signing does just
this.
If you want to hide the contents of the message, then you take the
message and the signature, zip them together and encrypt the
whole thing with the public key of the receiver before you
send.
Encryption Flow
166
RSA Algorithm
Notations
– n is known as the modulus
– p & q two large random primes
– e is known as the public exponent
or encryption exponent
– d is known as the secret exponent
or decryption exponent
167 Mathematics Related to RSA – Eular’s,Fermat’s
and Chinese Remainder Theorems
RSA Algorithm
Contd.
1. Choose two random large prime numbers, p and q
2. Compute the product n = p x q
3. Randomly choose the encryption key, e, such that e
and (p - 1)(q - 1) are relatively prime
4. Use the extended Euclidean algorithm to compute
the
decryption key, d, such that
e*d ≡ 1 mod (p - 1)(q - 1)
168
ie
d = e-1 mod ((p - 1)(q - 1))
* d and n are also relatively
prime
RSA Algorithm Contd.
Keys
– e and n are the public key
Important :
The two primes, p and q, are no longer needed
169
They should be discarded, but never revealed
RSA Algorithm Contd.
Encryption
1. Divide message into numerical blocks smaller than
n (with binary data, choose the largest power of 2
less than n)
2. For each block
• c = me mod n
Decryption
170 3. For each cipher text block
m = cd mod n
RSA Algorithm Contd.
RSA Example
1. Select primes: p=17 & q=11
2. Compute n = pq =17×11=187 ; n=187
3. Compute ø(n)=(p–1)(q-1)=16×10=160
4. Select e ; gcd(e,160)=1; choose e=7
5. Determine d: d*e=1 mod 160 and d < 160
Hence, Value is d=23 since 23×7=161= 10×160+1
6. Publish public key Kpub={7,187} (e,n)
171
7. Keep secret private key Kpvt={23,17,11} (p,q,d)
RSA Algorithm
Contd.
message „ M ‟ = 88 (88<187)
Encryption: [c = me mod n]
• C = 887 mod 187 = 11
C = 11
Decryption: [m = cd mod n]
• M = 1123 mod 187 = 88
M = 88
172
Referenc
es
❑
❑
Behrouz Forouzan, “Data Communication and Networking”, McGraw Hill
Andrew Tanenbaum “Computer Networks”, Prentice Hall.
❑ William Stallings, “Data and Computer Communication”, Pearson.
❑ Kurose and Ross, “Computer Networking- ATop-Down Approach”, Pearson.
❑ Peterson and Davie, “Computer Networks: A Systems Approach”, Morgan Kaufmann
❑ W. A. Shay, “Understanding Communications and Networks”, Cengage Learning.
❑ D. Comer, “Computer Networks and Internets”, Pearson.
❑ Behrouz Forouzan, “TCP/IP Protocol Suite”, McGraw Hill.
Than
k