Professional Documents
Culture Documents
5.1. OSI Model Part I
5.1. OSI Model Part I
1
Outline of the lecture
2
Layered frame work of OSI
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
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
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
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
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
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
25
Flow Control Protocols: Sliding Window Flow Control
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
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
31
Error Control: Sliding Window protocols
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)
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
46
See Journey of a Packet in Network >> play
47
Internetworking
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
51
Network layer protocols
52