Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 52

Chapter Five-OSI Reference Model

Overview & functions of each Layer

1
Outline of the lecture

🞂Layered Framework of OSI 🞂OSI Upper layers


🞂Overview & functions of each layer
◻Transport layer
🞂OSI lower layers
◻Packetizing
◻Physical layer
◻Data link layer ◻Addressing
◻Framing
◻Multiplexingand Demultiplexing
◻Addressing
◻Error
◻Connection control
detection and correction
◻Data link control and protocol ◻Sessionlayer
🞂Flow control
🞂Error control
◻Presentation layer
◻Multiple access ◻Application
◻Network Layer ◻Clientserver model
◻Internetworking
◻Packetizing and framing ◻Addressing
◻Addressing
◻Application layers services
◻Network layer protocols

2
Layered frame work of OSI

 Open Systems Interconnection (OSI)


 A theoretical model-not implemented
(reference)
 Developed by International Standards
Organization (ISO)
 Open – to connect open systems
 Contains seven layers (7)

3
OSI Lower Layers

Physical

Data Link

Network
4
OSI Physical Layer
🞂 Responsible for transmission of bits
🞂 The type of interface used on the networking device
🞂 The type of cable used for connecting devices
🞂 The connectors used on each end of the cable
🞂 Layer actually interact to the physical medium
🞂 Signal encoding: 0 and 1 representation
🞂 Transmission type: serial/parallel
🞂 Transmission mode: simplex, duplex, 1/2
🞂 Topology and multiplexing: star, bus, TDM, FDM ?
🞂 Bandwidth: which bandwidth used
🞂 Signal type: analog or digital signal ?
🞂 The encoding of a message on a signal by converting binary digits to a physical
representation based on the media type, such as
🞂 –electrical for copper,
🞂 – light for fiber, or
🞂 –radio wave for wireless
5
OSI Physical Layer

6
Note

The unit of communication at the physical


layer is a bit.

7
OSI Lower Layers

Physical

Data Link

Network
8
OSI Data Link Layer
1. Addressing – Headers and trailers are added, containing the physical addresses of the adjacent
nodes, and removed upon successful delivery.
2. Flow control – This avoids overwriting on the receiver’s buffer by regulating the amount of data
that can be sent.
3. Media Access Control (MAC) – In LANs, it decides who can send data, when and how much.

9
OSI Data Link Layer
4.Synchronization – Headers have bits, which tell the receiver
when a frame is arriving. It also contains bits to synchronize its
timing to know the bit interval to recognize the bit correctly. Trailers
mark the end of a frame, apart from containing the error
control bits.
5.Error control – It checks the CRC to ensure the correctness of the
frame. If incorrect, it asks for retransmission. Again multiple
schemes (positive acknowledgement, negative acknowledgement, go-
back-n, sliding window, etc.) exist here.
6.Node to node delivery – Finally, it is responsible for error-free
delivery of the entire frame/
packet to the next adjacent node (node-to-node delivery).

10
Communication at the data link layer

11
Note

The unit of communication at the data link


layer is a frame.

12
Framing

🞂Data-link layer takes packets from Network Layer and encapsulates them into Frames.
🞂Then, it sends each frame bit-by-bit on the physical layer.
🞂At receiver’ end, data link layer picks up signals from physical layer and assembles
them into frames.

13
Addressing
🞂Data-link layer provides layer-2 hardware addressing mechanism.
🞂Hardware address is assumed to be unique on the link. It is encoded into hardware at
the time of manufacturing.
🞂Hardware address is a 6-byte(48 bits) physical address (or MAC- Media Access
Control address) in hexadecimal;
🞂written as 12 hexadecimal digits; every byte (2 hexadecimal digits) is separated by a
colon, as shown below:
🞂Hardware address or a NIC’s address is permanent – a LAN address is burned into its
ROM during manufacturing

14
 It may have different format for window and linux dote and minus
🞂 Unicast, Multicast, and Broadcast addresses: a source address is always a unicast address; the
destination address can be unicast (only one destination), multicast (multiple destinations), or broadcast
(all the stations on the network 48 1s)
🞂 Hexadecimal (0-9 A-F)
🞂 MAC address is mounted on a NIC if you a computer, switch, router have more than one interface/NIC
they need separate MAC address

15
Error Detection and Correction

🞂mainly a data link layer function


