0% found this document useful (0 votes)
2 views360 pages

DataCom Tutorial (2)

The document provides an overview of data communications, detailing its components, modes of data flow, types of signals, and transmission media. It discusses guided and unguided media, including various types of cables and wireless communication methods, as well as networking devices like modems, hubs, switches, and routers. Additionally, it addresses transmission impairments and encoding techniques essential for effective data transmission.

Uploaded by

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

DataCom Tutorial (2)

The document provides an overview of data communications, detailing its components, modes of data flow, types of signals, and transmission media. It discusses guided and unguided media, including various types of cables and wireless communication methods, as well as networking devices like modems, hubs, switches, and routers. Additionally, it addresses transmission impairments and encoding techniques essential for effective data transmission.

Uploaded by

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

DATA COMMUNICATIONS

&
COMPUTER NETWORKING
CONTENTS
2

 Introduction to data communication.


 Components of data communication
 Data flow:- Simplex, Half duplex, Full deplex
 Signals:- Analog and Digital signals.
 Transmission media:- Guided and Unguided media
 Networking devices

Prepared By Tsegaye A. 12/22/2024


What is Data Communications?
3

Exchange of data between two devices via some forms


of transmission medium(such as wire cable) is Data
Communications.
For data communications to occur, the communicating
devices must be part of a communication system
made of a combination of hardware and software.
The effectiveness of a data communication system
depends on four fundamental characteristics:-
delivery, accuracy, timeliness and jitter.

Prepared By Tsegaye A. 12/22/2024


Components of Data Communication:
4

1.Sender 2.Receiver 3.Message 4.Tramsmission Medium


5. Protocol

Prepared By Tsegaye A. 12/22/2024


The five components of data communication are:
5

1. Message - It is the information to be communicated. Popular


forms of information include text, pictures, audio, video etc.
2. Sender - It is the device which sends the data messages. It can
be a computer, workstation, telephone handset etc.
3. Receiver - It is the device which receives the data messages. It
can be a computer, workstation, telephone handset etc.
4. Transmission Medium - It is the physical path by which a
message travels from sender to receiver. Some examples
include twisted-pair wire, coaxial cable, radio waves etc.
5. Protocol - It is a set of rules that governs the data
communications. It represents an agreement between the
communicating devices. Without a protocol, two devices may
be connected but not communicating.
Prepared By Tsegaye A. 12/22/2024
Data Flow
6

Prepared By Tsegaye A. 12/22/2024


Data Flow
7

Prepared By Tsegaye A. 12/22/2024


Mode of transmission / Data flow can occur in
three ways:
8

1.Simplex:In simplex mode, the communication is


unidirectional. only one of the devices on a link can
transmit, the other can only receive. e.g. keyboards,
monitors, etc.
2.Half-duplex:In this mode, each station can both transmit
and receive, but not at the same time. When one device is
sending, the other can only receive, and vice-versa. e.g.
walkie-talkies, CB(citizens band) etc.

Prepared By Tsegaye A. 12/22/2024


Cont’d
9

3.Full Duplex : In full duplex mode, both stations can


transmit and receive simultaneously.
One common example of full duplex is the Telephone
network.
When two people are communicating by a telephone
line, both can talk and listen at the same time.
The full-duplex mode is used when communication in
both directions is required all the time.

Prepared By Tsegaye A. 12/22/2024


Signals
10

 There are two types of signals to transfer data.

Signals

Analog signal Digital signal

Prepared By Tsegaye A. 12/22/2024


Analog Signals
11
An analog signal are continuous and passes through or
includes an infinite number of continuous values along its
path.
The curve representing the analog signal passes through an
infinite number of points.

Prepared By Tsegaye A. 12/22/2024


Digital Signals:
12

A digital signal can have only a limited number of


defined values. Although each value can be any
number, it is as simple as 1 and 0.

Prepared By Tsegaye A. 12/22/2024


Transmission Media
13

The means through which data is transformed from one place to another is called
transmission or communication media.
There are two categories of transmission media used in computer
communications.
Electromagnetic radiation can be transmitted through an optical media, such
as optical fiber, or through twisted pair wires, coaxial cable, or dielectric-
slab waveguides.
It may also pass through any physical material that is transparent to the specific
wavelength, such as water, air, glass, or concrete.
Sound is, by definition, the vibration of matter, so it requires a physical medium
for transmission, as does other kinds of mechanical waves and heat energy.

Prepared By Tsegaye A. 12/22/2024


Types of Transmission Media
14

Transmission Media

Guided Media Unguided Media

Prepared By Tsegaye A. 12/22/2024


Guided Media
15

 Guided media are the physical links through which signals are
confined to narrow path.
 These are also called guide media. Bounded media are made up of a
external conductor (Usually Copper) bounded by jacket material.
 Bounded media are great for LABS because they offer high speed,
good security and low cast.
 However, some time they cannot be used due distance
communication.
 Three common types of bounded media are used of the data
transmission. These are
 Coaxial Cable
 Twisted Pairs Cable
 Fiber Optics Cable
Prepared By Tsegaye A. 12/22/2024
Coaxial cable
16

 Coaxial cable is very common & widely used commutation media. For
example TV wire is usually coaxial. Coaxial cable gets its name
because it contains two conductors that are parallel to each other. The
center conductor in the cable is usually copper. The copper can be either
a solid wire or stranded martial.
 Outside this central Conductor is a non-conductive material. It is
usually white, plastic material used to separate the inner Conductor
form the outer Conductor. The other Conductor is a fine mesh made
from Copper.

Prepared By Tsegaye A. 12/22/2024


Fiber optic cable
17

 Fiber optic cable uses electrical signals to


transmit data. It uses light. In fiber optic cable
light only moves in one direction for two way
communication to take place a second
connection must be made between the two
devices. It is actually two stands of cable. Each
stand is responsible for one direction of
communication. A laser at one device sends
pulse of light through this cable to other device.
These pulses translated into “1’s” and “0’s” at
the other end.
 In the center of fiber cable is a glass stand or
core. The light from the laser moves through this
glass to the other device around the internal core
is a reflective material known as CLADDING.
No light escapes the glass core because of this
reflective cladding.

Prepared By Tsegaye A. 12/22/2024


Fiber optic cable
18

Prepared By Tsegaye A. 12/22/2024


Twisted Pair Cable
19

 The most popular network cabling is Twisted pair. It is light weight,


easy to install, inexpensive and support many different types of
network. It also supports the speed of 100 mps.
 Twisted pair cabling is made of pairs of solid or stranded copper
twisted along each other.
 The twists are done to reduce vulnerably to EMI and cross talk. The
number of pairs in the cable depends on the type. The copper core is
usually 22-AWG or 24-AWG, as measured on the American wire
gauge standard. There are two types of twisted pairs cabling
 1. Unshielded twisted pair (UTP)
 2. Shielded twisted pair (STP)
Prepared By Tsegaye A. 12/22/2024
Unshielded twisted pair (UTP)
20

UTP is more common. It can be


either voice grade or data
grade depending on the
condition.
UTP cable normally has an
impedance of 100 ohm.
UTP cost less than STP and
easily available due to its
many use.
There are five levels of data
cabling
.
Prepared By Tsegaye A. 12/22/2024
Unshielded twisted pair (UTP)
21

Prepared By Tsegaye A. 12/22/2024


Shielded twisted pair (STP)
22

 It is similar to UTP
but has a mesh
shielding that’s
protects it from EMI
which allows for
higher transmission
rate.

Prepared By Tsegaye A. 12/22/2024


Shielded twisted pair (STP)
23

Prepared By Tsegaye A. 12/22/2024


Unguided Media
24

Unguided media or wireless media doesn't use any


physical connectors between the two devices
communicating.
Usually the transmission is send through the atmosphere
but sometime it can be just across the rule.
Wireless media is used when a physical obstruction or
distance blocks are used with normal cable media.
The three types of wireless media are:
 Radio waves

 Micro waves
Prepared By Tsegaye A. 12/22/2024
 Infrared waves
Devices used in networking
25

Mainly four devices are used in networking:-


 Modem

 Hub

 Switch

 Router

Prepared By Tsegaye A. 12/22/2024


MODEM-(modulator-demodulator)
26

Prepared By Tsegaye A. 12/22/2024


Modem
27

A modem is a device that modulates an analog carrier


signal to encode digital information and also demodulates
such a carrier signal to decode the transmitted
information.
The goal is to produce a signal that can be transmitted
easily and decoded to reproduce the original digital data.
Modems can be used over any means of transmitting analog
signals, from light emitting diodes to radio.
There are two types of modem:-
1. Internal modem
Prepared By Tsegaye A. 12/22/2024
2. External modem
HUB
28

A common connection
point for devices in
a network.
A hub contains
multiple ports. When a
packet arrives at one
port, it is copied to the
other ports so that all
segments of the LAN
can see all packets.
Prepared By Tsegaye A. 12/22/2024
Switch
29
A network switch is a small hardware
device that joins multiple computers
together within one local area network
(LAN). Network switches appear nearly
identical to network hubs, but a switch
generally contains more intelligence than a
hub. Unlike hubs, network switches are
capable of inspecting data packets as they
are received, determining the source and
destination device of each packet, and
forwarding them appropriately.
By delivering messages only to the connected
device intended, a network switch
conserves network bandwidth and offers
generally better performance than a hub.
Prepared By Tsegaye A. 12/22/2024
Router
30
A router is a device that forwards data
packets between computer networks, creating an
overlay internetwork.

A router is connected to two or more data lines from different


networks. When a data packet comes in on one of the lines,
the router reads the address information in the packet to
determine its ultimate destination.

Then, using information in its routing table it directs the packet


to the next network on its journey.
Prepared By Tsegaye A. 12/22/2024
Router
31

Prepared By Tsegaye A. 12/22/2024


TRANSMISSION IMPAIRMENT
32

 Signals travel through transmission media, which are not


perfect.
 The imperfection causes signal impairment.
 This means that the signal at the beginning of the medium
is not the same as the signal at the end of the medium.
What is sent is not what is received.
 Three causes of impairment are attenuation, distortion,
and noise. Prepared By Tsegaye A. 12/22/2024
Attenuation
33

 Attenuation means a loss of energy. When a signal, simple


or composite, travels through a medium, it loses some of its
energy in overcoming the resistance of the medium.
That is why a wire carrying electric signals gets warm, if not
hot, after a while.
Some of the electrical energy in the signal is converted to
heat.
To compensate for this loss, amplifiers are used to amplify the
signal.

Prepared By Tsegaye A. 12/22/2024


Distortion
34

 Distortion means that the signal changes its form or shape.


 Distortion can occur in a composite signal made of
different frequencies. Each signal component has its own
propagation speed through a medium and, therefore, its
own delay in arriving at the final destination.
 Differences in delay may create a difference in phase if
the delay is not exactly the same as the period duration. In
other words, signal components at the receiver have
phases different from what they had at the sender.
 The shape of the composite signal is therefore not the
same. Prepared By Tsegaye A. 12/22/2024
Noise
35
 Noise is another cause of impairment.
 Several types of noise, such as thermal noise, induced noise, crosstalk,
and impulse noise, may corrupt the signal.
 Thermal noise is the random motion of electrons in a wire, which
creates an extra signal not originally sent by the transmitter.
 Induced noise comes from sources such as motors and appliances.
These devices act as a sending antenna, and the transmission medium
acts as the receiving antenna. Crosstalk is the effect of one wire on
the other.
 One wire acts as a sending antenna and the other as the receiving
antenna.
 Impulse noise is a spike (a signal with high energy in a very short time)
that comes from power lines, lightning, and so on.
Prepared By Tsegaye A. 12/22/2024
Encoding Techniques
36

❖ Digital data, digital signal


❖ Analog data, digital signal
❖ Digital data, analog signal
❖ Analog data, analog signal

Prepared By Tsegaye A. 12/22/2024


Terms
37

 Digital signaling
 Data source (digital/analog) encoded into digital signal
 Analog signaling
 Data source (digital/analog) encoded into constant-
frequency signal (carrier signal)
 Modulation
 Process of encoding source data onto a carrier signal
with frequency fc
 Modulating signal/ baseband signal
 Input signal (analog/digital) → modulator
 Modulated signal/ bandlimited(bandpass) signal
 Result of modulating the carrier signal
Prepared By Tsegaye A. 12/22/2024
Digital Data, Digital Signal
38

 In general, the equipment for encoding digital data


into a digital signal is less complex and less
expensive than digital-to-analog modulation
equipment.
 Digital signal
 Discrete,discontinuous voltage pulses
 Each pulse is a signal element

 Binary data encoded into signal elements

Prepared By Tsegaye A. 12/22/2024


Types of Digital to Digital Encoding
39

Prepared By Tsegaye A. 12/22/2024


Types of Polar Encoding
40

1. Nonreturn to Zero-Level (NRZ-L)


2. Nonreturn to Zero Inverted (NRZI)
3. Bipolar –AMI -Altenate Mark Inversion
4. Pseudoternary
5. Manchester
6. Differential Manchester
7. B8ZS (Commonly used in North America)
8. HDB3 (Commonly used in Europe and Japan)
Prepared By Tsegaye A. 12/22/2024
Types of Bipolar Encoding
41

PSEUDOTERNARY

Prepared By Tsegaye A. 12/22/2024


Definition of Digital Signal Encoding Format

42

i. Nonreturn to Zero-Level(NRZ-L)
- 0 = high level
- 1 = low level
ii. Nonreturn to Zero Inverted (NRZ-I)
- 0 = no transition at beginning of interval
- 1 = transition at beginning of interval
iii. Bipolar –AMI
- 0 = no signal
- 1 = +ve or –ve, alternating for successive ones
iv. Pseudoternary
- 0 = +ve or –ve level, alternating for successive zeros
- 1 = no line signal
v. Manchester
- 0 = transition from high to low in middle of interval
- 1 = transition from low to high in middle of interval

Prepared By Tsegaye A. 12/22/2024


Terms (1)
43

 Unipolar
 Allsignal elements have same sign
(positive and negative)
 Polar
 One logic state represented by positive voltage the
other by negative voltage
 Data rate
 Rate of data transmission in bits per second
 Duration or length of a bit
 Time taken for transmitter to emit the bit
Prepared By Tsegaye A. 12/22/2024
Terms (2)
44

 Modulation rate
 Rateat which the signal level changes
 Measured in baud = signal elements per second

 Mark and Space


 Binary 1 and Binary 0 respectively

Prepared By Tsegaye A. 12/22/2024


Digital Data, Analog Signal
45

 Some transmission media, such as optical fiber and


unguided media, will only propagate analog
signals.
 Public telephone system
 300Hz to 3400Hz (voice frequency range)
 Use modem (modulator-demodulator)
 Three basic encoding (modulation techniques) for
transforming digital data into analog signals:
 Amplitude shift keying (ASK)
 Frequency shift keying (FSK)
 Phase shift keying (PSK)

Prepared By Tsegaye A. 12/22/2024


Modulation Techniques
46

Prepared By Tsegaye A. 12/22/2024


Amplitude Shift Keying (ASK)
47

 Values represented by different amplitudes of


carrier
 Usually, one amplitude is zero
 i.e. presence and absence of carrier is used
 Susceptible to sudden gain changes
 Inefficient
 Up to 1200bps on voice grade lines
 Used over optical fiber
