Chapter 2 Module 2
Chapter 2 Module 2
Chapter 2 Module 2
Dr. R. Sreekanth
Associate Professor
NHCE
Contents
• In the OSI Model, each layer uses the services of the layer
below it and provides services to the layer above it.
• The data link layer uses the services offered by the physical
layer. The primary function of this layer is to provide a well
defined service interface to network layer above it.
• The types of services provided can be of three types −
• Unacknowledged connectionless service
• Acknowledged connectionless service
• Acknowledged connection - oriented service
Unacknowledged connectionless service
• The data link layer ensures error free link for data transmission.
The issues it caters to with respect to error control are −
• Dealing with transmission errors
• Sending acknowledgement frames in reliable connections
• Retransmitting lost frames
• Identifying duplicate frames and deleting them
• Controlling access to shared channels in case of broadcasting
Flow Control
• The data link layer regulates flow control so that a fast sender
does not drown a slow receiver. When the sender sends frames
at very high speeds, a slow receiver may not be able to handle
it. There will be frame losses even if the transmission is error-
free. The two common approaches for flow control are −
• Feedback based flow control
• Rate based flow control
Data Link Layer Frame
• A frame is a unit of communication in the data link layer.
• To provide service to the network layer, the data link layer must
use the service provided to it by the physical layer.
• Physical layer does is accept a raw bit stream and attempt to
deliver it to the destination. This bit stream is not guaranteed to
be error free.
• The number of bits received may be less than, equal to, or more
than the number of bits transmitted, and they may have different
values. It is up to the data link layer to detect and, if necessary,
correct errors.
Fields of a Data Link Layer Frame
• Error correction techniques find out the exact number of bits that
have been corrupted and as well as their locations. There are two
principle ways
• For the above example, the number of data bits n=4, and the
number of redundant bits P=3. So the message consists of 7 bits
in total that are to be coded. Let the rightmost bit be designated
as bit 1, the next successive bit as bit 2 and so on.
• The seven bits are bit 7, bit 6, bit 5, bit 4, bit 3, bit 2, bit 1.
• In this, the redundant bits are placed at the positions that are
numbered corresponding to the power of 2, i.e., 1, 2, 4, 8,… Thus
the locations of data bit and redundant bit are D4, D3, D2, P3,
D1, P2, P1.
Assigning the values to redundant bits
2^r ≥ m + r + 1
2^4 >= 5+4+1
The equation is satisfied and so 4 redundant bits are selected.
So, total code bit = n+P = 9
The redundant bits are placed at bit positions 1, 2, 4 and 8.
Construct the bit location table.
Bit Location 9 8 7 6 5 4 3 2 1
Bit
D5 P4 D4 D3 D2 P3 D1 P2 P1
designation
Binary
representati 1001 1000 0111 0110 0101 0100 0011 0010 0001
on
Information 1 1 0 0 1
bits
Parity bits 1 1 0 1
• To determine the parity bits
• For P1: Bit locations 3, 5, 7 and 9 have three 1s. To have even
parity, P1 must be 1.
• For P2: Bit locations 3, 6, 7 have two 1s. To have even parity, P2
must be 0.
• For P3: Bit locations 5, 6, 7 have one 1s. To have even parity, P3
must be 1.
• For P4: Bit locations 8, 9 have one 1s. To have even parity, P2
must be 1.
• Thus the encoded 9-bit hamming code is 111001101.
Elementary Data Link Protocols
• Protocols in the data link layer are designed so that this layer
can perform its basic functions: framing, error control and flow
control.
• Framing is the process of dividing bit - streams from physical
layer into data frames whose size ranges from a few hundred to
a few thousand bytes.
• Error control mechanisms deals with transmission errors and
retransmission of corrupted and lost frames. Flow control
regulates speed of delivery and so that a fast sender does not
drown a slow receiver.
Types of Data Link Protocols
• Problem-01:
• Given-
• Distance = 3000 km
• Bandwidth = 1.536 Mbps
• Packet size = 64 bytes
• Propagation speed = 6 μsec / km
• a = Tp / Tt
• a = 18000 μsec / 333.33 μsec
• a = 54
• Calculating Bits Required in Sequence Number Field-
• Solution-
•
• Given-
• Packet size = 53 bytes
• RTT = 60 msec
• Bandwidth = 155 Mbps
•
• Calculating Transmission Delay-
•
• Transmission delay (Tt)
• = Packet size / Bandwidth
• = 53 bytes / 155 Mbps
• = (53 x 8 bits) / (155 x 106 bits per sec)
• = 2.735 μsec
Calculating Propagation Delay-
• Propagation delay (Tp)
• = Round Trip Time / 2
• = 60 msec / 2
• = 30 msec
• Calculating Value of ‘a’-
• a = Tp / Tt
• a = 30 msec / 2.735 μsec
• a = 10968.921
•
Calculating Optimal Window Size-
• Optimal window size
• = 1 + 2a
• = 1 + 2 x 10968.921
• = 21938.84
•
• Thus, approximate optimal window size = 21938 frames.
• Problem-03:
•
• A sliding window protocol is designed for a 1 Mbps point to point link
to the moon which has a one way latency (delay) of 1.25 sec.
Assuming that each frame carries 1 KB of data, what is the minimum
number of bits needed for the sequence number?
• Solution-
•
• Given-
• Bandwidth = 1 Mbps
• Propagation delay (Tp) = 1.25 sec
• Packet size = 1 KB
•
• Calculating Transmission Delay-
•
• Transmission delay (Tt)
• = Packet size / Bandwidth
• = 1 KB / 1 Mbps
• = (210 x 8 bits) / (106 bits per sec)
• = 8.192 msec
•
• Calculating Value of ‘a’-
• a = Tp / Tt
• a = 1.25 sec / 8.192 msec
• a = 152.59
• Calculating Bits Required in Sequence Number Field-
• Bits required in sequence number field
• = ⌈log2(1+2a)⌉
• = ⌈log2(1 + 2 x 152.59)⌉
• = ⌈log2(306.176)⌉
• = ⌈8.25⌉
• = 9 bits
•
• Thus,
• Minimum number of bits required in sequence number field = 9
Medium Access Sublayer
• The medium access control (MAC) is a sublayer of the data link
layer of the open system interconnections (OSI) reference
model for data transmission. It is responsible for flow control
and multiplexing for transmission medium. It controls the
transmission of data packets via remotely shared channels. It
sends data over the network interface card.
MAC Layer in the OSI Model
• It provides an abstraction of the physical layer to the LLC and upper layers of
the OSI network.
• It is responsible for encapsulating frames so that they are suitable for
transmission via the physical medium.
• It resolves the addressing of source station as well as the destination station, or
groups of destination stations.
• It performs multiple access resolutions when more than one data frame is to be
transmitted. It determines the channel access methods for transmission.
• It also performs collision resolution and initiating retransmission in case of
collisions.
• It generates the frame check sequences and thus contributes to protection
against transmission errors.
MAC Addresses
• Ethernet frame starts with Preamble and SFD (Start Frame Delimiter),
both works at the physical layer. Ethernet header contains both Source
and Destination MAC address, after which the payload of the frame is
present. The last field is CRC which is used to detect the error.
• PREAMBLE – Ethernet frame starts with 7-Bytes Preamble.
• This is a pattern of alternative 0’s and 1’s which indicates starting of
the frame and allow sender and receiver to establish bit
synchronization.
• Initially, PRE (Preamble) was introduced to allow for the loss of a few
bits due to signal delays. But today’s high-speed Ethernet don’t need
Preamble to protect the frame bits.
• PRE (Preamble) indicates the receiver that frame is coming and allow
the receiver to lock onto the data stream before the actual frame
begins.
• Start of frame delimiter (SFD) – This is a 1-Byte field which is
always set to 10101011. SFD indicates that upcoming bits are starting
of the frame, which is the destination address. Sometimes SFD is
considered the part of PRE, this is the reason Preamble is described as
8 Bytes in many places. The SFD warns station or stations that this is
the last chance for synchronization.
• Destination Address – This is 6-Byte field which contains the MAC
address of machine for which data is destined.
• Source Address – This is a 6-Byte field which contains the MAC
address of source machine. As Source Address is always an individual
address (Unicast), the least significant bit of first byte is always 0.
• Length – Length is a 2-Byte field, which indicates the length of entire
Ethernet frame. This 16-bit field can hold the length value between 0
to 65534, but length cannot be larger than 1500 because of some own
limitations of Ethernet.
• Data – This is the place where actual data is inserted, also known
as Payload. Both IP header and data will be inserted here if Internet
Protocol is used over Ethernet. The maximum data present may be as
long as 1500 Bytes. In case data length is less than minimum length i.e.
46 bytes, then padding 0’s is added to meet the minimum possible
length.
• Cyclic Redundancy Check (CRC) – CRC is 4 Byte field. This field
contains a 32-bits hash code of data, which is generated over the
Destination Address, Source Address, Length, and Data field. If the
checksum computed by destination is not the same as sent checksum
value, data received is corrupted.
Wireless LAN
• Wireless LANs (WLANs) are wireless computer networks that
use high-frequency radio waves instead of cables for
connecting the devices within a limited area forming LAN (Local
Area Network). Users connected by wireless LANs can move
around within this limited area such as home, school, campus,
office building, railway platform, etc.
• Most WLANs are based upon the standard IEEE 802.11
standard or WiFi.
Components of WLANs
• The components of WLAN architecture as laid down in IEEE 802.11 are −
• Stations (STA) − Stations comprises of all devices and equipment that
are connected to the wireless LAN. Each station has a wireless network
interface controller. A station can be of two types −
• Wireless Access Point (WAP or AP)
• Client
• Basic Service Set (BSS) − A basic service set is a group of stations
communicating at the physical layer level. BSS can be of two categories −
• Infrastructure BSS
• Independent BSS
• Extended Service Set (ESS) − It is a set of all connected BSS.
• Distribution System (DS) − It connects access points in ESS.
• Types of WLANS
• WLANs, as standardized by IEEE 802.11, operates in two basic
modes, infrastructure, and ad hoc mode.
• Infrastructure Mode − Mobile devices or clients connect to an
access point (AP) that in turn connects via a bridge to the LAN
or Internet. The client transmits frames to other clients via the
AP.
• Ad Hoc Mode − Clients transmit frames directly to each other in
a peer-to-peer fashion.
• Advantages of WLANs
• They provide clutter-free homes, offices and other networked
places.
• The LANs are scalable in nature, i.e. devices may be added or
removed from the network at greater ease than wired LANs.
• The system is portable within the network coverage. Access to
the network is not bounded by the length of the cables.
• Installation and setup are much easier than wired counterparts.
• The equipment and setup costs are reduced.
• Disadvantages of WLANs
• Since radio waves are used for communications, the signals are
noisier with more interference from nearby systems.
• Greater care is needed for encrypting information. Also, they
are more prone to errors. So, they require greater bandwidth
than the wired LANs.
• WLANs are slower than wired LANs.
Bluetooth
• It is a Wireless Personal Area Network (WPAN) technology and is
used for exchanging data over smaller distances. This technology was
invented by Ericson in 1994. It operates in the unlicensed, industrial,
scientific and medical (ISM) band at 2.4 GHz to 2.485 GHz.
Maximum devices that can be connected at the same time are 7.
Bluetooth ranges upto 10 meters.
• It provides data rates upto 1 Mbps or 3 Mbps depending upon the
version. The spreading technique which it uses is FHSS (Frequency
hopping spread spectrum). A bluetooth network is called piconet and a
collection of interconnected piconets is called scatternet.
Bluetooth Architecture:
• The architecture of bluetooth defines two types of networks:
PICONET
• Piconet is a type of bluetooth network that contains one primary
node called master node and seven active secondary nodes called slave
nodes.
• Thus, we can say that there are total of 8 active nodes which are present at a
distance of 10 metres. The communication between the primary and
secondary node can be one-to-one or one-to-many.
• Possible communication is only between the master and slave; Slave-slave
communication is not possible. It also have 255 parked nodes, these are
secondary nodes and cannot take participation in communication unless it
get converted to the active state.
• Scatternet:
• It is formed by using various piconets. A slave that is present in one
piconet can be act as master or we can say primary in other piconet.
This kind of node can receive message from master in one piconet and
deliver the message to its slave into the other piconet where it is acting
as a slave. This type of node is refer as bridge node. A station cannot
be master in two piconets.
Bluetooth protocol stack:
1.Radio (RF) layer:
It performs modulation/demodulation of the data into RF signals. It defines the physical characteristics of
bluetooth transceiver. It defines two types of physical link: connection-less and connection-oriented.
2.Baseband Link layer:
It performs the connection establishment within a piconet.
3.Link Manager protocol layer:
It performs the management of the already established links. It also includes authentication and
encryption processes.
4.Logical Link Control and Adaption protocol layer:
It is also known as the heart of the bluetooth protocol stack. It allows the communication between upper
and lower layers of the bluetooth protocol stack. It packages the data packets received from upper layers
into the form expected by lower layers. It also performs the segmentation and multiplexing.
5.SDP layer:
It is short for Service Discovery Protocol. It allows to discover the services available on another
bluetooth enabled device.
1.RF comm layer:
It is short for Radio Frontend Component. It provides serial interface with WAP and OBEX.
2.OBEX:
It is short for Object Exchange. It is a communication protocol to exchange objects between 2 devices.
3.WAP:
It is short for Wireless Access Protocol. It is used for internet access.
4.TCS:
It is short for Telephony Control Protocol. It provides telephony service.
5.Application layer:
It enables the user to interact with the application.
• Advantages:
• Low cost.
• Easy to use.
• It can also penetrate through walls.
• It creates an adhoc connection immediately without any wires.
• It is used for voice and data transfer.
• Disadvantages:
• It can be hacked and hence, less secure.
• It has slow data transfer rate: 3 Mbps.
• It has small range: 10 meters.
Spanning tree
• Spanning Tree Protocol (STP) is a communication protocol
operating at data link layer the OSI model to prevent bridge
loops and the resulting broadcast storms. It creates a loop −
free topology for Ethernet networks.
• A bridge loop is created when there are more than one paths between
two nodes in a given network. When a message is sent, particularly
when a broadcast is done, the bridges repeatedly rebroadcast the same
message flooding the network. Since a data link layer frame does not
have a time-to-live field in the header, the broadcast frame may loop
forever, thus swamping the channels.
• Spanning tree protocol creates a spanning tree by disabling all links that
form a loop or cycle in the network. This leaves exactly one active path
between any two nodes of the network. So when a message is
broadcast, there is no way that the same message can be received from
an alternate path. The bridges that participate in spanning tree protocol
are often called spanning tree bridges.
• To construct a spanning tree, the bridges broadcast their
configuration routes. Then they execute a distributed algorithm
for finding out the minimal spanning tree in the network, i.e. the
spanning tree with minimal cost. The links not included in this
tree are disabled but not removed.
• In case a particular active link fails, the algorithm is executed
again to find the minimal spanning tree without the failed link.
The communication continues through the newly formed
spanning tree. When a failed link is restored, the algorithm is re-
run including the newly restored link.
• Let us consider a physical topology, as shown in the diagram, for
an Ethernet network that comprises of six interconnected bridges.
The bridges are named {B1, B2, B3, B4, B5, B6} and several
nodes are connected to each bridge. The links between two
bridges are named {L1, L2, L3, L4, L5, L6, L7, L8, L9}, where L1
connects B1 and B2, L2 connects B1 and B3 and so on. It is
assumed that all links are of uniform costs.
• From the diagram we can see that there are multiple paths from a
bridge to any other bridge in the network, forming several bridge
loops that makes the topology susceptible to broadcast storms.
• According to spanning tree protocol, links that form a cycle are
disabled. Thus, we get a logical topology so that there is
exactly one route between any two bridges. One possible
logical topology is shown in the following diagram below
containing links {L1, L2, L3, L4, L5} −
• In the above logical configuration, if a situation arises such that
link L4 fails. Then, the spanning tree is reconstituted leaving L4.
A possible logical reconfiguration containing links {L1, L2, L3,
L5, L9} is as follows −