🞂networks must be able to transfer data from one
device to another with complete accuracy - our wish
🞂data can be corrupted during transmission - many
factors exist - like transmission impairments
🞂hence, reliable systems must have a mechanism for
detecting and correcting errors
🞂two types of errors: single-bit and burst
🞂single-bit error: only one bit in a data unit (byte,
character, packet, ...) has changed;
🞂while Burst is occurred when more bit are affected

16 16
 Transmission impairment includes noise , attenuation, distortion
 Single bit error: less likely to occur in serial transmission (since noise
normally lasts longer than the transmission time of 1 bit, e.g. 1
microsecond if speed is 1 Mbps), but most likely to occur in parallel
transmission
 A burst error is more likely to occur than a single-bit error b/c usually
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.
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.

17
Error Detection and Correction cont’d
🞂Two types of error-detecting codes: parity and CRC
🞂parity check: most common and simple; two varieties

single parity check 2-D parity check:

• Can also detect (but not correct) any combination of


two errors in a packet
❖detect single bit errors

18
•Checksum is not implemented in data link layer

•A parity-check code can detect an odd number of errors. cannot detect an even number of errors.
The errors cancel each other out and give the syndrome a value of 0.
❑Single Parity check
•d bits of data plus 1 parity bit (total d+1 bits) are sent
•Number of 1’s in the d+1 bits is even (even parity) or odd (odd parity)
•At the receiver, the number of 1’s in the d+1 bit data should be even (even parity) or odd (odd
parity). Else, error in data.
•Any odd number but not even of bit errors can be detected
•The code is a single-bit/odd bit error-detecting code and Cannot correct errors
•2-D parity Check
•Data arranged in 2-D
•Parity bits added to each row and column
•At the receiver, parities are checked
•Can detect and correct single parity errors ?????
•Can also detect (but not correct) any combination of two errors in a packet

19
Cyclic Redundancy Check

20
🞂Assume d bits of data are sent and n bit of codeword then add (n-d) 0’s to data
word at the right side
🞂n-d+1 is the length of the Devisor
🞂For example: assume a data word block is 4 bit 1001 and codeword is 7 bit long,
then we have
🞂7-4=3 0’s on data word as 1001000
🞂Length of the devisor will be 7-4+1=4
🞂sender and receiver must first choose and agree on the devisor before sending
the data

🞂Example
Suppose D = 1001, divisor = 1011 and number of 0’s appended on the data word is 3(one bit
less than divisor)).
🞂perform division (the devisor length is 7-4+1= 4 and this is agreed on both sides)
🞂Codeword is Data word + remainder (ignore the quotient ) and sender will send codeword to
the receiver,
🞂and the receiver will divide codeword with the devisor if the remainder is 0 then there is no
error, but if other than 0 there is error discard the dataword
21
Error correction

error correction by retransmission:


• when an error is detected, the receiver will tell the sender to
retransmit the entire data unit; see next: Data Link Control

forward error correction:


• the receiver can use an error-correcting code to correct certain
errors;
• the hamming code is used to detect and correct errors; you can read
more if you are planning to implement error correction
22
Flow Control
🞂refers to a set of procedures used to restrict the amount of data that the sender can
send before receiving an acknowledgement
🞂A technique for speed-matching of transmitter and receiver

23 23
for reliable data delivery across the link, the data link layer has two most important
responsibilities: flow control and error control, collectively known as data link
control

Flow control: deals with problem that sender transmits frames faster than receiver
can accept, and solution is to limit sender into sending no faster
than receiver can handle

If the speaker speaks too fast, the listener says Go slow or Please wait if
s/he is taking down. In the world of computers, if the receiving computer is
not fast enough, or if its memory buffer is full, which cannot hold any further
data, it has to request the sender to wait. This is called flow control.

24
Flow Control Protocols: Stop-and-Wait Flow Control

🞂sender sends one frame, stops until it receives


confirmation from the receiver and then sends
the next frame.
🞂only one frame can be transmitted at a time ⇒
Inefficiency
🞂 Two flow control protocols are known: stop and wait and sliding
window
🞂 Ack0 frame 0 received next frame 1 required
Sequence number uses only one bit(0,1) b/c the number of frame on
buffer at time to be sent and received is only one so it is enough

25
Flow Control Protocols: Sliding Window Flow Control

🞂sender can transmit several frames