ASK
Prepared By Tsegaye A. 12/22/2024
Binary Frequency Shift Keying (BFSK)
48

 Most common form is binary FSK (BFSK)


 Two binary values represented by two different
frequencies (near carrier)
 Less susceptible to error than ASK
 Up to 1200bps on voice grade lines
 High frequency-radio (3 – 30 MHz)
 Even higher frequency on LANs using coaxial cable

BFSK
Prepared By Tsegaye A. 12/22/2024
Phase Shift Keying (PSK)
49

 Phase of carrier signal is shifted to represent data


 Binary PSK (Two-level PSK)
 Two phases represent two binary digits
 An alternative form of Two-Level PSK
Differential PSK
 Phase shifted relative to previous transmission rather
than some reference signal

BPSK
Prepared By Tsegaye A. 12/22/2024
Differential PSK
50

0 = signal burst of the same phase as previous signal burst


1 = signal burst of the opposite phase Prepared
as previous signalA.burst
By Tsegaye 12/22/2024
Analog Data, Digital Signal
51

 Analog data, such as voice and video, are often digitized to


be able to use digital transmission facilities.
 Digitization
 Conversion of analog data into digital data
 Digital data can then be transmitted using NRZ-L (coding scheme)
 Digital data can then be transmitted using code other than
NRZ-L
 Digital data can then be converted to analog signal
 Analog to digital conversion done using a codec
 Two principal techniques used in codec:
◼ Pulse code modulation (PCM)
◼ Delta modulation (DM)

Prepared By Tsegaye A. 12/22/2024


Digitizing Analog Data
52

Prepared By Tsegaye A. 12/22/2024


Pulse Code Modulation(PCM) (1)
53

 If a signal is sampled at regular intervals at a rate


higher than twice the highest signal frequency, the
samples contain all the information of the original
signal
 Voice data limited to below 4000Hz
 Require 8000 sample per second
 Analog samples (Pulse Amplitude Modulation, PAM)
 Each sample assigned digital value

Prepared By Tsegaye A. 12/22/2024


Pulse Code Modulation(PCM) (2)
54

4 bit system gives 16 levels


Quantized: Quantizing error or noise
 Approximations mean it is impossible to recover original exactly
8 bit sample gives 256 levels
Quality comparable with analog transmission
8000 samples per second of 8 bits each gives 64kbps
8000 samples per second X 8 bits per sample
= 64 kbps
PAM Value 1.1 9.2 15.2 10.8 5.6 2.8 2.7

Quantized code # 1 9 15 10 5 2 2
PCM code 0001 1001 1111 1010 0101 0010 0010
Prepared By Tsegaye A. 12/22/2024
PAM = pulse amplitude modulation
55 Prepared By Tsegaye A. 12/22/2024
Analog Data, Analog Signals
56

 Analog data are modulated by a carrier frequency


to produce an analog signal in a different
frequency band, which can be utilized on an analog
transmission system.
 Why modulate analog signals?
 Higher frequency can give more efficient transmission
 Permits frequency division multiplexing
 Types of modulation
 Amplitude (AM)
 Frequency (FM)
 Phase (PM)

Prepared By Tsegaye A. 12/22/2024


Analog
Modulation
57

STARTING

Prepared By Tsegaye A. 12/22/2024


Key Point
58

Synchronization
 The receiver must know the rate at which bits are

being received so that it can sample the line at


appropriate intervals to determine the value of
each received bit.

Prepared By Tsegaye A. 12/22/2024


Introduction to Computer
59
Networking
Objective:
To be acquainted with:
 The definitions of networking

 Network topology

 Network peripherals, hardware and

software

Prepared By Tsegaye A. 12/22/2024


Definitions
60

Network Definition
 A network can be defined as two or more
computers connected together in such a way that
they can share resources.

 The purpose of a network is to share resources.

Prepared By Tsegaye A. 12/22/2024


Definitions (cont..)
61

A resource may be:


 A file

 A folder

 A printer

 A disk drive

 Or just about anything else that exists on a

computer.

Prepared By Tsegaye A. 12/22/2024


Definitions (cont..)
62

A network is simply a collection of computers or other


hardware devices that are connected together, either
physically or logically, using special hardware and software, to
allow them to exchange information and cooperate.
Networking is the term that describes the processes involved
in designing, implementing, upgrading, managing and
otherwise working with networks and network technologies.

Prepared By Tsegaye A. 12/22/2024


Advantages of networking
63

 Connectivity and Communication


 Data Sharing
 Hardware Sharing
 Internet Access
 Internet Access Sharing
 Data Security and Management
 Performance Enhancement and Balancing
 Entertainment

Prepared By Tsegaye A. 12/22/2024


The Disadvantages (Costs) of Networking
64

 Network Hardware, Software and Setup Costs


 Hardware and Software Management and
Administration Costs
 Undesirable Sharing
 Illegal or Undesirable Behavior
 Data Security Concerns

Prepared By Tsegaye A. 12/22/2024


Fundamental Network Classifications
65
Local Area Networks (LANs):
 It is a computer network covering a small geographic area, like a home, office, or
group of buildings
Wide Area Networks (WANs):
 It is a computer network that covers a broad area (i.e., any network whose
communications links cross metropolitan, regional, or national boundaries). Or, less
formally, a network that uses routers and public communications links
 The largest and most well-known example of a WAN is the Internet.
Metropolitan Area Network (MAN):
o It is a network that interconnects users with computer resources in a geographic area or region
larger than that covered by even a large local area network (LAN) but smaller than the area
covered by a wide area network (WAN).
o The term is applied to the interconnection of networks in a city into a single larger network
(which may then also offer efficient connection to a wide area network).
o It is also used to mean the interconnection of several local area networks by bridging them
with backbone lines. The latter usage is also sometimes referred to as a campus network.

Prepared By Tsegaye A. 12/22/2024


Fundamental Network Classifications (cont)
66

The Local Network (LAN)


Client Client

Client Client

Client Client

Prepared By Tsegaye A. 12/22/2024


Fundamental Network Classifications (cont)
67

 Wide Area Network

Prepared By Tsegaye A. 12/22/2024


Fundamental Network Classifications (cont)
68

Metropolitan Area Network (MAN)

Prepared By Tsegaye A. 12/22/2024


Intranet and Internet Specifications
69

 Intranet: An intranet is a private network that is contained within an


enterprise. It may consist of many interlinked local area networks
and also use leased lines in the wide area network.
 An intranet uses TCP/IP, HTTP, and other Internet protocols and in
general looks like a private version of the Internet.
 With tunneling, companies can send private messages through the
public network, using the public network with special
encryption/decryption and other security safeguards to connect one
part of their intranet to another.
 Internet: is a worldwide system of computer networks - a network of
networks in which users at any one computer can, if they have
permission, get information from any other computer (and sometimes
talk directly to users at other computers).
Prepared By Tsegaye A. 12/22/2024
Client and Server computer role in
70
networking
 Server computer is a core component of the
network, providing a link to the resources necessary
to perform any task.
 A server computer provides a link to the resources
necessary to perform any task.
 The link it provides could be to a resource existing
on the server itself or a resource on a client
computer.
 Client computers normally request and receive
information over the network client. Client computers
also depends primarily on the central server for
processing activities Prepared By Tsegaye A. 12/22/2024
Peer-to peer network
71

 A peer-to-peer network is a network where the


computers act as both workstations and servers.
 great for small, simple, and inexpensive networks.
 In a strict peer-to-peer networking setup, every
computer is an equal, a peer in the network.
 Each machine can have resources that are shared with
any other machine.
 There is no assigned role for any particular device, and
each of the devices usually runs similar software.
 Any device can and will send requests to any other.
Prepared By Tsegaye A. 12/22/2024
Peer-to peer network (cont..)
72

Prepared By Tsegaye A. 12/22/2024


Client/Server Networking
73

 In this design, a small number of computers


are designated as centralized servers and
given the task of providing services to a
larger number of user machines called clients

Prepared By Tsegaye A. 12/22/2024


Client/Server Networking (cont..)
74

Prepared By Tsegaye A. 12/22/2024


Network topology
75

 A topology is a way of “laying out” the


network. Topologies can be either physical or
logical.
 Physical topologies describe how the cables
are run.
 Logical topologies describe how the network

messages travel

Prepared By Tsegaye A. 12/22/2024


Network topology (cont.)
76

 Bus (can be both logical and physical)


 Star (physical only)

 Ring (can be both logical and physical)

 Mesh (can be both logical and physical)

Prepared By Tsegaye A. 12/22/2024


Network topology (cont.)
77

Bus
 A bus is the simplest physical topology. It consists of a
single cable that runs to every workstation
 This topology uses the least amount of cabling, but also
covers the shortest amount of distance.
 Each computer shares the same data and address path.
With a logical bus topology, messages pass through the
trunk, and each workstation checks to see if the message
is addressed to itself. If the address of the message
matches the workstation’s address, the network adapter
copies the message to the card’s on-board memory.
Prepared By Tsegaye A. 12/22/2024
Network topology (cont.)
78

 it is difficult to add a workstation


 have to completely reroute the cable and possibly
run two additional lengths of it.
 if any one of the cables breaks, the entire network
is disrupted. Therefore, it is very expensive to
maintain.

Prepared By Tsegaye A. 12/22/2024


Network topology (cont.)
79

 Bus topology

Prepared By Tsegaye A. 12/22/2024


Network topology (cont.)
80
Star Topology
 A physical star topology branches each network
device off a central device called a hub, making it
very easy to add a new workstation.
 Also, if any workstation goes down it does not affect
the entire network. (But, as you might expect, if the
central device goes down, the entire network goes
down.)
 Some types of Ethernet and ARCNet use a physical
star topology. Figure 8.7 gives an example of the
organization of the star network.
Prepared By Tsegaye A. 12/22/2024
Network topology (cont.)
81

 Star topologies are easy to install. A cable is


run from each workstation to the hub. The
hub is placed in a central location in the
office.
 Star topologies are more expensive to install
than bus networks, because there are several
more cables that need to be installed, plus
the cost of the hubs that are needed.

Prepared By Tsegaye A. 12/22/2024


Network topology (cont.)
82

 Star Topology

Prepared By Tsegaye A. 12/22/2024


Network topology (cont.)
83

Ring
 Each computer connects to two other computers,
joining them in a circle creating a unidirectional
path where messages move workstation to
workstation.
 Each entity participating in the ring reads a
message, then regenerates it and hands it to its
neighbor on a different network cable.

Prepared By Tsegaye A. 12/22/2024


Network topology (cont.)
84

 The ring makes it difficult to add new


computers.
 Unlike a star topology network, the ring
topology network will go down if one entity is
removed from the ring.
 Physical ring topology systems don’t exist
much anymore, mainly because the hardware
involved was fairly expensive and the fault
tolerance was very low.
Prepared By Tsegaye A. 12/22/2024
Network topology (cont.)
85

 Ring Topology

Prepared By Tsegaye A. 12/22/2024


Network topology (cont.)
86

Mesh
 The mesh topology is the simplest logical topology in terms of data
flow, but it is the most complex in terms of physical design.
 In this physical topology, each device is connected to every other
device
 This topology is rarely found in LANs, mainly because of the
complexity of the cabling.
 If there are x computers, there will be (x × (x–1)) ÷ 2 cables in
the network. For example, if you have five computers in a mesh
network, it will use 5 × (5 – 1) ÷ 2, which equals 10 cables. This
complexity is compounded when you add another workstation.
 For example, your five-computer, 10-cable network will jump to 15
cables just by adding one more computer. Imagine how the person
doing the cabling would feel if you told them you had to cable 50
computers in a mesh network—they’d have to come up with 50 ×
(50 – 1) ÷ 2 = 1225 cables!
Prepared By Tsegaye A. 12/22/2024
Network topology (cont.)
87
 Because of its design, the physical mesh topology is very
expensive to install and maintain.
 Cables must be run from each device to every other device.
The advantage you gain from it is its high fault tolerance.
 With a logical mesh topology, however, there will always be a
way of getting the data from source to destination.
 It may not be able to take the direct route, but it can take an
alternate, indirect route. It is for this reason that the mesh
topology is still found in WANs to connect multiple sites
across WAN links. It uses devices called routers to search
multiple routes through the mesh and determine the best path.
 However, the mesh topology does become inefficient with five
or more entities.
Prepared By Tsegaye A. 12/22/2024
Network topology (cont.)
88

 Mesh Topology

Prepared By Tsegaye A. 12/22/2024


Network topology (cont.)
89
 Advantages and Disadvantages of Network Topologies
Topology Advantages Disadvantages

Bus Cheap. Easy to install. Difficult to reconfigure.


Break in bus disables
entire network.

Star Cheap. Easy to install. More expensive than bus.


Easy to reconfigure.
Fault tolerant.

Ring Efficient. Easy to install. Reconfiguration difficult.


Very expensive.

Mesh Simplest. Most fault tolerant. Reconfiguration extremely difficult.


Extremely expensive.
Very complex.

Prepared By Tsegaye A. 12/22/2024


Hardware, Software and Networks
Peripherals (device)
90

 Network Interface Card (NIC)


 Repeater
 Hub
 Bridge
 Routers
 Switch

Prepared By Tsegaye A. 12/22/2024


Network Interface Card (NIC)
91

 NIC provides the physical interface between computer and cabling.


 It prepares data, sends data, and controls the flow of data.
 It can also receive and translate data into bytes for the CPU to
understand.
 The following factors should be taken into consideration when
choosing a NIC:
1. - Preparing data
2. - Sending and controlling data
3. - Configuration
4. - Drivers
5. - Compatibility
6. - Performance
Prepared By Tsegaye A. 12/22/2024
Preparing Data
92

 In the computer, data moves along buses in parallel, as on


a four-lane interstate highway. But on a network cable,
data travels in a single stream, as on a one lane highway.
This difference can cause problems transmitting and
receiving data, because the paths traveled are not the same.
 It is the NIC’s job to translate the data from the computer
into signals that can flow easily along the cable.
 It does this by translating digital signals into electrical
signals (and in the case of fiber-optic NICs, to optical
signals).

Prepared By Tsegaye A. 12/22/2024


Sending and Controlling Data
93

 For two computers to send and receive data, the cards must agree on
several things. These include the following:
- The maximum size of the data frames
- The amount of data sent before giving
confirmation
- The time needed between transmissions
- The amount of time needed to wait before sending
confirmation
- The amount of data a card can hold
- The speed at which data transmits
 In order to successfully send data on the network, you need to make
sure the network cards are of the same type and they are connected
to the same piece of cable.
Prepared By Tsegaye A. 12/22/2024
Configuration
94

 The NIC’s configuration includes things like a


manufacturer’s hardware address, IRQ address,
Base I/O port address, and base memory address.
Some may also use DMA channels to offer better
performance.
 Each card must have a unique hardware address.

 If two cards have the same hardware addresses,


neither one of them will be able to communicate.

Prepared By Tsegaye A. 12/22/2024


Drivers
95

 For the computer to use the network


interface card, it is very important to install
the proper device drivers.
 These drivers communicate directly with
the network redirector and adapter.
 They operate in the Media Access Control
sublayer of the Data Link layer of the OSI
model.
Prepared By Tsegaye A. 12/22/2024
Compatibility
96

 When choosing a NIC, use one that fits the bus


type of your PC. If you have more than one type
of bus in your PC (for example, a combination
ISA/PCI), use an NIC that fits into the fastest
type (the PCI, in this case).
 This is especially important in servers, as the NIC
can very quickly become a bottleneck if this
guideline isn’t followed.

Prepared By Tsegaye A. 12/22/2024


Performance
97

 The most important goal of the network adapter


card is to optimize network performance and
minimize the amount of time needed to transfer
data packets across the network.
 There are several ways of doing this, including
assigning a DMA channel, use of a shared
memory adapter, and deciding to allow bus
mastering.

Prepared By Tsegaye A. 12/22/2024


Repeaters
98
 Repeaters are very simple devices. They allow a cabling system to
extend beyond its maximum allowed length by amplifying the
network voltages so they travel farther.
 Repeaters are nothing more than amplifiers and, as such, are very
inexpensive.
 Repeaters can only be used to regenerate signals between similar
network segments.
 For example, we can extend an Ethernet 10Base2 network to 400
meters with a repeater. But can’t connect an Ethernet and Token
Ring network together with one.
 The main disadvantage to repeaters is that they just amplify signals.
These signals not only include the network signals, but any noise
on the wire as well.
 Eventually, if you use enough repeaters, you could possibly drown
out the signal with the amplified noise. For this reason, repeaters
are used only as a temporary fix.
Prepared By Tsegaye A. 12/22/2024
Repeaters
99

Prepared By Tsegaye A. 12/22/2024


Hubs
100

 Hubs are devices used to link several computers together.


 They repeat any signal that comes in on one port and
copy it to the other ports (a process that is also called
broadcasting).
 There are two types of hubs: active and passive.
 Passive hubs simply connect all ports together electrically
and are usually not powered.
 Active hubs use electronics to amplify and clean up the
signal before it is broadcast to the other ports.
 In the category of active hubs, there is also a class called
“intelligent” hubs, which are hubs that can be remotely
managed on the network.
Prepared By Tsegaye A. 12/22/2024
Hubs
101

Prepared By Tsegaye A. 12/22/2024


Bridges
102

 They join similar topologies and are used to divide


network segments.
 For example, with 200 people on one Ethernet segment,
the performance will be mediocre, because of the design
of Ethernet and the number of workstations that are
fighting to transmit.
 If it is aware of the destination address, it is able to
forward packets; otherwise a bridge will forward the
packets to all segments.
 They are more intelligent than repeaters but are unable to
move data across multiple networks simultaneously.
 The main disadvantage to bridges is that they can’t
connect dissimilar network types or perform intelligent
path selection. For that function, you would need a router.
Prepared By Tsegaye A. 12/22/2024
Bridges
103

Prepared By Tsegaye A. 12/22/2024


Routers
104

 Routers are highly intelligent devices that connect


multiple network types and determine the best path for
sending data.
 The advantage of using a router over a bridge is that
routers can determine the best path that data can take to
get to its destination.
 Like bridges, they can segment large networks and can
filter out noise.
 Routers are normally used to connect one LAN to
another.
 Typically, when a WAN is set up, there will be at least
two routers used. Prepared By Tsegaye A. 12/22/2024
Routers
105

Prepared By Tsegaye A. 12/22/2024


Switch
106

 A network switch is a computer networking device that connects


network segments.
 Network switches are capable of inspecting data packets as they are
received, determining the source and destination device of that
packet, and forwarding it appropriately.
 A vital difference between a hub and a switch is that all the nodes
connected to a hub share the bandwidth among themselves, while a
device connected to a switch port has the full bandwidth all to
itself.
 For example, if 10 nodes are communicating using a hub on a 10-
Mbps network, then each node may only get a portion of the 10
Mbps if other nodes on the hub want to communicate as well. .
 But with a switch, each node could possibly communicate at the full
10 Mbps. Prepared By Tsegaye A. 12/22/2024
Switch
107

Prepared By Tsegaye A. 12/22/2024


NETWORK PROTOCOLS
And
Network Models
Objectives of Lecture
109

❖ Show how network architecture can be understood using


a layered approach.
❖ Introduce the OSI seven layer reference model.
❖ Introduce the concepts of internetworking and routing.
❖ Understand the difference between network protocols and
services.

Prepared By Tsegaye A. 12/22/2024


CINS/F1-01
Contents
110

Extended example:
❖ how the Internet protocols fetch a web page

❖ The concept of protocol layering

❖ Internetworking and routing

❖ The OSI seven layer model

Prepared By Tsegaye A. 12/22/2024


Protocols
111

 The term protocol refers to a well-known set of rules and


formats to be used in order to perform a task.
 For example, a task of communicating between processes.
 Parts of a protocol:
A specification of a sequence of messages that must be
exchanged.
 A specification of the format of the data in the
messages.
 Existence of well-known (standard) protocols enables the
separate components of the distributed systems to be
developed independently in different languages and on
different platforms. Prepared By Tsegaye A. 12/22/2024
Four elements of a protocol:
112
A set of rules governing the communication between two peer
entities.
It must define the format and the order of messages as well as
actions taken on the transmission and receipt of a message.
◼ syntax: format, what is a valid message?
◼ “GET /~hugue/index.html HTTP/1.1\nHOST:
www.cs.umd.edu\n\n”
◼ Semantics: what does it mean?
◼ Get file /~hugue/index.html using the http 1.1 protocol.
◼ Action:
◼ read file /~hugue/index.html from the disk, send it through the
socket using the http 1.1 protocol and close the socket
◼ Timing: relative order of messages.
◼ Reply follows the request
Prepared By Tsegaye A. 12/22/2024
Internet Protocols
113

Web Browser

Network

Web Server

Prepared By Tsegaye A. 12/22/2024


Four-Layer Model
114

Distributed data communications involves three


primary components:
 Applications

 Computers

 Networks

Four corresponding layers


 Application layer
 Transport layer

 Internet layer

 Network Interface
Prepared By Tsegaye A. 12/22/2024
Basic Internet Network Architecture
115

Host A Host B
Application Layer Application Layer
HTTP Message

Transport Layer Transport Layer


TCP Packet

Router
Internet Layer Internet Layer Internet Layer
IP Datagram IP Datagram

Network Layer Ethernet Network Layer Ethernet Network Layer


Frame Frame

Physical Network Physical Network


Prepared By Tsegaye A. 12/22/2024
Application Layer
116

 How does a web browser retrieve data from a web


server?
 Application Protocol: Hypertext Transfer Protocol
(HTTP).
 Users invoke applications which “speak” using
application protocol.
 Applications interact with a transport protocol to send
or receive data.
 Other applications: FTP, SMTP, DNS, SMB, …
Prepared By Tsegaye A. 12/22/2024
Application Layer Example
117

 HTTP outline:
 GET /~hugue/index.html HTTP/1.1
 Host: www.cs.umd.edu

GET /~hugue/index.html HTTP/1.1


Host: www.cs.umd.edu

HTTP Message

Prepared By Tsegaye A. 12/22/2024


Transport Layer
118

 Provides end-to-end communication between applications.

 Transport Protocol: Transport Control Protocol (TCP)


 a reliable, connection-oriented transport protocol.

 Divides stream of application messages into packets.

 Interacts with Internet Layer to send or receive data.

 In general, a transport protocol may be


 reliable or unreliable,

 connection-oriented or connectionless,

 and flow may or may not be regulated.

 Others: UDP, ICMP.


Prepared By Tsegaye A. 12/22/2024
Transport Layer Example
119

 TCP outline:
 Source Port: 1081
 Destination Port: 80

 Checksum: 0xa858

Src: 1081 Dst: 80 GET /~hugue/index.html HTTP/1.1


Chksum: 0xa858 Host: www.cs.umd.edu
TCP header HTTP Message

Prepared By Tsegaye A. 12/22/2024


Internet Layer
120

 Responsible for routing communications between one


machine and another.
 Accepts requests to send packets to destination address.
 Internet Protocol (IP) encapsulates packets in IP
datagram with IP header and uses routing algorithm to
decide whether to send directly or indirectly.
 Also handles incoming IP datagrams.
 Ifaddressed to local machine, remove the IP datagram
header and pass up to transport layer.

Prepared By Tsegaye A. 12/22/2024


Internet Layer Example
121

 IP outline:
 Time to live: 128
 Header checksum: 0x57d1

 Source: my home pc (69.140.128.222)

 Destination: www.cs.umd.edu (128.8.10.143)

IP datagram header TCP header HTTP Message


Src: 69.140.128.222 Src: 1081 Dst: 80 GET /~hugue/index.html HTTP/1.1
Dst: 128.8.10.143 TTL: 128 Chksum: 0xa858 Host: www.cs.umd.edu

Prepared By Tsegaye A. 12/22/2024


Network Interface Layer
122

 Accepts IP datagrams and transmits over specific


networks.
 Maybe a simple device driver (e.g. an Ethernet
driver) or a complex subsystem with further data
link protocols.

Prepared By Tsegaye A. 12/22/2024


Network Interface Layer Example
123

 Ethernet outline:
 Destination:00:a0:cc:54:1d:4e
 Source: 00:e0:81:10:19:fc

 Type: IP
Ethernet Frame
Src: 00:e0:81:10:19:fc Dst: 00:a0:cc:54:1d:4e Type: IP

Src: 69.140.128.222 Src: 1081 Dst: 80 GET /~hugue/index.html HTTP/1.1


Dst: 128.8.10.143 TTL: 128 Chksum: 0xa858 Host: www.cs.umd.edu

Prepared By Tsegaye A. 12/22/2024


Ports and Addresses
124

 Ports are destination points within a host


computer.
 Processes are attached to the ports, enabling them
to communicate.
 Transport layer addresses are composed of
network address of the host computer and a port
number.
 In the Internet every host is assigned a unique IP
number which is used in routing.
 In an Ethernet each host is responsible for
recognizing that the messages meant for it.
Prepared By Tsegaye A. 12/22/2024
Protocol Layering
125

Host A Host B
Application Layer Application Layer
Message

Transport Layer Transport Layer


Packet

Internet Layer Internet Layer


Datagram

Network Interface Network Interface


Frame

Physical Network
Prepared By Tsegaye A. 12/22/2024
Protocol Layering
126

Web Browser Web Server


Application Layer Application Layer
HTTP Message

Transport Layer Transport Layer


TCP Packet

Internet Layer Internet Layer


IP Datagram

Network Layer Network Layer


Ethernet Frame

Physical Network
Prepared By Tsegaye A. 12/22/2024
Protocol Hierarchies
127

 Protocols are stacked vertically as series of


‘layers’.

 Each layer offers services to layer above, shielding


implementation details.

 Layer n on one machine communicates with layer


n on another machine (they are peer
processes/entities) using Layer n Protocol.
Prepared By Tsegaye A. 12/22/2024
Layers, Protocols & Interfaces
128

Layer n/n+1 Layer n/n+1


interface interface
Layer n protocol
Layer n Layer n
Layer n-1/n Layer n-1/n
interface interface

Layer 2/3 Layer 2/3


interface interface
Layer 2 protocol
Layer 2 Layer 2
Layer 1/2 Layer 1/2
interface interface
Layer 1 protocol
Layer 1 Layer 1

Physical communications medium


Prepared By Tsegaye A. 12/22/2024
Layer/Interface Design
129
 Important objective is ‘clean’ interfaces, having
minimal set of well-defined services.

 Clean-cut interfaces enable:


 minimisation of inter-layer communications

 easy replacement of individual layers

 Set of layers and protocols is the Network


Architecture.
Prepared By Tsegaye A. 12/22/2024
Virtual & Actual Communications
130

 Important to understand difference between:


 virtualand actual communications,
 protocols and interfaces.

 Peer processes ‘think’ of communications as being


‘horizontal’ using protocol.
 Actual communications is via interfaces (and the physical
communications medium).
 Peer process idea is key to network design.

Prepared By Tsegaye A. 12/22/2024


Design Issues
131

 Some issues affect many layers, e.g:


 need to address data (say who it’s for),
 possible need for setting up connections,

 data transfer rules (simplex, half-duplex, ...),

 error management,

 deal with message component re-ordering,

 flow control,

 routing

 security

Prepared By Tsegaye A. 12/22/2024


Internetworking and Routing
132

 No single networking technology can satisfy all


requirements.
 Universal interconnection is desired.
 Protocols allow communication between nodes without
understanding underlying mechanisms.
 Internetworking is the process by which a group of
disparate, heterogeneous networks can be linked to form
a single logical network.
 The Internet is just such a collection.
Prepared By Tsegaye A. 12/22/2024
Routing
133

Routing is the mechanism used to transfer data


between networks to reach the correct destination.

Router Network
B
Web Browser

Network
A
Routing takes place at the IP
layer: routers are not aware of
Web Server transport and application layers.
Prepared By Tsegaye A. 12/22/2024
Protocol Layering and Routing
134

Host A Host B
Application Layer Application Layer
HTTP Message

Transport Layer Transport Layer


TCP Packet

Router
Internet Layer Internet Layer Internet Layer
IP Datagram IP Datagram

Network Layer Ethernet Network Layer Ethernet Network Layer


Frame Frame

Physical Network Physical Network


Prepared By Tsegaye A. 12/22/2024
The OSI Reference Model
135

 OSI Reference Model – an internationally


standardised network architecture.
 An abstract representation of an ideal network
protocol stack; not used in real networks.
 OSI = Open Systems Interconnection.
 Specified in ISO 7498-1.
 Model has 7 layers.

Prepared By Tsegaye A. 12/22/2024


Internet Protocols vs OSI
136

Application 7

5 Application Presentation 6
Session 5

4 TCP Transport 4
3 IP Network 3
2 Network Interface Data Link 2

1 Hardware Physical 1

Prepared By Tsegaye A. 12/22/2024


The OSI Model
137

Layer 7 Application Layer

Layer 6 Presentation Layer

Layer 5 Session Layer

Layer 4 Transport Layer

Layer 3 Network Layer

Layer 2 Data Link Layer

Layer 1 Physical Layer

Prepared By Tsegaye A. 12/22/2024


Lower/Upper Layers
138

 Layers 1-4 often referred to as lower layers.


 Layers 5-7 are the upper layers.
 Lower layers relate more closely to the
communications technology.
 Layers 1 – 3 manage the communications subnet.
 theentire set of communications nodes required to
manage massages between a pair of machines.
 Layers 4 – 7 are true ‘end-to-end’ protocols.
 Upper layers relate to application.
Prepared By Tsegaye A. 12/22/2024
Layer 7: Application Layer
139

 Home to wide variety of protocols for


specific user needs, e.g.:
virtual terminal service,
file transfer,
electronic mail,
directory services.

Prepared By Tsegaye A. 12/22/2024


Layer 6: Presentation Layer
140

 Concerned with representation of transmitted data.


 Deals with different data representations.
 ASCII or EBCDIC,
 one’s complement or two’s complement,

 byte ordering conventions,

 floating point conventions (IEEE or proprietary).

 Also deals with data compression.

Prepared By Tsegaye A. 12/22/2024


Layer 5: Session Layer
141

 Allows establishment of sessions between machines,


e.g. to
 allow remote logins
 provide file transfer service.
 Responsible for:
 dialogue control
◼ which entity sends when with half-duplex communications.
 token management
◼ E.g. control which entity can perform an operation on shared
data.
 synchronisation