continuously before needing an
acknowledgement (ACK)
🞂Each frame is numbered with k-bit
sequence number, allowing for 2k
sequence numbers
🞂Each frame’s number is 1 greater than
the previous frame and
🞂 each ACK’s number is the number of
the next frame expected by the receiver

26
Error Control
🞂 refers to both error detection and error correction
🞂 in the data link layer, error control refers primarily to methods of error detection and
retransmission
🞂 anytime an error is detected, specified frames are retransmitted; this process is called
automatic repeat request (ARQ)
Requirements for error control mechanism:
 Error detection  - The sender and receiver, either both or any, must ascertain that there
is some error in the transit.
 Positive ACK  - When the receiver receives a correct frame, it should acknowledge it.
 Negative ACK  - When the receiver receives a damaged frame or a duplicate frame, it
sends a NACK back to the sender and the sender must retransmit the correct frame.
 Retransmission:  The sender maintains a clock and sets a timeout period. If an
acknowledgement of a data-frame previously transmitted does not arrive before the
timeout the sender retransmits the frame, thinking that the frame or it’s acknowledgement
is lost in transit.

27
Error Control: Stop-and-Wait ARQ

Normal operation Lost or damaged frame Lost ACK frame

28
Stop-and-Wait ARQ
 Stop and wait for avoiding duplication it uses one bit Sequence number. implies receiver have buffer
for one frame
 ACK0: frame 1 is received, waiting for next (frame 0) ACK1: frame 0 is received, waiting for next
(frame 1)
 To detect corrupted frames, we need to add a CRC to each data frame. At receiver if incorrect CRC
received then frame will be discarded
The following transition may occur in Stop-and-Wait ARQ:
• If error is detected by receiver, it discards the frame and wait, causing sender to re-send the frame
• In case a frame never got to receiver, sender has a timer: each time a frame is sent, timer is set
• → If no ACK is received during timeout period, it re-sends the frame
• Timer introduces a problem: Suppose timeout and sender retransmits a frame but receiver actually
received the previous transmission → receiver has duplicated copies
• To avoid receiving and accepting two copies of same frame, frames and ACKs are alternatively
labeled 0 or 1: ACK0 for frame 1, ACK1 for frame 0

29
Stop-and-Wait ARQ Cases of Operations:
Normal operation
 The sender will not send the next frame until it is sure that the
current one is correctly received
 sequence number is necessary to check for duplicated frames
The frame is lost
 A damage or lost frame treated by the same manner by the receiver.
 No NACK when frame is corrupted / duplicate
 The Acknowledgment (ACK) is lost
 Importance of frame numbering
The Ack is delayed

30
Error Control: Stop-and-Wait ARQ (Cont’d)
 When the acknowledgement is received, the sender sits idle and does nothing.
 In Go-Back-N ARQ method, both sender and receiver maintain a window.
Stop-and-Wait ARQ efficiency
After each frame sent the host must wait for an ACK
❖inefficient use of bandwidth

To improve efficiency ACK should be sent after multiple frames

Alternatives: Sliding Window protocol


✔ Go-back-N ARQ
✔ Selective Repeat ARQ

31
Error Control: Sliding Window protocols

a.Go-Back-N-ARQ b. Selective Repeat ARQ


32
Sliding Window Protocols
 Half duplex for sending cont fames, half for receiving ack at sender

 Half duplex for sending ack, half for receiving frame at receiver side
 Stop-and-wait ARQ is not efficient; there is only one frame that is sent.
can we transmit multiple frames while waiting for an ack?
 use full-duplex transmission
 two protocols: Go-Back-N ARQ and Selective Repeat ARQ. both
methods require frames to be numbered
sequence numbers
▪ frames from a sending station are numbered sequentially from 0 to
2m-1, where m is the number of bits of the sequence number in the
frame header
▪ e.g., let m = 3, then frames can be numbered as
0, 1, 2, 3 ,4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, …
33
a)Go-Back-N-ARQ
 Here it is assumed that the buffer can contain one window, a set of frame alike stop and Waite which is