◼ E.g. insertion of checkpoints in large data transfers.
Prepared By Tsegaye A. 12/22/2024
Layer 4: Transport Layer
142

 Basic function is to take data from Session Layer, split


it up into smaller units, and ensure that the units arrive
correctly.
 Concerned with efficient provision of service.
 The Transport Layer also determines the ‘type of
service’ to provide to the Session Layer.

Prepared By Tsegaye A. 12/22/2024


Layer 3: Network Layer
143

 Key responsibility is control of routing in the


subnet.
 Routing can be based on:
 statictables,
 determined at start of session,

 highly dynamic (varying for each packet depending on


network load).
 Also responsible for congestion control and usage
monitoring.

Prepared By Tsegaye A. 12/22/2024


Layer 2: Data Link Layer
144

 Provides reliable, error-free service on top of raw


Layer 1 service.
 Breaks data into frames. Requires creation of
frame boundaries.
 Frames used to manage errors via
acknowledgements and selective frame
retransmission.

Prepared By Tsegaye A. 12/22/2024


Layer 1: Physical Layer
145

 Concerned with bit transmission over physical


channel.
 Issues include:
 definition
of 0/1,
 whether channel simplex/duplex,

 connector design.

 Mechanical, electrical, procedural matters.

Prepared By Tsegaye A. 12/22/2024


Services in the OSI Model
146

 In OSI model, each layer provide services to


layer above, and ‘consumes’ services provided
by layer below.
 Active elements in a layer are called entities.

 Entities in same layer in different machines


are called peer entities.

Prepared By Tsegaye A. 12/22/2024


Layering Principles
147

n+1
PDU

(n+1) Entity Layer n+1 protocol (n+1) Entity


Service User Service User
Layer n Service
SDU
Access Point (SAP)
(n) Entity Layer n protocol (n) Entity
Service Provider Service Provider

N-1 N-1
PDU PDU

PDU - Protocol Data Unit


SDU - Service Data Unit
Prepared By Tsegaye A.
12/22/2024
Services and Protocols
148

 Service = set of primitives provided by one layer


to layer above.
 Service defines what layer can do (but not how it
does it).
 Protocol = set of rules governing data
communication between peer entities, i.e. format
and meaning of frames/packets.
 Service/protocol decoupling very important.

Prepared By Tsegaye A. 12/22/2024


Connections
149

 Layers can offer connection-oriented or


connectionless services.
 Connection-oriented like telephone system.
 Connectionless like postal system.
 Each service has an associated Quality-of-service
(e.g. reliable or unreliable).

Prepared By Tsegaye A. 12/22/2024


Reliability Issues
150

 Reliable services never lose/corrupt data.


 Reliable service costs more.
 Typical application for reliable service is file
transfer.
 Typical application not needing reliable service is
voice traffic.
 Not all applications need connections.

Prepared By Tsegaye A. 12/22/2024


Encapsulation as it is applied in layered protocols
151

Prepared By Tsegaye A. 12/22/2024


IP datagram
152

 IP Addresses
 Logical, unique
 eg. cs.umd.edu is 128.8.10.143

 IP Packet Format:
VERS HL TOS Fragment Length
Datagram ID FLAG Fragment Offset
TTL Protocol Header Checksum
Source Address
Destination Address
Options (if any)
Data
Prepared By Tsegaye A. 12/22/2024
TCP Segment Format
153

Source Port Destination Port


Sequence Number
Request Number
offset Reser. Control Window
Checksum Urgent Pointer
Options (if any)

Data

Prepared By Tsegaye A. 12/22/2024


UDP Datagram Format
154

Source Port Destination Port

Length Checksum

Data

Prepared By Tsegaye A. 12/22/2024


Protocol Stacks In Relation To OSI
155
Model
Sockets Programming
156

 Network API

 Socket Structures

 Socket Functions

Prepared By Tsegaye A. 12/22/2024


Network Application Programming Interface (API)

157

 The services provided by the operating system


that provide the interface between application and
protocol software.

Application

Network API

Protocol A Protocol B Protocol C

Prepared By Tsegaye A. 12/22/2024


Network API
158

 Generic Programming Interface.


 Support for message oriented and connection
oriented communication.
 Uses the existing I/O services
 Operating System independence.
 Support multiple communication protocol suites
(families): IPv4, IPv6, XNS, UNIX.
 Provide special services for Client and Server

Prepared By Tsegaye A. 12/22/2024


TCP/IP
159

 There are a variety of APIs for use


with TCP/IP:
❑Sockets
❑TLI
❑Winsock
❑MacTCP

Prepared By Tsegaye A. 12/22/2024


Functions needed
160

 Specify local and remote communication endpoints


 Initiate a connection
 Wait for incoming connection
 Send and receive data
 Terminate a connection gracefully
 Error handling

Prepared By Tsegaye A. 12/22/2024


Berkeley Sockets
161

 Generic:
 support for multiple protocol families.
 address representation independence

 Uses existing I/O programming interface as much


as possible

Prepared By Tsegaye A. 12/22/2024


Unix Descriptor Table
162

Descriptor Table
Data structure for file 0

Data structure for file 1

Data structure for file 2

Prepared By Tsegaye A. 12/22/2024


Socket
163

 A socket is a process-level abstract representation


of a communication endpoint.
 Sockets work with Unix I/O services just like
files, pipes & FIFOs.
 Sockets (obviously) have special needs:
 establishing a connection
 specifying communication endpoint addresses

Prepared By Tsegaye A. 12/22/2024


Application, Session
And
Presentation Layers
Application Layer
• The application layer enables the user, whether human or software,
to access the network.
• It provides user interfaces and support for services such as
electronic mail, remote file access and transfer, shared
database management, and other types of distributed information
services.
• The fifth layer of the TCP/IP protocol suite is where these
services are provided for Internet users.
• The other four layers are there to make these services possible.
• The application layer provides services to the user.
• Communication is provided using a logical connection, which
means that the two application layers assume that there is an
imaginary direct connection through which they can send and
receive messages.
12/22/2024 Prepared By Tsegaye A. 165
Cont’d
➢ Specific services provided by the application layer include the following:
❑ Network virtual terminal. A network virtual terminal is a software version of a physical terminal
and allows a user to log on to a remote host.
✓ To do so, the application creates a software emulation of a terminal at the remote host.
✓ The user’s computer talks to the software terminal, which, in turn, talks to the host, and vice versa.
✓ The remote host believes it is communicating with one of its own terminals and allows you to log
on.
❑ File transfer, access, and management (FTAM). This application allows a user to
access files in a remote host (to make changes or read data), to retrieve files from a remote computer
for use in the local computer, and to manage or control files in a remote computer locally.

❑ E-mail services. This application provides the basis for e-mail forwarding and storage.

❑ Directory services. This application provides distributed database sources and access for global
information about various objects and services.

12/22/2024 Prepared By Tsegaye A. 166


Logical connection at the application layer

12/22/2024 Prepared By Tsegaye A. 167


Providing Services
• The Internet was originally designed for the same purpose:
to provide service to users around the world.
• The layered architecture of the TCP/IP protocol suite,
however, makes the Internet more flexible than other
communication networks such as postal or telephone
networks.
• Each layer in the suite was originally made up of one or
more protocols, but new protocols can be added or some
protocols can be removed or replaced by the Internet
authorities.
• However, if a protocol is added to each layer, it should be
designed in such a way that it uses the services provided by
one of the protocols at the lower layer.
12/22/2024 Prepared By Tsegaye A. 168
Cont’d
• The application layer, however, is somewhat different from other
layers in that it is the highest layer in the suite.
• The protocols in this layer do not provide services to any other
protocol in the suite; they only receive services from the
protocols in the transport layer.
• This means that protocols can be removed from this layer easily.
• New protocols can be also added to this layer as long as the new
protocols can use the services provided by one of the transport-
layer protocols.
• When the Internet was created, only a few application protocols
were available to the users; today we cannot give a number for
these protocols because new ones are being added constantly.

12/22/2024 Prepared By Tsegaye A. 169


Standard and Nonstandard Protocols

• To provide smooth operation of the Internet, the protocols


used in the first four layers of the TCP/IP suite need to be
standardized and documented.

• They normally become part of the package that is included in


operating systems such as Windows or UNIX.

• To be flexible, however, the application-layer protocols can be


both standard and nonstandard.

12/22/2024 Prepared By Tsegaye A. 170


Standard Application-Layer
Protocols
• There are several application-layer protocols that have been standardized and documented
by the Internet authority, and we are using them in our daily interaction with the Internet.

• Each standard protocol is a pair of computer programs that interact with the user and the
transport layer to provide a specific service to the user.

• In the case of these application protocols, we should know what types of services they
provide, how they work, the options that we can use with these applications, and so on.

• The study of these protocols enables a network manager to easily solve the problems that
may occur when using these protocols.

• The deep understanding of how these protocols work will also give us some ideas about
how to create new nonstandard protocols.

12/22/2024 Prepared By Tsegaye A. 171


Nonstandard Application-Layer
Protocols
• A programmer can create a nonstandard application-layer
program if she can write two programs that provide service
to the user by interacting with the transport layer.
• A private company can create a new customized application
protocol to communicate with all of its offices around the
world using the services provided by the first four layers of
the TCP/IP protocol suite without using any of the standard
application programs.
• What is needed is to write programs, in one of the computer
languages, that use the available services provided by the
transport-layer protocols.
12/22/2024 Prepared By Tsegaye A. 172
Application-Layer Paradigms
• It should be clear that to use the Internet we need two
application programs to interact with each other:
• one running on a computer somewhere in the world, the
other running on another computer somewhere else in
the world.
• The two programs need to send messages to each other
through the Internet infrastructure.
• Should both application programs be able to request services
and provide services, or should the application programs just
do one or the other? Two paradigms have been developed
during the lifetime of the Internet to answer this question:
the client-server paradigm and the peer-to-peer
paradigm.
12/22/2024 Prepared By Tsegaye A. 173
Traditional Paradigm: Client-Server
• The traditional paradigm is called the client-server paradigm.
• It was the most popular paradigm until a few years ago.
• In this paradigm, the service provider is an application program,
called the server process; it runs continuously, waiting for another
application program, called the client process, to make a
connection through the Internet and ask for service.
• There are normally some server processes that can provide a
specific type of service, but there are many clients that request
service from any of these server processes.
• For example, a telephone directory center in any area can be
thought of as a server; a subscriber that calls and asks for a specific
telephone number can be thought of as a client.

12/22/2024 Prepared By Tsegaye A. 174


Example of a client-server paradigm diagram

12/22/2024 Prepared By Tsegaye A. 175


New Paradigm: Peer-to-Peer
❖ A new paradigm, called the peer-to-peer paradigm (often abbreviated P2P
paradigm) has emerged to respond to the needs of some new applications.

❖ In this paradigm, 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.

❖ A computer can even provide and receive services at the same time.

❖ One of the areas that really fits in this paradigm is the Internet telephony.

❖ Communication by phone is indeed a peer-to-peer activity; no party needs to be


running forever waiting for the other party to call.

12/22/2024 Prepared By Tsegaye A. 176


Example of a peer-to-peer paradigm

12/22/2024 Prepared By Tsegaye A. 177


Mixed Paradigm

• An application may choose to use a mixture of


the two paradigms by 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.
12/22/2024 Prepared By Tsegaye A. 178
CLIENT-SERVER PROGRAMMING
• In a client-server paradigm, communication at the application layer is
between two running application programs called processes: a client and
a server.
• The server handles the request received from a client, prepares a result,
and sends the result back to the client.
• This definition of a server implies that a server must be running when a
request from a client arrives, but the client needs to be run only when it
is needed.
• This means that if we have two computers connected to each other
somewhere, we can run a client process on one of them and the server
on the other.
• However, we need to be careful that the server program is started before
we start running the client program.
• In other words, the lifetime of a server is infinite: it should be started
and run forever, waiting for the clients.
12/22/2024 Prepared By Tsegaye A. 179
Application Programming Interface
• How can a client process communicate with a server process? A computer
program is normally written in a computer language with a predefined set of
instructions that tells the computer what to do.

• A computer language has a set of instructions for mathematical operations, a set


of instructions for string manipulation, a set of instructions for input/ output access,
and so on.

• If we need a process to be able to communicate with another process, we need a


new set of instructions to tell the lowest four layers of the TCP/IP suite to open the
connection, send and receive data from the other end, and close the connection.

• A set of instructions of this kind is normally referred to as an application


programming interface (API).
12/22/2024 Prepared By Tsegaye A. 180
Cont’d
• An interface in programming is a set of instructions between two entities.
• Several APIs have been designed for communication.
• Three among them are common: socket interface, Transport Layer
Interface (TLI), and STREAM.
• The socket interface is a set of instructions that provide
communication between the application layer and the operating
system.
• It is a set of instructions that can be used by a process to
communicate with another process.
• The idea of sockets allows us to use the set of all instructions
already designed in a programming language for other sources
and sinks.

12/22/2024 Prepared By Tsegaye A. 181


Position of the socket interface diagram

12/22/2024 Prepared By Tsegaye A. 182


Sockets
• Although a socket is supposed to behave like a terminal or a
file, it is not a physical entity like them; it is an abstraction.
• It is an object that is created and used by the application
program.
• The client thinks that the socket is the entity that receives the
request and gives the response; the server thinks that the
socket is the one that has a request and needs the response.
• If we create two sockets, one at each end, and define the
source and destination addresses correctly, we can use the
available instructions to send and receive data.
• The rest is the responsibility of the operating system and the
embedded TCP/IP protocol.
12/22/2024 Prepared By Tsegaye A. 183
Use of sockets in process-to-process communication

12/22/2024 Prepared By Tsegaye A. 184


Socket Addresses
• The interaction between a client and a server is two-way communication.
• In a two-way communication, we need a pair of addresses: local (sender)
and remote (receiver).
• The local address in one direction is the remote address in the other
direction and vice versa.
• Since communication in the client-server paradigm is between two
sockets, we need a pair of socket addresses for communication: a local
socket address and a remote socket address.
• However, we need to define a socket address in terms of identifiers used
in the TCP/IP protocol suite.
• A socket address should first define the computer on which a client or a
server is running.
• A computer in the Internet is uniquely defined by its IP address, a 32-bit
integer in the current Internet version.
12/22/2024 Prepared By Tsegaye A. 185
Cont’d
• However, several client or server processes may be running at the
same time on a computer, which means that we need another identifier
to define the specific client or server involved in the communication.
• An application program can be defined by a port number, a 16-bit
integer.
• This means that a socket address should be a combination of an IP
address and a port number.
• Since a socket defines the end-point of the communication, we can
say that a socket is identified by a pair of socket addresses, a local and
a remote.

12/22/2024 Prepared By Tsegaye A. 186


Using Services of the Transport Layer
• There are three common transport-layer protocols in the TCP/IP
suite: UDP, TCP, and SCTP.

• Most standard applications have been designed to use the services


of one of these protocols.

• When we write a new application, we can decide which protocol


we want to use.

• The choice of the transport layer protocol seriously affects the


capability of the application processes.

12/22/2024 Prepared By Tsegaye A. 187


UDP Protocol
• UDP provides connectionless, unreliable, datagram service.
• Connectionless service means that there is no logical connection
between the two ends exchanging messages.
• Each message is an independent entity encapsulated in a
datagram.
• UDP does not see any relation (connection) between consequent
datagrams coming from the same source and going to the same
destination.
• 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.
• It gives boundaries to the messages exchanged.
12/22/2024 Prepared By Tsegaye A. 188
TCP Protocol
• TCP provides connection-oriented, reliable, byte-stream service.

• TCP requires that two ends first create a logical connection


between themselves by exchanging some connection-
establishment packets.

• This phase, which is sometimes called handshaking, establishes


some parameters between the two ends, including the size of the
data packets to be exchanged, the size of buffers to be used for
holding the chunks of data until the whole message arrives, and
so on.

• After the handshaking process, the two ends can send chunks of
12/22/2024
data in segments in eachPrepared By Tsegaye A.
direction. 189
SCTP Protocol
• SCTP provides a service which is a combination of the two other
protocols.

• 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 multi-stream 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.
12/22/2024 Prepared By Tsegaye A. 190
Iterative Communication Using UDP
• Communication between a client program and a server
program can occur iteratively or concurrently.
• Although several client programs can access the same server
program at the same time, the server program can be
designed to respond iteratively or concurrently.
• An iterative server can process one client request at a time; it
receives a request, processes it, and sends the response to the
requester before handling another request.
• When the server is handling the request from a client, the
requests from other clients, and even other requests from the
same client, need to be queued at the server site and wait for
the server to be freed.
• The received and queued requests are handled in the first-in,
first-out fashion. Prepared By Tsegaye A. 191
12/22/2024
Sockets Used for UDP
• In UDP communication, the client and server use only one socket each.

• The socket created at the server site lasts forever; the socket created at
the client site is closed (destroyed) when the client process terminates.

• In other words, different clients use different sockets, but the server
creates only one socket and changes only the remote socket address each
time a new client makes a connection.

• This is logical, because the server does know its own socket address,
but does not know the socket addresses of the clients who need its
services; it needs to wait for the client to connect before filling this part of
the socket address.
12/22/2024 Prepared By Tsegaye A. 192
Sockets for UDP communication

12/22/2024 Prepared By Tsegaye A. 193


Flow Diagram

• UDP provides a connectionless service, in which a client sends a


request and the server sends back a response. Note that there is no
connection establishment or connection termination.

• Each client sends a single datagram and receives a single


datagram. In other words, if a client wants to send two datagrams,
it is considered as two clients for the server.

• The second datagram needs to wait for its turn.

• The diagram also shows the status of the socket after each
action.

12/22/2024 Prepared By Tsegaye A. 194


Server Process
• The server makes a passive open, in which it becomes ready for the
communication, but it waits until a client process makes the
connection.
• It creates an empty socket. It then binds the socket to the server and
the well-know port, in which only part of the socket (the server
socket address) is filled (binding can happen at the time of creation
depending on the underlying language).
• The server then issues a receive request command, which blocks
until it receives a request from a client. The server then fills the rest
of the socket (the client socket section) from the information
obtained in the request.
• The request is the process and the response is sent back to the
client.
• The server now starts another iteration waiting for another request
to arrive (an infinite loop).
12/22/2024 Prepared By Tsegaye A. 195
Client Process

• The client process makes an active open. In other words, it starts a


connection.

• It creates an empty socket and then issues the send command,


which fully fills the socket, and sends the request.

• The client then issues a receive command, which is blocked until a


response arrives from the server.

• The response is then handled and the socket is destroyed.

12/22/2024 Prepared By Tsegaye A. 196


Iterative Communication Using TCP

• TCP is a connection-oriented protocol.

• Before sending or receiving data, a connection needs to


be established between the client and the server.

• After the connection is established, the two parties can


send and receive chunks of data as long as they have data
to do so.

12/22/2024 Prepared By Tsegaye A. 197


Sockets Used in TCP
• The TCP server uses two different sockets, one for connection
establishment and the other for data transfer.

• We call the first one the listen socket and the second the response socket.

• The reason for having two types of sockets is to separate the connection
phase from the data exchange phase.

• A server uses a listen socket to listen for a new client trying to establish
connection.

• After the connection is established, the server creates a socket to


exchange data with the client and finally to terminate the connection.

• The client uses only one socket for both connection establishment and
12/22/2024 Prepared By Tsegaye A. 198
data exchange.
Sockets used in TCP communication

12/22/2024 Prepared By Tsegaye A. 199


Session Layer
• The services provided by the first four layers (physical, data link, network and
transport) are not sufficient for some processes.
• The session layer is the network dialog controller.
• It establishes, maintains, and synchronizes the interaction between
communicating systems.
• Specific responsibilities of the session layer include the following:

❑ Dialog control. The session layer allows two systems to


enter into a dialog.
It allows the communication between two processes to take place in either half-
duplex (one way at a time) or full-duplex (two ways at a time) mode.

12/22/2024 Prepared By Tsegaye A. 200


Cont’d
❑ Synchronization. The session layer allows a process to add
checkpoints (synchronization points) into a stream of
data.

For example, if a system is sending a file of 2,000 pages, it


is advisable to insert checkpoints after every 100 pages to
ensure that each 100-page unit is received and
acknowledged independently.

12/22/2024 Prepared By Tsegaye A. 201


Presentation Layer
• The presentation layer is concerned with the syntax and semantics of the
information exchanged between two systems.

• Specific responsibilities of the presentation layer include the following:


❑ Translation. The processes (running programs) in two systems are
usually exchanging information in the form of character strings, numbers,
and so on.
The information should be changed to bit streams before being
transmitted. Because different computers use different encoding systems,
the presentation layer is responsible for interoperability between these
different encoding methods.
The presentation layer at the sender changes the information from its
sender-dependent format into a common format.
The presentation layer at the receiving machine changes the common
format into its receiver-dependent
12/22/2024
format.
Prepared By Tsegaye A. 202
Cont’d
❑ Encryption. Tocarry sensitive information a system must be
able to assure privacy.
Encryption means that the sender transforms the
original information to another form and sends the
resulting message out over the network.
Decryption reverses the original process to transform the
message back to its original form.
❑ Compression. Data compression reduces the number of bits
contained in the information.
Data compression becomes particularly important in the
transmission of multimedia such as text, audio, and video.

12/22/2024 Prepared By Tsegaye A. 203


Introduction
• Layer 4, responsible for the overall end-to-end transfer of
application data.

• Transport layer also encompasses these functions:


1. Enables multiple applications to communicate over the
network at the same time on a single device.
2. Ensures that, if required, all the
data is received reliably and
in order by the correct
application.
3. Employs error
handling mechanisms.

12/22/2024 Prepared By Tsegaye A. 205


Applications Requirements Vary
• Because different applications have different requirements, there
are multiple Transport layer protocols.

12/22/2024 Prepared By Tsegaye A. 206


Data Encapsulation
Application
Presentation
Data Session

Header Data Transport Segment-Datagram

Header Segment / Datagram Network Packet

Header Packet Trailer Data Link Frame

1000000111111000001110000 Physical Bits

12/22/2024 Prepared By Tsegaye A. 207


TCP and UDP
• UDP
▪ is a simple, low overhead, connectionless protocol, RFC 768
▪ Pieces of communication in UDP are called datagrams.
▪ Datagrams are sent as "best effort“ “Unreliable”.
▪ Applications that use UDP include:
✓ DNS,DHCP,SNMP,RIP, TFTP, Online games, Video Streaming, and VoIP.
• TCP
▪ is a connection-oriented, RFC 793, additional overhead
▪ Reliable delivery.
▪ Flow control which prevents overflow
▪ Applications that use TCP are:
✓ Web Browsers, E-mail, File Transfers.
12/22/2024 Prepared By Tsegaye A. 208
Transport Layer Header

12/22/2024 Prepared By Tsegaye A. 209


TCP Header Fields
• Source port : a random value above 1023.
• Destination port: Identifies the destination protocol or application.
• Sequence number: the first byte in the current segment.
Is the SYN flag set or not??
• Acknowledgement number: specifies the next expected byte by
the receiver.
• Window size: determines how many bytes can be sent before
waiting for acknowledgement.
• H.length (Offset): the length of the segment header in bytes.
• Checksum: used for error checking.
• Reserved: Reserved for future use and should be set to zero.
12/22/2024 Prepared By Tsegaye A. 210
Port Addressing
• Port Number (L4 Addressing): Uniquely identifies applications.
✓ Server processes have static port numbers assigned to them.
✓ Clients dynamically choose a port number for each conversation.

• Socket: is the combination of the port number and the IP


address, Ex: 198.16.23.213:80.

• Socket Pair: consists of the source and destination IP addresses


and port numbers, is also unique and identifies the conversation
between the two hosts.

• IANA is responsible for assigning various addressing standards.

12/22/2024 Prepared By Tsegaye A. 211


Types of port numbers
1. Well Known Ports (0 to 1023): are reserved for services and
applications such as HTTP (80), SMTP (25), DNS (53), ... .
Well Known UDP Ports Well Known TCP/UDP Ports Well Known TCP Ports
69 - TFTP 53 - DNS Telnet: 23, SMTP:25, HTTP:
520 - RIP 161 - SNMP 80, POP3: 110, HTTPS:443

2. Registered Ports (1024 to 49151): are assigned to user


processes or applications such as MSN Messenger (1863).

3. Dynamic or Private ‘Ephemeral’ Ports (49152 to 65535):


assigned dynamically to client applications when initiating a
connection.
12/22/2024 Prepared By Tsegaye A. 212
Identifying Applications and hosts
192.168.1.101
Source Port Destination Port 198.133.219.25
49888 80
49890 80

www.cisco.com
172.16.5.5
66.13.29.25
Source Port
49888 80

• Netstat: examines the open connections on a host


12/22/2024 Prepared By Tsegaye A. 213
Transport Layer Functions
• TCP/UDP Functions.
1. Segmentation and Reassembly.
2. Conversation Multiplexing using port numbers.
3. Error detection.
• TCP Additional functions
1. Connection Establishment (3-way handshake)
2. Connection Management.
▪ Reliability (acknowledgements).
▪ Flow control (Buffering, congestion avoidance, windowing).
▪ Error correction .
3. Connection Termination (4-way handshake)
12/22/2024 Prepared By Tsegaye A. 214
At the source: Segmentation
• divides application data into blocks of data that are of appropriate
size

12/22/2024 Prepared By Tsegaye A. 215


At the Destination: TCP in order Reassembly
• The Transport layer reassembles the data before sending it to the
destination application or service.

12/22/2024 Prepared By Tsegaye A. 216


At the Destination: UDP Out of order Reassembly
• The Transport layer reassembles the data before sending it to the
destination application or service.

12/22/2024 Prepared By Tsegaye A. 217


Conversation Multiplexing
• Multiple Applications can use the network at the same time
where each application is identified by unique port number.

12/22/2024 Prepared By Tsegaye A. 218


TCP Connection Establishment (3-way handshake)

• When two hosts communicate using TCP, a connection


(Three-way handshake) is established before data can be
exchanged.

12/22/2024 Prepared By Tsegaye A. 219


Connection Management - Reliability

• At the Transport layer the three basic operations of reliability are:

1. Tracking transmitted data: keep track of all the data pieces of


each conversation.
2. Acknowledging received data: The destination sends
acknowledgements to the source for the segments that it
receives.
3. Retransmitting any unacknowledged data: Retransmit any of
data that were not acknowledged by the destination.
If the source does not receive an acknowledgement within a predetermined
amount of time, it retransmits that data to the destination.

12/22/2024 Prepared By Tsegaye A. 220


Connection Management - Flow Control
• Flow Control: the management of data flow between devices in
the network.
✓ is a method of making sure that an excessive amount of data
doesn't overrun the end station.
✓ Example: imagine that PC A is running at 100 Mbps and PC B is running at
10 Mbps. If PC A sends something to PC B at full speed, 90 percent of the
information will be lost because PC B cannot accept the information at 100
Mbps. This is the reason for flow control.
• Flow control Methods:
1. Buffering
2. Congestion Avoidance
3. Windowing
12/22/2024 Prepared By Tsegaye A. 221
Flow Control - Buffering & Congestion Avoidance

12/22/2024 Prepared By Tsegaye A. 222


Flow Control - Windowing

• Window Size: The amount of data that a source can transmit


before an acknowledgement must be received

12/22/2024 Prepared By Tsegaye A. 223


Flow Control - Windowing

• Flow control assists the reliability of TCP transmission by adjusting


the effective rate of data flow between the two services in the
session.

12/22/2024 Prepared By Tsegaye A. 224


Flow Control – Reducing the window size
• If a receiving host has congestion, it may respond to the sending
host with a segment with a reduced window size.

12/22/2024 Prepared By Tsegaye A. 225


TCP Connection Termination (4-way Handshake)

12/22/2024 Prepared By Tsegaye A. 226


Network Layer
Addressing
and Routing
Introducton
• To solve the problem of delivery through several links,
the network layer (or the internetwork layer, as it is
sometimes called) was designed.
• The network layer is responsible for host-to-host delivery
and for routing the packets through the routers.
• The network layer in the TCP/IP protocol suite is
responsible for the host-to-host delivery of datagrams.
• It provides services to the transport layer and receives
services from the data-link layer.

12/22/2024 Prepared By Tsegaye A. 228


Cont'd

12/22/2024 Prepared By Tsegaye A. 229


SWITCHING
• From the previous discussion, it is clear that the
passage of a message from a source to a destination
involves many decisions.
• When a message reaches a connecting device, a
decision needs to be made to select one of the output
ports through which the packet needs to be send out.
• In other words, the connecting device acts as a
switch that connects one port to another port.

12/22/2024 Prepared By Tsegaye A. 230


Circuit Switching
• One solution to the switching is referred to as circuit switching, in
which a physical circuit (or channel) is established between the
source and destination of the message before the delivery of the
message.
• After the circuit is established, the entire message, is transformed
from the source to the destination.
• In circuit switching, the whole message is sent from the source to
the destination without being divided into packets.
• A good example of a circuit-switched network is the early
telephone systems in which the path was established
between a caller and a callee when the telephone number
of the callee was dialed
12/22/2024
by the caller.
Prepared By Tsegaye A. 231
Packet Switching
• The second solution to switching is called packet switching.
• The network layer in the Internet today is a packet-switched
network.
• In this type of network, a message from the upper layer is divided
into manageable packets and each packet is sent through the
network.
• The source of the message sends the packets one by one; the
destination of the message receives the packets one by one.
• The destination waits for all packets belonging to the same
message to arrive before delivering the message to the upper layer.
• In packet switching, the message is first divided into manageable
packets at the source before being transmitted.
12/22/2024 Prepared By Tsegaye A. 232
• The packets are assembled at the destination.
Connectionless packet switching
network

12/22/2024 Prepared By Tsegaye A. 233


Connection oriented packet
switching

12/22/2024 Prepared By Tsegaye A. 234


NETWORK LAYER SERVICES

Logical Addressing
• Since the network layer provides end-to-
end communication, the two computers
that need to communicate with each other
each need a universal identification
system, referred to as network-layer
address or logical address.
• This type of identification is provided in
the network layer through a uniform and
global addressing mechanism.
12/22/2024 Prepared By Tsegaye A. 235
Services Provided at the
Source Computer
The network layer at the source computer provides
four services:
❖Packetizing,
❖Finding the logical address of the next hop,
❖ Finding the physical (MAC) address of the next
hop, and
❖ Fragmenting the datagram if necessary.