only one bit
The basic idea of go-back-n error control is: If frame i is damaged, receiver requests retransmission of all
frames starting from frame i.
the sender and receiver have sliding windows. the sender’s window is of fixed size and is at most 2 m-1; but
other protocols such as TCP allow variable size windows, the receiver’s window is of size 1
The sending-window size enables the sender to send multiple frames without receiving the
acknowledgement of the previous ones
The receiving-window enables the receiver to receive multiple frames and acknowledge them. The receiver
keeps track of incoming frame’s sequence number.
When the sender sends all the frames in window, it checks up to what sequence number it has received
positive acknowledgement. If all frames are positively acknowledged, the sender sends next set of frames.
If sender has not receive any ACK for a particular frame, it retransmits all the frames after which it does not
receive any positive ACK. the receiver does not need to acknowledge frames individually
34
b. Selective Repeat ARQ
• in GO-Back-N ARQ, the task of the receiver is simplified; no need
to buffer out-of-order frames; they are simply discarded
• this protocol is inefficient for a noisy link that has a high
probability of damage resulting in the resending of multiple frames
• for a noisy link, use Selective Repeat ARQ that requires resending
only the damaged frame
• Selective Repeat ARQ defines a negative ack (NAK) that reports the
sequence number of a damaged frame before the timer expires
• the receiver's window defines the range of acceptable sequence
numbers, i.e., frames may arrive out of order
• The sender in this case, sends only packet for which NACK is received.
In Go-back-N ARQ, it is assumed that the receiver does not have any buffer space for its
window size and has to process each frame as it comes. This enforces the sender to
retransmit all the frames which are not acknowledged.
the sender and receiver windows are both at most half of 2m
35
Multi-Access

🞂
When host on the shared link tries to transfer the data, it has a high probability of collision.
🞂Data-link layer provides random access mechanism such as CSMA/CD and CSMA/CA to
equip capability of accessing a shared media among multiple Systems.
🞂There are other multiple access protocols such as
🞂Controlled-Access Protocols - get permission
🞂Reservation
🞂Polling
🞂Token Passing Reading(Try your best to understand each)
🞂 Channelization Protocols - simultaneous use
🞂FDMA - Frequency-Division MA
🞂TDMA - Time-Division MA
🞂CDMA - Code-Division MA
36 36
MAC
how a network host can get access to the shared medium.
Carrier Sense Multiple Access (CSMA)
Protocols that listen for a carrier and act accordingly are called carrier sense protocols.
CSMA is based on the principle “sense before transmit” or “listen before talk.”
Carrier sensing allows the station to detect whether the medium is currently being
used. Schemes that use a carrier sense circuits are classed together as carrier sense
multiple access or CSMA schemes.
There are two variants of CSMA.
CSMA/CD and
CSMA/CA
The simplest CSMA scheme is for a station to sense the medium, sending
packets immediately if the medium is idle.
37
Carrier Sense Multiple Access with Collision Detection (CSMA/CD)

🞂Carrier Sense Multiple Access/Collision Detection is a technique for multiple


access protocols.
🞂If no transmission is taking place at the time, the particular station can transmit.
🞂If two stations attempt to transmit simultaneously, this causes a collision, which is
detected by all participating stations. The devices will wait for random amount of
time.(Back off)
🞂After a random time interval, the stations that collided attempt to transmit again.
🞂If another collision occurs, the time intervals from which the random waiting time
is selected are increased step by step. This is known as exponential back off.
🞂Specially designed for ethernet not for Wi-Fi due to
❑ Collision detection is difficult for Wi-Fi network due to limited radio range and
hidden node problem

38
CSMA/CA

NB: Both RTS & CTS frame includes the duration of time that source needs to occupy the channel-transfer duration
NAV(network animation vector): a period the other station should wait before starting checking for channel idleness

39
was invented for wireless networks.
1. Before sending a frame, the source station senses the medium by checking the energy level at the
carrier frequency.
a) The channel uses a back-off until the channel is idle.
b) After the station is found to be idle, the station waits for a period of time called the DCF
interframe space (DIFS);then the station sends a control frame called the request to send (RTS).
2. After receiving the RTS and waiting a period of time called the short interframe space (SIFS),the
destination station sends a control frame, called the clear to send (CTS),to the source station. This
control frame indicates that the destination station is ready to receive data.
3. The source station sends data after waiting an amount of time equal to SIFS.
4. The destination station, after waiting an amount of time equal to SIFS, sends an acknowledgment
to show that the frame has been received.
5. Acknowledgment is needed in this protocol because the station does not have any means to check
for the successful arrival of its data at the destination. On the other hand, the lack of collision in
CSMA/CD is a kind of indication to the source that data have arrived.

40
OSI Lower Layers

Physical

Data Link