12/22/2024 Prepared By Tsegaye A. 236


12/22/2024 Prepared By Tsegaye A. 237
Packetizing
• The first duty of the network layer is to encapsulate the
data coming from the upper layer in a datagram.

• This is done by adding a header to the data that contains


the logical source and destination address of the packet,
information about fragmentation, the protocol ID of the
protocol that has requested the service, the data length,
and possibly some options.
12/22/2024 Prepared By Tsegaye A. 238
Finding Logical Address of Next Hop

• The prepared datagram contains the source and destination


addresses of the packet.
• The datagram, as we saw before, may have to pass through many
networks to reach its final destination.
• If the destination computer is not connected to the same network
as the source, the datagram should be delivered to the next router.
• The source and destination address in the datagram does not tell
anything about the logical address of the next hop.
• The network layer at the source computer needs to consult a
routing table to find the logical address of the next hop.

12/22/2024 Prepared By Tsegaye A. 239


Finding MAC Address of Next Hop

• The network layer does not actually deliver the datagram to the
next hop; it is the duty of the data link layer to do the delivery.
• The data link layer needs the MAC address of the next hop to do
the delivery.
• To find the MAC address of the next hop, the network layer
could use another table to map the next-hop logical address to
the MAC address.
• this task has been assigned to another auxiliary protocol called
Address Resolution Protocol (ARP) that finds the MAC address
of the next hop given the logical address.

12/22/2024 Prepared By Tsegaye A. 240


Fragmentation
• The datagram at this step may not be ready to be passed to the
data link layer.
• The datagram prepared at the network layer, may be larger than
that limit.
• The datagram needs to be fragmented to smaller units before
being passed to the data link layer.
• Fragmentation needs to preserve the information at the header of
the datagram.
• In other words, although the data can be fragmented, the header
needs to be repeated. In addition, some more information needs to
be added to the header to define the position of the fragment in
the whole datagram.
12/22/2024 Prepared By Tsegaye A. 241
IP
• The Internet Protocol (IP) is a protocol used for
communicating data across a packet-switched internetwork
using the Internet Protocol Suite, also referred to as
TCP/IP.
• IP is the primary protocol in the Internet Layer of the
Internet Protocol Suite and has the task of delivering
distinguished protocol datagrams (packets) from the source
host to the destination host solely based on their addresses.
The first major version of addressing structure, now
referred to as Internet Protocol Version 4 (IPv4) is still the
dominant protocol of the Internet, although the successor,
Internet Protocol Version 6 (IPv6) is being deployed
actively worldwide.
IP Addressing
• Communication at the network layer is host-to-host
(computer-to-computer); a computer somewhere in
the world needs to communicate with another
computer somewhere else in the world.
• Usually, computers communicate through the
Internet.
• The packet transmitted by the sending computer
may pass through several LANs or WANs before
reaching the destination computer.
• For this level of communication, we need a global
addressing scheme; we use the term IP address to
mean a logical address in the network layer of the
TCP/IP protocol suite.
IPv4 ADDRESSES
• An IPv4 address is a 32-bit address that
uniquely and universally defines the connection
of a device (for example, a computer or a
router) to the Internet.
• IPv4 addresses are unique and universal.
• They are unique in the sense that each address
defines one, and only one, connection to the
Internet.
• Two devices on the Internet can never have the
same address at the same time.
Address Space
• A protocol such as IPv4 that defines addresses has an
address space. An address space is the total number
of addresses used by the protocol.
• If a protocol uses N bits to define an address, the
address space is 2N because each bit can have two
different values (0 or 1) and N bits can have 2N
values.
• IPv4 uses 32-bit addresses, which means that the
address space is 232 or 4,294,967,296 (more than 4
billion). This means that, theoretically, if there were
no restrictions, more than 4 billion devices could be
connected to the Internet.
• We will see shortly that the actual number is much
less because of the restrictions imposed on the
Notations
• There are two prevalent notations to show an IPv4
address: binary notation and dotted-decimal notation.
• Binary Notation
o In binary notation, the IPv4 address is displayed as 32
bits. Each octet is often referred to as a byte. So it is
common to hear an IPv4 address referred to as a 32-bit
address or a 4-byte address. The following is an example
of an IPv4 address in binary notation:
01110101 10010101 00011101 00000010
Cont’d

Dotted-Decimal Notation

o To make the IPv4 address more compact and easier


to read, Internet addresses are usually written in
decimal form with a decimal point (dot) separating
the bytes. The following is the dotted-decimal
notation of the above address:

117.149.29.2
12/22/2024 Prepared By Tsegaye A. 247
Example: Dotted-decimal
notation and binary notation for
an IPv4 address
Example 1

Change the following IPv4 addresses from binary


notation to dotted-decimal notation.

Solution
We replace each group of 8 bits with its equivalent
decimal number and add dots for separation.

19.8
Example 2

Change the following IPv4 addresses from dotted-


decimal notation to binary notation.

Solution
We replace each decimal number with its binary
equivalent.

19.9
Example 3

Find the error, if any, in the following IPv4 addresses.

Solution
a. There must be no leading zero (045).
b. There can be no more than four numbers.
c. Each number needs to be less than or equal to 255.
d. A mixture of binary notation and dotted-decimal
notation is not allowed.
Classful Addressing
• IPv4 addressing, at its inception, used
the concept of classes.
• This architecture is called classful
addressing.
• In classful addressing, the address space
is divided into five classes: A, B, C, D,
and E.
• Each class occupies some part of the
address space.
Finding the classes in binary and dotted-decimal
notation
Example 4

Find the class of each address.


a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111

Solution
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C
address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
19.13
Classes and Blocks
• One problem with classful addressing is that
each class is divided into a fixed number of
blocks with each block having a fixed size

Number of Blocks for class A = 27 Block size for class A = 224


Number of Blocks for class B = 214 Block size for class B = 216
Number of Blocks for class C = 221 Block size for class C = 28
Block size for class C = 228
Block size for class C = 228
Cont’d
• Previously, when an organization requested a block of
addresses, it was granted one in class A, B, or C.
• Class A addresses were designed for large organizations
with a large number of attached hosts or routers.
• Class B addresses were designed for midsize organizations
with tens of thousands of attached hosts or routers.
• Class C addresses were designed for small organizations
with a small number of attached hosts or routers.
Cont’d
• A block in class A address is too large for almost
any organization.
• This means most of the addresses in class A were
wasted and were not used.
• A block in class B is also very large, probably too
large for many of the organizations that received a
class B block.
• A block in class C is probably too small for many
organizations.

12/22/2024 Prepared By Tsegaye A. 257


Netid and Hostid
• In classful addressing, an IP address in class A, B,
or C is divided into netid and hostid.
• These parts are of varying lengths, depending on
the class of the address.
• In class A, one byte defines the netid and three
bytes define the hostid.
• In class B, two bytes define the netid and two
bytes define the hosfid.
• In class C, three bytes define the netid and one
byte defines the hostid.
Mask
• Although the length of the netid and hostid (in bits) is
predetermined in classful addressing, we can also use a
mask (also called the default mask), a 32-bit number
made of contiguous 1s followed by contiguous 0s.
• The mask can help us to find the netid and the hostid.
For example, the mask for a class A address has eight 1s,
which means the first 8 bits of any address in class A
define the netid; the next 24 bits define the hostid.
Subnetting
• During the era of classful addressing, subnetting
was introduced.
• If an organization was granted a large block in
class A or B, it could divide the addresses into
several contiguous groups and assign each group
to smaller networks (called subnets) or, in rare
cases, share part of the addresses with
neighbors.
• Subnetting increases the number of 1s in the
mask.
Address Depletion
• The flaws in classful addressing scheme
combined with the fast growth of the Internet
led to the near depletion of the available
addresses.
• Yet the number of devices on the Internet is
much less than the 232 address space.
• We have run out of class A and B addresses, and
a class C block is too small for most midsize
organizations.
• One solution that has alleviated the problem is
the idea of classless addressing.
Classless Addressing
• To overcome address depletion and give more
organizations access to the Internet, classless
addressing was designed and implemented.
• In this scheme, there are no classes, but the addresses
are still granted in blocks.
Cont’d
Address Blocks
o In classless addressing, when an entity, small or
large, needs to be connected to the Internet, it is
granted a block (range) of addresses.
o The size of the block (the number of addresses)
varies based on the nature and size of the entity.
o For example, a household may be given only two
addresses; a large organization may be given
thousands of addresses.
o An ISP, as the Internet service provider, may be
given thousands or hundreds of thousands based on
the number of customers
12/22/2024 it may
Prepared By Tsegaye A. serve. 263
Restriction
• To simplify the handling of addresses, the Internet
authorities impose three restrictions on classless
address blocks:
1.The addresses in a block must be contiguous, one
after another.
2.The number of addresses in a block must be a
power of 2 (1, 2, 4, 8 .... ).
3.The first address must be evenly divisible by the
number of addresses.
• The above figure shows a block of addresses, in both
binary and dotted-decimal notation, granted to a small
business that needs 16 addresses.
• We can see that the restrictions are applied to this block.
The addresses are contiguous. The number of
addresses is a power of 2 (16 = 24), and the first
address is divisible by 16.
• The first address, when converted to a decimal number,
is 3,440,387,360, which when divided by 16 results in
215,024,210.
Classless addressing Mask
• A better way to define a block of addresses is to
select any address in the block and the mask.
• As we discussed before, a mask is a 32-bit number in
which the n leftmost bits are 1s and the 32 - n
rightmost bits are 0s.
• However, in classless addressing the mask for a block
can take any value from 0 to 32. It is very convenient
to give just the value of n preceded by a slash (CIDR
– Classless Interdomain Routing notation).
• The address and the/n notation completely define
the whole block (the first address, the last address,
and the number of addresses).
First Address
• The first address in the block can be found by setting the 32
- n rightmost bits in the binary notation of the address to
0s.
Example
• A block of addresses is granted to a small
organization.
• We know that one of the addresses is
205.16.37.39/28. What is the first address in the
block?
• Solution
• The binary representation of the given address is
• 11001101 00010000 00100101 00100111
• If we set 32−28 rightmost bits to 0, we get
• 11001101 00010000 00100101 00100000
• or
Last Address
• The last address in the block can be found by setting
the 32 - n rightmost bits in the binary notation of the
address to 1s.
• Example
• Find the last address for the block in Example
above.
• Solution
• The binary representation of the given address is
• 11001101 00010000 00100101 00100111
• If we set 32 − 28 rightmost bits to 1, we get
• 11001101 00010000 00100101 00101111
• or
• 205.16.37.47
Number of Addresses

• The number of addresses in the block is the


difference between the last and first address.
• It can easily be found using the formula 232-n.
• Example
• Find the number of addresses in
205.16.37.39/28.
• Solution
• The value of n is 28, which means that number
of addresses is 2 32−28 or 16.
• Another way to find the first address, the last
address, and the number of addresses is to
represent the mask as a 32-bit binary (or 8-digit
hexadecimal) number. This is particularly useful
when we are writing a program to find these
pieces of information. In the above example the
/28 can be represented as
• 11111111 11111111 11111111 11110000
(twenty-eight 1s and four 0s).

Find
• a. The first address
• b. The last address
• c. The number of addresses.
Solution
a. The first address can be found by ANDing the given
addresses with the mask. ANDing here is done bit by
bit. The result of ANDing 2 bits is 1 if both bits are 1s;
the result is 0 otherwise.
b. The last address can be found by ORing the given
addresses with the complement of the mask. ORing
here is done bit by bit. The result of ORing 2 bits is 0 if
both bits are 0s; the result is 1 otherwise. The
complement of a number is found by changing each 1
to 0 and each 0 to 1.
c. The number of addresses can be found by
complementing the mask, interpreting it as a decimal
number, and adding 1 to it.
Network Addresses
• A very important concept in IP addressing is the
network address.
• When an organization is given a block of addresses,
the organization is free to allocate the addresses to the
devices that need to be connected to the Internet.
• The first address in the class, however, is normally (not
always) treated as a special address.
• The first address is called the network address and
defines the organization network.
• It defines the organization itself to the rest of the
world.
• The first address is the one that is used by routers to
direct the message sent to the organization from the
outside.
Hierarchy
• IP addresses, like other addresses or identifiers
we encounter these days, have levels of
hierarchy.
• For example, a telephone network in Ethiopia
has three levels of hierarchy.
• The leftmost three digits (251) define the
country code, the next three digits (011, for
example) define the area, the last six digits
(112343, for example) define the subscriber
number.
Two-Level Hierarchy: No Subnetting
• An IP address can define only two levels of
hierarchy when not subnetted.
• The n leftmost bits of the address x.y.z.t/n define
the network (organization network); the 32 – n
rightmost bits define the particular host (computer
or router) to the network.
• The two common terms are prefix and suffix.
• The part of the address that defines the network is
called the prefix; the part that defines the host is
called the suffix.
• The prefix is common to all addresses in the
network; the suffix changes from one device to
another.
Three-Levels of Hierarchy: Subnetting
• An organization that is granted a large block of
addresses may want to create clusters of networks
(called subnets) and divide the addresses between the
different subnets.
• The rest of the world still sees the organization as one
entity; however, internally there are several subnets.
• All messages are sent to the router address that
connects the organization to the rest of the Internet;
the router routes the message to the appropriate
subnets.
• The organization, however, needs to create small
subblocks of addresses, each assigned to specific
subnets. The organization has its own mask; each
subnet must also have its own.
Example
• Suppose an organization is given the block
17.12.14.0/26, which contains 64 addresses. The
organization has three offices and needs to divide the
addresses into three subblocks of 32, 16, and 16
addresses.
• We can find the new masks by using the following
arguments:
1. Suppose the mask for the first subnet is n1, then 232-n1
must be 32, which means that n1 = 27.
2. Suppose the mask for the second subnet is n2, then 232-n2
must be 16, which means that n2 = 28.
3. Suppose the mask for the third subnet is n3, then 232-n3
must be 16, which means that n3 = 28.
• This means that we have the masks 27, 28, 28 with
the organization mask being 26.
More Levels of Hierarchy
• The structure of classless addressing does not restrict the
number of hierarchical levels.
• An organization can divide the granted block of addresses into
subblocks.
• Each subblock can in turn be divided into smaller subblocks.
And so on.
• One example of this is seen in the ISPs.
• A national ISP can divide a granted large block into smaller
blocks and assign each of them to a regional ISP.
• A regional ISP can divide the block received from the national
ISP into smaller blocks and assign each one to a local ISP.
• A local ISP can divide the block received from the regional ISP
into smaller blocks and assign each one to a different
organization.
• Finally, an organization can divide the received block and make
several subnets out of it.
Address Allocation
• The next issue in classless addressing is address allocation.
How are the blocks allocated?
• The ultimate responsibility of address allocation is given to a
global authority called the Internet Corporation for Assigned
Names and Addresses (ICANN).
• However, ICANN does not normally allocate addresses to
individual organizations. It assigns a large block of addresses
to an ISP.
• Each ISP, in turn, divides its assigned block into smaller
subblocks and grants the subblocks to its customers.
• In other words, an ISP receives one large block to be
distributed to its Internet users.
• This is called address aggregation: many blocks of addresses
are aggregated in one block and granted to one ISP.
Example
An ISP is granted a block of addresses starting with
190.100.0.0/16 (65,536 addresses).
The ISP needs to distribute these addresses to three groups of
customers as follows:
a. The first group has 64 customers; each needs 256
addresses.
b. The second group has 128 customers; each needs 128
addresses.
c. The third group has 128 customers; each needs 64
addresses.
Design the subblocks and find out how many addresses
are still available after these allocations.
Group 1 solution
For this group, each customer needs 256 addresses. This means that 8
(log2256) bits are needed to define each host. The prefix length is
then 32 − 8 = 24. The addresses are