Network
41
OSI Network Layer
🞂 A key design issue is determining how packets are routed from source to
destination🡪 routing
🞂 path determination
🞂 Routes can be based on static tables that are ''wired into'' the network and rarely
changed, and can be highly dynamic, being determined a new for each packet
🞂 When two network connected for communication:
🞂 There may be addressing difference
🞂 Protocol difference
🞂 Packet size of each can be different
🞂 It is up to the network layer to overcome all these problems to allow
heterogeneous networks to be interconnected.

42
Why it is responsible to end to end without considering router?
Ans: Router will not touch(rewrite) L3 packet but see or learn or analyze the IP address, but It changes
the MAC address
Encapsulation and decapsulation done in only L3 and source and destination devices
Call setup (for some architectures like ATM)

Routing: making a decision and choosing one route whenever there are multiple routes
based on some criteria; how do you choose a route when you drive? may be the condition of your car
and the road, the shortest one, the one that is not congested, the one with less traffic lights, avoid
forbidden paths (American military packets may not pass through Russia), ...

43
Network Layer has 4 basic functions:

🞂Internetworking
🞂Addressing
🞂Packetizing
🞂Fragmentation
🞂Routing
🞂Main functions of routers (network layer devices)
🞂Routing (Path determination): selecting best path b/n end devices
🞂Routing protocols(RIP, OSPF, BGP)
🞂Forwarding: move packets from router’s input to appropriate router output

44
L2 switch doesn’t do any encapsulation and decapsulation

45
Note

The unit of communication at the network


layer is a datagram

46
See Journey of a Packet in Network >> play

47
Internetworking

▪ internetworking refers to the logical gluing of heterogeneous physical networks together


to look like a single network to the upper transport and application layers

▪ the above internetwork is made up of 5 networks: 4 LANs and 1 WAN


▪ Si: switch or router; fi: interface
▪ data sent from A to D passes through 3 links
▪ nomenclature:
▪ the source and the destinations are usually referred to as hosts
▪ a host or a router is referred to as a hop
48
Packetizing and Fragmenting

Packetizing:
• encapsulates packets received from upper-layer protocols and makes new packets out of
them; done by the IP protocol in the Internet model
Fragmenting:
• a datagram can travel through different networks; each router decapsulates the IP datagram
from the received frame, processes it, and then encapsulates it in another frame
• the format and size of the
• received frame depends on the protocol used by the physical network from which the
frame has just arrived
• departing frame depends on the protocol used by the physical network to which the
frame is going

49
Maximum payloads for some common technologies are 1500 bytes for Ethernet and 2272 bytes for
802.11. IP is more
generous, allows for packets as big as 65,515 bytes.
Fragmenting: to break up packets into fragments

Question: if ip supports 65,515 bytes packet size, but ethernet only 1500 bytes how it can be
suited?
Possible answer: https://networkengineering.stackexchange.com/questions/57211/why-maximum-
length-of-ip-tcp-udp-packet-is-not-suit

Other Issues (of Internet that are not directly related to the duties of the network layer)
▪ Address Resolution: the network layer provides only host-to-host addressing whereas the
data link layer needs physical addresses for node-to-node delivery; these addresses must
be mapped; details later in the Address Resolution Protocol
▪ Multicasting and Routing Protocols - covered earlier
50
Addressing

To uniquely and universally identify each device on the internet to allow global
communication between all devices

Analogous to the telephone system; the department of computer science: 251 011
1222922, wherever you are on the globe

Each address belongs to a single host, but a single host can have multiple addresses (if it
has multiple connections to the internet)

The identifier used in the network layer of the internet model is called the internet
address or IP address

It is a 32-bit binary address (in ipv4)

51
Network layer protocols

🞂There are 5 network layer protocols in the TCP/IP


🞂The main protocol is IP, the glue that holds the whole internet together and responsible
for host-to-host delivery
🞂It needs the services of other protocols
🞂ARP (address resolution protocol) - maps an IP address to a MAC address (of the
next hop)
🞂RARP (reverse ARP) - maps a MAC address to an IP address; usually used in some
situations such as when a diskless host is booted; it gets the binary image of its
operating system from a remote file server but does not know its IP address; obsolete,
replaced by DHCP- dynamic host configuration protocol
🞂ICMP (internet control message protocol) - to handle unusual situations such as
the occurrence of an error
🞂IGMP (internet group management protocol) - for multicasting since IP is designed
for unicast delivery;
🞂 Icmp = ping error reporting destination unreachable, timeout etc

52

You might also like