Group 2
For this group, each customer needs 128 addresses. This
means that 7 (log2 128) bits are needed to define each host.
The prefix length is then 32 − 7 = 25. The addresses are
Group 3
For this group, each customer needs 64 addresses. This
means that 6 (log264) bits are needed to each host. The prefix
length is then 32 − 6 = 26. The addresses are

Number of granted addresses to the ISP: 65,536


Number of allocated addresses by the ISP: 40,960
Number of available addresses: 24,576
Network Address Translation
(NAT)
• Many users start to have more hosts to be connected to
the internet
• IP addresses are in depletion
• Solution: NAT
• NAT enables a user to have a large set of addresses
internally and one address, or a small set of addresses,
externally. The traffic inside can use the large set; the
traffic outside, the small set.
Routing and Forwarding
• Other duties of the network layer, which are as important as the
first, are routing and forwarding, which are directly related to
each other.
Routing
• The network layer is responsible for routing the packet from its
source to the destination.
• A physical network is a combination of networks (LANs and
WANs) and routers that connect them. This means that there is
more than one route from the source to the destination.
• The network layer is responsible for finding the best one among
these possible routes. The network layer needs to have some
specific strategies for defining the best route.
12/22/2024 Prepared By Tsegaye A. 287
Forwarding
• If routing is applying strategies and running some routing
protocols to create the decision-making tables for each router,
forwarding can be defined as the action applied by each router
when a packet arrives at one of its interfaces.
• The decision-making table a router normally uses for applying
this action is sometimes called the forwarding table and
sometimes the routing table.
• When a router receives a packet from one of its attached
networks, it needs to forward the packet to another attached
network (in unicast routing) or to some attached networks (in
multicast routing).

12/22/2024 Prepared By Tsegaye A. 288


ROUTING ALGORITHMS
• After discussing the general idea behind least-cost trees
and the forwarding tables that can be made from them,
now we concentrate on the routing algorithms.
• Several routing algorithms have been designed in the
past. The differences between these methods are in the
way they interpret the least cost and the way they create
the least-cost tree for each node.

12/22/2024 Prepared By Tsegaye A. 289


IPv6 ADDRESSES
• Despite all short-term solutions, address
depletion is still a long-term problem for
the Internet. This and other problems in
the IP protocol itself have been the
motivation for IPv6.
• An IPv6 address is 128 bits or 32
hexadecimal digits long.
Abbreviated IPv6
addresses
Example-9
Expand the address 0:15::1:12:1213 to its original.

Solution
We first need to align the left side of the double colon
to the left of the original pattern and the right side of
the double colon to the right of the original pattern to
find how many 0s we need to replace the double
colon.

This means that the original address is.

19.47
ADDRESS MAPPING
• The delivery of a packet to a host or a router
requires two levels of addressing: logical and
physical.
• We need to be able to map a logical address
to its corresponding physical address and vice
versa.
• This can be done by using either static or
dynamic mapping.
• IP is used for logical addressing
• MAC is used for physical addressing in a local
network such as Ethernet
Mapping Logical to Physical
Address: ARP
• Anytime a host or a router has an IP datagram to send to
another host or router, it has the logical (IP) address of the
receiver.
• The logical (IP) address is obtained from the DNS if the
sender is the host or it is found in a routing table if the sender
is a router.
• But the IP datagram must be encapsulated in a frame to be
able to pass through the physical network. This means that the
sender needs the physical address of the receiver. The host or
the router sends an ARP query packet.
• The packet includes the physical and IP addresses of the
sender and the IP address of the receiver. Because the sender
does not know the physical address of the receiver, the query
is broadcast over the network
Mapping Physical to Logical
Address: RARP
• There are occasions in which a host knows its
physical address, but needs to know its logical
address. This may happen in two cases:
1. A diskless station is just booted. The station
can find its physical address by checking its
interface, but it does not know its IP address.
2. An organization does not have enough IP
addresses to assign to each station; it needs to
assign IP addresses on demand. The station can
send its physical address and ask for a short
time lease.
• Reverse Address Resolution Protocol (RARP) finds
the logical address for a machine that knows only its
physical address. Each host or router is assigned one
or more logical (IP) addresses, which are unique and
independent of the physical (hardware) address of
the machine. To create an IP datagram, a host or a
router needs to know its own IP address or addresses.
The IP address of a machine is usually read from its
configuration file stored on a disk file.
• The machine can get its physical address (by reading
its NIC, for example), which is unique locally. It can
then use the physical address to get the logical
address by using the RARP protocol. A RARP
request is created and broadcast on the local network.
Another machine on the local network that knows all
the IP addresses will respond with a RARP reply.
ICMP
• The IP protocol has no error-reporting or
error-correcting mechanism.
• The IP protocol also lacks a mechanism for host
and management queries.
• The Internet Control Message Protocol
(ICMP) has been designed to compensate for
the above two deficiencies.
• It is a companion to the IP protocol.
• PING and TRACEROUTE are two tools for
ICMP
Link Layer
and
Physical Layer
INTRODUCTION

• The Internet is a combination of networks glued


together by connecting devices (routers or switches).

• If a packet is to travel from a host to another host, it


needs to pass through these networks.

• Communication at the data-link layer is made up of five


separate logical connections between the data-link layers
in the path.
12/22/2024 Prepared By Tsegaye A. 300
12/22/2024 Prepared By Tsegaye A. 301
Nodes and Links
• Communication at the data-link layer is node-to-node.
• A data unit from one point in the Internet needs to pass
through many networks (LANs and WANs) to reach
another point.
• These LANs and WANs are connected by routers.
• It is customary to refer to the two end hosts and the
routers as nodes and the networks in between as links.
• Figure 5.2 is a simple representation of links and nodes
when the path of the data unit is only six nodes.

12/22/2024 Prepared By Tsegaye A. 302


Link and Nodes

The first node is the source host; the last node is the destination
host. The other four nodes are four routers. The first, the third,
and the fifth links represent the three LANs; the second and the
fourth links represent the two WANs.
12/22/2024 Prepared By Tsegaye A. 303
Services provided by the layer
• The data-link layer is located between the physical and the
network layers.
• The datalink layer provides services to the network layer; it
receives services from the physical layer.
• The duty scope of the data-link layer is node-to-node.
• When a packet is travelling in the Internet, the data-link
layer of a node (host or router) is responsible for delivering a
datagram to the next node in the path.
• For this purpose, the data-link layer of the sending node
needs to encapsulate the datagram received from the network
in a frame, and the data-link layer of the receiving node
needs to decapsulate the datagram from the frame.
12/22/2024 Prepared By Tsegaye A. 304
Cont’d
• In other words, the data-link layer of the source host needs
only to encapsulate, the data-link layer of the destination
host needs to decapsulate, but each intermediate node needs
to both encapsulate and decapsulate.
• One may ask why we need encapsulation and decapsulation
at each intermediate node.
• The reason is that each link may be using a different
protocol with a different frame format.
• Even if one link and the next are using the same protocol,
encapsulation and decapsulation are needed because the
link-layer addresses are normally different
12/22/2024 Prepared By Tsegaye A. 305
Cont’d
• Assume a person needs to travel from her home to her friend’s home in
another city.
• The traveller can use three transportation tools.
• She can take a taxi to go to the train station in her own city, then travel
on the train from her own city to the city where her friend lives, and
finally reach her friend’s home using another taxi.
• Here we have a source node, a destination node, and two intermediate
nodes.
• The traveller needs to get into the taxi at the source node, get out of
the taxi and get into the train at the first intermediate node (train station
in the city where she lives), get out of the train and get into another taxi
at the second intermediate node (train station in the city where her friend
lives), and finally get out of the taxi when she arrives at her destination.
12/22/2024 Prepared By Tsegaye A. 306
Framing
• Definitely, the first service provided by the data-link layer
is framing.
• The data-link layer at each node needs to encapsulate the
datagram (packet received from the network layer) in a
frame before sending it to the next node.
• The node also needs to decapsulate the datagram from
the frame received on the logical channel.
• Although we have shown only a header for a frame, that a
frame may have both a header and a trailer.
• Different data-link layers have different formats for
framing.
12/22/2024 Prepared By Tsegaye A. 307
Flow Control
• Whenever we have a producer and a consumer, we need to think
about flow control.
• If the producer produces items that cannot be consumed,
accumulation of items occurs.
• The sending data-link layer at the end of a link is a producer of
frames; the receiving data-link layer at the other end of a link is a
consumer.
• If the rate of produced frames is higher than the rate of
consumed frames, frames at the receiving end need to be buffered
while waiting to be consumed (processed).
• Definitely, we cannot have an unlimited buffer size at the receiving
side.

12/22/2024 Prepared By Tsegaye A. 308


Error Control
• At the sending node, a frame in a data-link layer needs to be
changed to bits, transformed to electromagnetic signals, and
transmitted through the transmission media.
• At the receiving node, electromagnetic signals are received,
transformed to bits, and put together to create a frame.
• Since electromagnetic signals are susceptible to error, a frame
is susceptible to error.
• The error needs first to be detected. After detection, it needs
to be either corrected at the receiver node or discarded and
retransmitted by the sending node.
• Since error detection and correction is an issue in every layer
(node-to-node or host-to-host). 309
12/22/2024 Prepared By Tsegaye A.
Congestion Control
• Although a link may be congested with
frames, which may result in frame loss, most
data-link-layer protocols do not directly use a
congestion control to alleviate congestion,
although some wide-area networks do.
• In general, congestion control is considered
an issue in the network layer or the transport
layer because of its end-to-end nature.

12/22/2024 Prepared By Tsegaye A. 310


Two Categories of Links
• Although two nodes are physically connected by a
transmission medium such as cable or air, we need to
remember that the data-link layer controls how the
medium is used.
• We can have a data-link layer that uses the

.
• In other words, we can have a point-to-point link or a
broadcast link. In a point-to-point link, the link is
dedicated to the two devices; in a broadcast link, the link
is shared between several pairs of devices.
12/22/2024 Prepared By Tsegaye A. 311
Two Sublayers
• To better understand the functionality of and the services
provided by the link layer, we can divide the data-link layer
into two sublayers:
1. data link control (DLC) and

2. media access control (MAC).


deals with all issues common
to both point-to-point and broadcast links;
deals only with issues
specific to broadcast links.
• In other words, we separate these two types of links at the
data-link layer, as shown in Figure 5.3.
12/22/2024 Prepared By Tsegaye A. 312
Cont’d

Dividing the data-link layer into two sublayers

12/22/2024 Prepared By Tsegaye A. 313


LINK-LAYER
ADDRESSING
• In IP addresses as the identifiers at the network layer that define
the exact points in the Internet where the source and destination
hosts are connected.
• However, in a connectionless internetwork such as the Internet
we cannot make a datagram reach its destination using only IP
addresses.
• The reason is that each datagram in the Internet, from the same
source host to the same destination host, may take a different path.
• The source and destination IP addresses define the two ends but
cannot define which links the datagram should pass through.

12/22/2024 Prepared By Tsegaye A. 314


Cont’d
• We need to remember that the IP addresses in a datagram
should not be changed.
• If the destination IP address in a datagram changes, the
packet never reaches its destination; if the source IP address
in a datagram changes, the destination host or a router can
never communicate with the source if a response needs to be
sent back or an error needs to be reported back to the source.
• we need another addressing mechanism in a connectionless
internetwork: the link-layer addresses of the two nodes.
• A link-layer address is sometimes called ,
sometimes a , and some times
. We use these terms interchangeably.
12/22/2024 Prepared By Tsegaye A. 315
IP addresses and link-layer addresses in a small
internet

12/22/2024 Prepared By Tsegaye A. 316


Three Types of addresses
Some link-layer protocols define three types of addresses: unicast,
multicast, and broadcast.
Unicast Address
• Each host or each interface of a router is assigned a unicast address.
Unicasting means one-to-one communication. A frame with a unicast
address destination is destined only for one entity in the link.
Multicast Address
• Some link-layer protocols define multicast addresses. Multicasting
means one-to-many communication. However, the jurisdiction is local
(inside the link).
Broadcast Address
• Some link-layer protocols define a broadcast address. Broadcasting
means one-to-all communication. A frame with a destination broadcast
address is sent to all entities in the link.

12/22/2024 Prepared By Tsegaye A. 317


Address Resolution Protocol
(ARP)
• Anytime a node has an IP datagram to send to another node in a
link, it has the IP address of the receiving node.
• The source host knows the IP address of the default router.
• Each router except the last one in the path gets the IP address of
the next router by using its forwarding table.
• The last router knows the IP address of the destination host.
• However, the IP address of the next node is not helpful in
moving a frame through a link; we need the link-layer address of
the next node.
• This is the time when the Address Resolution Protocol (ARP)
becomes helpful. The ARP protocol is one of the auxiliary
protocols defined in the network layer, as shown in Figure 9.6.
12/22/2024 Prepared By Tsegaye A. 318
Cont’d

12/22/2024 Prepared By Tsegaye A. 319


Cont’d
• Anytime a host or a router needs to find the link-
layer address of another host or router in its
network, it sends an ARP request packet.
• The packet includes the link-layer and IP
addresses of the sender and the IP address of
the receiver.
• Because the sender does not know the link-layer
address of the receiver, the query is broadcast
over the link using the link-layer broadcast
address,
12/22/2024
(see Figure 5.5).
Prepared By Tsegaye A. 320
ARP operation

12/22/2024 Prepared By Tsegaye A. 321


Error Detection and Correction
Types of Errors
Whenever bits flow from one point to another, they are
subject to unpredictable changes because of interference.
This interference can change the shape of the signal.
The term single-bit error means that only 1 bit of a given
data unit (such as a byte, character, or packet) is changed
from 1 to 0 or from 0 to 1.
The term means that 2 or more bits in the data
unit have changed from 1 to 0 or from 0 to 1.
Figure 5.7 shows the effect of a single-bit and a burst
error on a data unit. Prepared By Tsegaye A.
12/22/2024 322
Single-bit and burst error

12/22/2024 Prepared By Tsegaye A. 323


Cont’d
• A burst error is more likely to occur than a single-bit
error because the duration of the noise signal is
normally longer than the duration of 1 bit, which
means that when noise affects data, it affects a set of
bits.
• The number of bits affected depends on the data rate
and duration of noise.
• For example, if we are sending data at 1 kbps, a noise
of 1/100 second can affect 10 bits; if we are sending
data at 1 Mbps, the same noise can affect 10,000 bits.

12/22/2024 Prepared By Tsegaye A. 324


Redundancy
• The central concept in detecting or correcting errors
is redundancy.
• To be able to detect or correct errors, we need to send
some extra bits with our data.
• These redundant bits are added by the sender and
removed by the receiver.
• Their presence allows the receiver to detect or correct
corrupted bits.

12/22/2024 Prepared By Tsegaye A. 325


Detection versus
Correction
• The correction of errors is more difficult than the detection.
• In error detection, we are only looking to see if any error has
occurred. The answer is a simple yes or no.
• We are not even interested in the number of corrupted bits.
• A single-bit error is the same for us as a burst error.
• In error correction, we need to know the exact number of bits
that are corrupted and, more importantly, their location in the
message. The number of errors and the size of the message
are important factors.

12/22/2024 Prepared By Tsegaye A. 326


Data Link Control
SERVICES
• The data link control (DLC) deals with procedures for
communication between two adjacent nodes node-to-
node communication no matter whether the link is
dedicated or broadcast.
• Data link control functions include
.
Framing
• Data transmission in the physical layer means moving
bits in the form of a signal from the source to the
destination.
• The physical layer provides bit synchronization to ensure
that the sender and receiver use the same bit durations
and timing.
12/22/2024 Prepared By Tsegaye A. 327
Cont’d
• The data-link layer, on the other hand, needs to
pack bits into frames, so that each frame is
distinguishable from another.
• Our postal system practices a type of framing.
• The simple act of inserting a letter into an
envelope separates one piece of information from
another; the envelope serves as the delimiter.
• In addition, each envelope defines the sender and
receiver addresses, which is necessary since the
postal system is a many-to-many carrier facility.
12/22/2024 328
Prepared By Tsegaye A.
Cont’d
• Framing in the data-link layer separates a message from one
source to a destination by adding a sender address and a
destination address.
• The destination address defines where the packet is to go; the
sender address helps the recipient acknowledge the receipt.
• Although the whole message could be packed in one frame, that is
not normally done.
• One reason is that a frame can be very large, making flow and
error control very inefficient.
• When a message is carried in one very large frame, even a single-
bit error would require the retransmission of the whole frame.
When a message is divided into smaller frames, a single-bit error
329
affects only that small frame. Prepared By Tsegaye A.
Frame Size
• Frames can be of fixed or variable size.
• In fixed-size framing, there is no need for defining the
boundaries of the frames; the size itself can be used as a
delimiter.
• An example of this type of framing is the ATM WAN,
which uses frames of fixed size called cells.
• In variable-size framing, we need a way to define the end
of one frame and the beginning of the next.
• Historically, two approaches were used for this purpose: a
character-oriented approach and a bit-oriented
approach.
12/22/2024 Prepared By Tsegaye A. 330
Character-Oriented
Framing
• In character-oriented (or byte-oriented) framing, data to be
carried are 8-bit characters from a coding system such as
ASCII.
• The header, which normally carries the source and destination
addresses and other control information, and the trailer, which
carries error detection redundant bits, are also multiples of 8
bits.
• To separate one frame from the next, an 8-bit (1-byte) flag is
added at the beginning and the end of a frame.
• The flag, composed of protocol-dependent special characters,
signals the start or end of a frame

331
12/22/2024 Prepared By Tsegaye A.
Bit-Oriented Framing
• In bit-oriented framing, the data section of a frame is a sequence of
bits to be interpreted by the upper layer as text, graphic, audio, video,
and so on.
• However, in addition to headers (and possible trailers), we still need a
delimiter to separate one frame from the other. Most protocols use a
special 8-bit pattern flag, 01111110, as the delimiter to define the
beginning and the end of the frame.

12/22/2024 Prepared By Tsegaye A. 332


DATA-LINK LAYER
PROTOCOLS
Traditionally four protocols have been defined for the data-link layer
to deal with : Simple, Stop-and-Wait,
Go-Back-N, and Selective-Repeat.
Although the first two protocols still are used at the data-link layer, the last two have
disappeared.
❖ The behavior of a data-link-layer protocol can be better shown as a finite state machine
(FSM).
❖ An FSM is thought of as a machine with a finite number of states.
❖ The machine is always in one of the states until an event occurs.
❖ Each event is associated with two reactions:
and

12/22/2024 Prepared By Tsegaye A. 333


Cont’d
• One of the states must be defined as the initial state, the state
in which the machine starts when it turns on.
• In Figure 5.8, we show an example of a machine using FSM.
• We have used rounded-corner rectangles to show states,
colored text to show events, and regular black text to show
actions.
• A horizontal line is used to separate the event from the
actions, although later we replace the horizontal line with a
slash.
• The arrow shows the movement to the next state.
• The figure shows a machine with three states.
• There are only three possible events and three possible
actions.
12/22/2024 Prepared By Tsegaye A. 334
Connectionless and connection-oriented service represented as
FSMs

12/22/2024 Prepared By Tsegaye A. 335


Simple Protocol

• Our first protocol is a simple protocol with neither flow nor error
control.
• We assume that the receiver can immediately handle any frame it
receives.
• In other words, the receiver can never be overwhelmed with incoming
frames. Figure 5.10 shows the layout for this protocol.

12/22/2024 Prepared By Tsegaye A. 336


Stop-and-Wait Protocol
• Our second protocol is called the Stop-and-Wait protocol, which
uses both flow and error control.
• We show a primitive version of this protocol here. In this protocol,
the sender sends one frame at a time and waits for an
acknowledgment before sending the next one.
• To detect corrupted frames, we need to add a cyclic redundancy
check (CRC) to each data frame.
• When a frame arrives at the receiver site, it is checked. If its CRC
is incorrect, the frame is corrupted and silently discarded.
• The silence of the receiver is a signal for the sender that a frame
was either corrupted or lost.
• Every time the sender sends a frame, it starts a timer. If an
acknowledgment arrives before the timer expires, the timer is
stopped and the sender sends the next frame (if it has one to send).
12/22/2024 Prepared By Tsegaye A. 337
Stop and Wait potocol

12/22/2024 Prepared By Tsegaye A. 338


Link Control Protocol

• The Link Control Protocol (LCP) is responsible for


establishing, maintaining, configuring, and terminating links.
• It also provides negotiation mechanisms to set options between
the two endpoints.
• Both endpoints of the link must reach an agreement about the
options before the link can be established.

12/22/2024 Prepared By Tsegaye A. 339


Media Access Control (MAC)
• When nodes or stations are connected and use a common link, called
a multipoint or broadcast link, we need a multiple-access protocol to
coordinate access to the link.
• The problem of controlling the access to the medium is similar to
the rules of speaking in an assembly.
• The procedures guarantee that the right to speak is upheld and
ensure that two people do not speak at the same time, do not
interrupt each other, do not monopolize the discussion, and so on.
• Many protocols have been devised to handle access to a shared link.
• All of these protocols belong to a sublayer in the data-link layer
called media access control (MAC).

12/22/2024 Prepared By Tsegaye A. 340


Taxonomy of multiple-access
protocols

12/22/2024 Prepared By Tsegaye A. 341


RANDOM ACCESS
• In random-access or contention methods, no station is
superior to another station and none is assigned control over
another.
• At each instance, a station that has data to send uses a
procedure defined by the protocol to make a decision on
whether or not to send.
• This decision depends on the state of the medium (idle or
busy).
• In other words, each station can transmit when it desires on
the condition that it follows the predefined procedure,
including testing the state of the medium.
• In a random-access method, each station has the right to the
12/22/2024 Prepared By Tsegaye A. 342
medium without being controlled by any other station.
Cont’d
• To avoid access conflict or to resolve it when it happens,
each station follows a procedure that answers the following
questions:
❑ When can the station access the medium?

❑ What can the station do if the medium is busy?

❑ How can the station determine the success or


failure of the transmission?

❑ What can the station do if there is an access


conflict?
12/22/2024 Prepared By Tsegaye A. 343
Physical Layer
• one of the major functions of the physical layer is to move data
in the form of electromagnetic signals across a transmission
medium.
• Whether you are collecting numerical statistics from another
computer, sending animated pictures from a design
workstation, or causing a bell to ring at a distant control
center, you are working with the transmission of data across
network connections.
• Generally, the data usable to a person or application are not in a
form that can be transmitted over a network.
• For example, a photograph must first be changed to a form that
transmission media can accept. Transmission media work by
conducting energy along a physical path. For transmission,
data needs to be changed
12/22/2024 to signals.
Prepared By Tsegaye A. 344
DIGITAL SIGNALS
• In addition to being represented by an analog signal,
information can also be represented by a digital signal.
For example, a 1 can be encoded as a positive voltage and a
0 as zero voltage.
• A digital signal can have more than two levels. In this
case, we can send more than 1 bit for each level.
• Figure 5.15 shows two signals, one with two levels and
the other with four.
• In general, if a signal has L levels, each level needs log2
L bits.
• 12/22/2024
For this reason, we can send log2 4
Prepared By Tsegaye A. = 2 bits in part b 345
Two digital signals: one with two signal levels and the other with four signal levels

12/22/2024 Prepared By Tsegaye A. 346


Cont’d
Bit Rate
• Most digital signals are non-periodic, and thus period and frequency
are not appropriate characteristics. Another term—bit rate (instead
of frequency)—is used to describe digital signals. The bit rate is the
number of bits sent in 1s, expressed in bits per second (bps).
Bit Length
• We discussed the concept of the wavelength for an analog signal: the
distance one cycle occupies on the transmission medium. We can
define something similar for a digital signal: the bit length. The bit
length is the distance one bit occupies on the transmission medium.

12/22/2024 Prepared By Tsegaye A. 347


DATA RATE LIMITS
▪ A very important consideration in data communications
is how fast we can send data, in bits per second, over a
channel.
✓ Data rate depends on three factors:
1. The bandwidth available
2. The level of the signals we use
3. The quality of the channel (the level of noise)
• Two theoretical formulas were developed to calculate the
data rate: one by Nyquist for a noiseless channel, another
by Shannon for a noisy channel.
12/22/2024 Prepared By Tsegaye A. 348
Ethernet
• A local area network (LAN) is a computer network that is
designed for a limited geographic area such as a building
or a campus.

• Although a LAN can be used as an isolated network to


connect computers in an organization for the sole
purpose of sharing resources, most LANs today are also
linked to a wide area network (WAN) or the Internet.

• 12/22/2024
The LAN market hasPrepared
seenByseveral
Tsegaye A.
technologies such as
349
PERFORMANCE
• we have discussed the tools of transmitting data (signals) over a
network and how the data behave.
• One important issue in networking is the performance of the network—
how good is it?
Bandwidth
• One characteristic that measures network performance is bandwidth.
However, the term can be used in two different contexts with two
different measuring values: bandwidth in hertz and bandwidth in bits
per second.
Bandwidth in Hertz
• Bandwidth in hertz is the range of frequencies contained in a composite
signal or the range of frequencies a channel can pass. For example, we
can say the bandwidth of a subscriber telephone line is 4 kHz.

12/22/2024 Prepared By Tsegaye A. 350


Cont’d
Bandwidth in Bits per Seconds
• The term bandwidth can also refer to the number of bits
per second that a channel, a link, or even a network can
transmit.

• For example, one can say the bandwidth of a Fast


Ethernet network (or the links in this network) is a
maximum of 100 Mbps. This means that this network
can send 100 Mbps.
12/22/2024 Prepared By Tsegaye A. 351
Relationship
• There is an explicit relationship between the bandwidth
in hertz and bandwidth in bits per second.
• Basically, an increase in bandwidth in hertz means an
increase in bandwidth in bits per second.
• The relationship depends on whether we have baseband
transmission or transmission with modulation.
• In networking, we use the term bandwidth in two
contexts.
❑ The first, bandwidth in hertz, refers to the range of
frequencies in a composite signal or the range of
frequencies that a channel can pass.
❑ The second, bandwidth in bits per second, refers to the
12/22/2024 Prepared By Tsegaye A. 352
speed of bit transmission in a channel or link.
Cont’d
Throughput
• The throughput is a measure of how fast we can actually
send data through a network.
• Although, at first glance, bandwidth in bits per second
and throughput seem the same, they are different.
• A link may have a bandwidth of B bps, but we can only
send T bps through this link with T always less than B.
• In other words, the bandwidth is a potential
measurement of a link; the throughput is an actual
measurement of how fast we can send data.

12/22/2024 Prepared By Tsegaye A. 353


Cont’d
Latency (Delay)
• The latency or delay defines how long it takes for an
entire message to completely arrive at the destination
from the time the first bit is sent out from the source.

• We can say that latency is made of four components:


propagation time, transmission time, queuing time and
processing delay.

12/22/2024 Prepared By Tsegaye A. 354


Cont’d
Jitter
• Another performance issue that is related to delay is jitter.

• We can roughly say that jitter is a problem if different packets of


data encounter different delays and the application using the data
at the receiver site is time-sensitive (audio and video data, for
example).

• If the delay for the first packet is 20 ms, for the second is 45 ms,
and for the third is 40 ms, then the real-time application that uses
the packets endures jitter.

12/22/2024 Prepared By Tsegaye A. 355


POINT-TO-POINT
PROTOCOL (PPP)
• One of the most common protocols for point-to-point
access is the Point-to-Point Protocol (PPP).
• Today, millions of Internet users who need to connect
their home computers to the server of an Internet service
provider use PPP.
• The majority of these users have a traditional modem;
they are connected to the Internet through a telephone
line, which provides the services of the physical layer.
• But to control and manage the transfer of data, there is a
need for a point-to-point protocol at the data-link layer.
PPP is by far the mostPrepared
12/22/2024 common.
By Tsegaye A. 356
LAN Devices
• Network interface card Printed circuit board usually
installed inside a computer case also called network adapter
Adapts host device to the network Layer 2 device Carries a
unique code called a MAC address.
• Switch is Sometimes called a multi-port bridge. Switches
data from incoming port to outgoing port
• Forwards data only to the appropriate port for the intended
recipient Concentrates connectivity to make data transmission
more efficient and it is Considered as layer 2 device.
• A repeater is a device that operates only in the physical layer.
Signals that carry information within a network can travel a
fixed distance before attenuation endangers the integrity of
the data.
12/22/2024 Prepared By Tsegaye A. 357
Bridges
• A bridge operates in both the physical and the data link layers. As a
physical-layer device, it regenerates the signal it receives.
• As a data link layer device, the bridge can check the MAC addresses
(source and destination) contained in the frame.
Two-Layer Switch
• When we use the term switch, we must be careful because a switch
can mean two different things. We can have a two-layer switch or a
three-layer switch. A two-layer switch performs at the physical and
data link layer; it is a sophisticated bridge with faster forwarding
capability.
Three-Layer Switch
• A three-layer switch is a router; a router with an improved design to
allow better performance.
• A three-layer switch can receive, process, and dispatch a packet much
faster than a traditional router even though the functionality is the
same. To avoid confusion, we use the term router for a three-layer
12/22/2024 Prepared By Tsegaye A. 358
switch.
Router
• A router is a three-layer device; it operates in the
physical, data link, and network layers. As a physical
layer device, it regenerates the signal it receives.
• As a data link layer device, the router checks the
physical addresses (source and destination) contained
in the packet.
• As a network layer device, a router checks the
network layer addresses (addresses in the IP layer).
• Note that bridges change collision domains, but
routers limit broadcast domains.
12/22/2024 Prepared By Tsegaye A. 359
Routing example

12/22/2024 Prepared By Tsegaye A. 360

You might also like