CN Unit 2 Notes
CN Unit 2 Notes
2.1 Introduction
What is DLL (Data Link Layer)?
The Data Link Layer is the second layer in the OSI model, above the Physical Layer, which
ensures that the error free data is transferred between the adjacent nodes in the network. It breaks
the datagram passed down by above layers and converts them into frames ready for transfer. This
is called Framing.
It provides two main functionalities
Reliable data transfer service between two peer network layers
Flow Control mechanism which regulates the flow of frames such that data congestion is not
there at slow receivers due to fast senders.
The acronym ARP stands for Address Resolution Protocol which is one of the most important
protocols of the Network layer in the OSI model.
Note: ARP finds the hardware address, also known as Media Access Control (MAC) address, of
a host from its known IP address.
Let’s look at how ARP works.
Imagine a device wants to communicate with the other over the internet. What ARP does? Is it
broadcast a packet to all the devices of the source network?
The devices of the network peel the header of the data link layer from the protocol data unit
(PDU) called frame and transfers the packet to the network layer (layer 3 of OSI) where the
network ID of the packet is validated with the destination IP’s network ID of the packet and if
it’s equal then it responds to the source with the MAC address of the destination, else the packet
reaches the gateway of the network and broadcasts packet to the devices it is connected with and
validates their network ID.
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, which we discuss for each protocol later.
Caching
A question that is often asked is this: If system A can broadcast a frame to find the linklayer
address of system B, why can’t system A send the datagram for system B using a broadcast
frame? In other words, instead of sending one broadcast frame (ARP request), one unicast frame
(ARP response), and another unicast frame (for sending the datagram), system A can encapsulate
the datagram and send it to the network. System B receives it and keep it; other systems discard
it.
2.3 DLC 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 and flow and error control. In this section, we first
discuss framing, or how to organize the bits that are carried by the physical layer. We then
discuss flow and error control.
Data link control functions includes (1)
Framing.
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. 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 manyto- many carrier facility.
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 affects only that small frame.
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. Our main discussion in this
chapter concerns variable-size framing, prevalent in local-area networks. 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.
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.
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.
Buffers
Although flow control can be implemented in several ways, one of the solutions is normally to
use two buffers; one at the sending data-link layer and the other at the receiving data-link layer.
A buffer is a set of memory locations that can hold packets at the sender and receiver. The flow
control communication can occur by sending signals from the consumer to the producer. When
the buffer of the receiving data-link layer is full, it informs the sending data-link layer to stop
pushing frames. Error Control:
Since the underlying technology at the physical layer is not fully reliable, we need to implement
error control at the data-link layer to prevent the receiving node from delivering corrupted
packets to its network layer. Error control at the data-link layer is normally very simple and
implemented using one of the following two methods. In both methods, a CRC is added to the
frame header by the sender and checked by the receiver.
❑ In the first method, if the frame is corrupted, it is silently discarded; if it is not corrupted, the
packet is delivered to the network layer. This method is used mostly in wired LANs such as
Ethernet.
❑ In the second method, if the frame is corrupted, it is silently discarded; if it is not corrupted,
an acknowledgment is sent (for the purpose of both flow and error control) to the sender.
Combination of Flow and Error Control
Flow and error control can be combined. In a simple situation, the acknowledgment that is sent
for flow control can also be used for error control to tell the sender the packet has arrived
uncorrupted. The lack of acknowledgment means that there is a problem in the sent frame. We
show this situation when we discuss some simple protocols in the next section. A frame that
carries an acknowledgment is normally called an ACK to distinguish it from the data frame.
Connectionless and Connection-Oriented
A DLC protocol can be either connectionless or connection-oriented.
Connectionless Protocol
In a connectionless protocol, frames are sent from one node to the next without any relationship
between the frames; each frame is independent. Note that the term connectionless here does not
mean that there is no physical connection (transmission medium) between the nodes; it means
that there is no connection between frames. The frames are not numbered and there is no sense of
ordering. Most of the data-link protocols for LANs are connectionless protocols.
Connection-Oriented Protocol
In a connection-oriented protocol, a logical connection should first be established between the
two nodes (setup phase). After all frames that are somehow related to each other are transmitted
(transfer phase), the logical connection is terminated (teardown phase). In this type of
communication, the frames are numbered and sent in order. If they are not received in order, the
receiver needs to wait until all frames belonging to the same set are received and then deliver
them in order to the network layer. Connection oriented protocols are rare in wired LANs, but we
can see them in some point-to-point protocols, some wireless LANs, and some WANs.
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, but we discuss the more sophisticated
version in Chapter 23 when we have learned about sliding windows. 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 CRC (see Chapter 10) 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). If the timer expires, the sender resends the previous frame, assuming that the
frame was either lost or corrupted. This means that the sender needs to keep a copy of the frame
until its acknowledgment arrives. When the corresponding acknowledgment arrives, the sender
discards the copy and sends the next frame if it is ready.
Sender States
The sender is initially in the ready state, but it can move between the ready and blocking state.
❑ Ready State. When the sender is in this state, it is only waiting for a packet from the network
layer. If a packet comes from the network layer, the sender creates a frame, saves a copy of the
frame, starts the only timer and sends the frame. The sender then moves to the blocking state.
❑ Blocking State. When the sender is in this state,three events can occur:
a. If a time-out occurs, the sender resends the saved copy of the frame and restarts the timer.
b. If a corrupted ACK arrives, it is discarded.
c. If an error-free ACK arrives, the sender stops the timer and discards the saved copy of the
frame. It then moves to the ready state.
Receiver
The receiver is always in the ready state. Two events may occur:
a. If an error-free frame arrives, the message in the frame is delivered to the network layer and an
ACK is sent.
b. If a corrupted frame arrives, the frame is discarded.
Sequence and Acknowledgment Numbers
We saw a problem in Example 11.3 that needs to be addressed and corrected. Duplicate packets,
as much as corrupted packets, need to be avoided. As an example, assume we are ordering some
item online. If each packet defines the specification of an item to be ordered, duplicate packets
mean ordering an item more than once. To correct the problem in Example 11.3, we need to add
sequence numbers to the data frames and acknowledgment numbers to the ACK frames.
However, numbering in this case is very simple. Sequence numbers are 0, 1, 0, 1, 0, 1, . . . ; the
acknowledgment numbers can also be 1, 0, 1, 0, 1, 0, … In other words, the sequence numbers
start with 0, the acknowledgment numbers start with 1. An acknowledgment number always
defines the sequence number of the next frame to receive.
Piggybacking
The two protocols we discussed in this section are designed for unidirectional communication, in
which data is flowing only in one direction although the acknowledgment may travel in the other
direction. Protocols have been designed in the past to allow data to flow in both directions.
However, to make the communication more efficient, the data in one direction is piggybacked
with the acknowledgment in the other direction. In other words, when node A is sending data to
node B, Node A also acknowledges the data received from node B. Because piggybacking makes
2.5 HDLC
HDLC - Short for High-level Data Link Control, a transmission protocol used at the data link
layer (layer 2) of the OSI seven layer model for data communications. The HDLC protocol
embeds information in a data frame that allows devices to control data flow and correct errors.
HDLC is an ISO standard developed from the Synchronous Data Link Control (SDLC) standard
proposed by IBM in the 1970's. HDLC NRM (also known as SDLC).
Types of Frames in HDLC
HDLC defines three types of frames:
1. Information frames (I-frame)
2. Supervisory frame (S-frame)
3. Unnumbered frame (U-frame)
1. Information frames
• I-frames carry user's data and control information about user's data.
• I-frame carries user data in the information field.
• The I-frame format is shown in diagram.
• The first bit of control field is always zero, i.e. the presence of zero at this place indicates that it
is I-frame.
• Bit number 2, 3 & 4 in control field is called N(S) that specifies the sequence number of the
frame. Thus it specifies the number of the frame that is currently being sent. Since it is a 3.bit
field, only eight sequence numbers are possible 0, 1,2,3,4,5,6, 7 (000 to 111).
• Bit number 5 in control field is P/F i.e. Poll/Final and is used for these two purposes. It has,
meaning only when it is set i.e. when P/F=1. It can represent the following two cases.
(i) It means poll when frame is sent by a primary station to secondary (when address field
contains the address of receiver).
(ii) It means final when frame is sent by secondary to a primary (when the address field
contains the address of the sender).
• Bit number 6, 7, and 8 in control field specifies N(R) i.e. the sequence number of the frame
expected in return in two-way communication.
If last frame received was error-free then N(R) number will be that of the next frame is sequence.
If the last frame was not received correctly, the N(R) number will be the number of the damaged
frame, asking for its retransmission.
2. Supervisory frame
• S-frame carries control information, primarily data link layer flow and error controls.
• It does not contain information field.
• The format of S-frame is shown in diagram.
• The first two bits in the control field of S-frame are always 10.
• Then there is a bit code field that specifies four types of S-frame with combination 00,01, 10,
11 as shown in table :-
1. RR, Receive Ready-used to acknowledge frames when no I-frames are availab1e to piggyback
the acknowledgement.
2. REJ Reject-used by the receiver to send a NAK when error has occurred.
3. RNR Receive Not Ready-used for flow control.
4. SREJ Selective Reject-indicates to the transmitter that it should retransmit the frame indicated
in the N(R) subfield.
• There is no N(S) field in control field of S-frame as S-frames do not transmit data.
• P/F bit is the fifth bit and serves the same purpose as discussed earlier.
• Last three bits in control field indicates N(R) i.e. they correspond to the ACK or NAK value.
3. Unnumbered frame
• U-frames are reserved for system management and information carried by them is used for
managing the link
• U-frames are used to exchange session management and control information between the two
connected devices.
• Information field in U-frame does not carry user information rather, it carries system
management information.
• The frame format of U-frame is shown in diagram.
• U-frame is identified by the presence of 11 in the first and second bit position in control field.
• These frames do not contain N(S) or N(R) in control field.
• U-frame contains two code fields, one two hit and other three bit.
• These five bits can create upto 32 different U-frames.
• .P/F bit in control field has same purpose in V-frame as discussed earlier.
Multiplexing
Although PPP is a link-layer protocol, it uses another set of protocols to establish the link,
authenticate the parties involved, and carry the network-layer data. Three sets of protocols are
defined to make PPP powerful: the Link Control Protocol (LCP), two Authentication Protocols
(APs), and several Network Control Protocols (NCPs). At any moment, a PPP packet can carry
data from one of these protocols in its data field. Note that there are one LCP, two APs, and
several NCPs. Data may also come from several different network layers.
The rightmost six digits represents Network Interface Controller, which is assigned by
manufacturer.
As discussed above, MAC address is represented by Colon-Hexadecimal notation. But this is just
a conversion, not mandatory. MAC address can be represented using any of the following
formats –
Since we are talking about IEEE 802.3 standard Ethernet therefore, 0 is expressed by a high-to-
low transition, a 1 by the low-to-high transition. In both Manchester Encoding and Differential
Manchester, Encoding Baud rate is double of bit rate.
Baud rate = 2* Bit rate
Ethernet LANs consist of network nodes and interconnecting media or link. The network nodes
can be of two types:
Data Terminal Equipment (DTE):- Generally, DTEs are the end devices that convert the user
information into signals or reconvert the received signals. DTEs devices are: personal computers,
workstations, file servers or print servers also referred to as end stations. These devices are either
the source or the destination of data frames. The data terminal equipment may be a single piece
of equipment or multiple pieces of equipment that are interconnected and perform all the
required functions to allow the user to communicate. A user can interact to DTE or DTE may be
a user.
Data Communication Equipment (DCE):- DCEs are the intermediate network devices that
receive and forward frames across the network. They may be either standalone devices such as
repeaters, network switches, routers or maybe communications interface units such as interface
cards and modems. The DCE performs functions such as signal conversion, coding and may be a
part of the DTE or intermediate equipment.
Currently, these data rates are defined for operation over optical fibers and twisted-pair cables: i)
Fast Ethernet
Fast Ethernet refers to an Ethernet network that can transfer data at a rate of 100 Mbit/s. ii)
Gigabit Ethernet
Gigabit Ethernet delivers a data rate of 1,000 Mbit/s (1 Gbit/s).
iii) 10 Gigabit Ethernet
10 Gigabit Ethernet is the recent generation and delivers a data rate of 10 Gbit/s (10,000 Mbit/s).
It is generally used for backbones in high-end applications requiring high data rates.
ALOHA
The Aloha protocol was designed as part of a project at the University of Hawaii. It provided
data transmission between computers on several of the Hawaiian Islands involving packet radio
networks. Aloha is a multiple access protocol at the data link layer and proposes how multiple
terminals access the medium without interference or collision.
There are two different versions of ALOHA:
1. Pure Aloha
Pure Aloha is an un-slotted, decentralized, and simple to implement a protocol. In pure ALOHA,
the stations simply transmit frames whenever they want data to send. It does not check whether
the channel is busy or not before transmitting. In case, two or more stations transmit
simultaneously, the collision occurs and frames are destroyed. Whenever any station transmits a
frame, it expects the acknowledgment from the receiver. If it is not received within a specified
time, the station assumes that the frame or acknowledgment has been destroyed. Then, the station
waits for a random amount of time and sends the frame again. This randomness helps in avoiding
more collisions. This scheme works well in small networks where the load is not much. But in
largely loaded networks, this scheme fails poorly. This led to the development of Slotted Aloha.
To assure pure aloha: Its throughput and rate of transmission of the frame to be predicted.
For that to make some assumption:
i) All the frames should be the same length.
ii) Stations can not generate frame while transmitting or trying to transmit frame.
iii) The population of stations attempts to transmit (both new frames and old frames that
collided) according to a Poisson distribution.
Vulnerable Time = 2 * Tt
Efficiency of Pure ALOHA: Spure= G * e^-2G where G
is number of stations wants to transmit in Tt slot.
Maximum Efficiency:
Maximum Efficiency will be obtained when G=1/2 (Spure)max
= 1/2 * e^-1
= 0.184
Which means, in Pure ALOHA, only about 18.4% of the time is used for
successful transmissions. 2. Slotted Aloha
This is quite similar to Pure Aloha, differing only in the way transmissions take place. Instead of
transmitting right at demand time, the sender waits for some time. In slotted ALOHA, the time of
the shared channel is divided into discrete intervals called Slots. The stations are eligible to send
a frame only at the beginning of the slot and only one frame per slot is sent. If any station is not
able to place the frame onto the channel at the beginning of the slot, it has to wait until the
beginning of the next time slot. There is still a possibility of collision if two stations try to send at
the beginning of the same time slot. But still the number of collisions that can possibly take place
is reduced by a large margin and the performance becomes much well compared to Pure Aloha.
Collision is possible for only the current slot. Therefore, Vulnerable Time is Tt.
Efficiency of Slotted ALOHA:
Sslotted = G * e^-G
Maximum Efficiency:
(Sslotted)max = 1 * e^-1
= 1/e = 0.368
Maximum Efficiency, in Slotted ALOHA, is 36.8%.
2.11 Bluetooth
Bluetooth is a wireless LAN technology designed to connect devices of different functions such
as telephones, notebooks, computers (desktop and laptop), cameras, printers, and even coffee
makers when they are at a short distance from each other. A Bluetooth LAN is an ad hoc
network, which means that the network is formed spontaneously; the devices, sometimes called
gadgets, find each other and make a network called a piconet. A Bluetooth LAN can even be
connected to the Internet if one of the gadgets has this capability. A Bluetooth LAN, by nature,
cannot be large. If there are many gadgets that try to connect, there is chaos.
Bluetooth technology has several applications. Peripheral devices such as a wireless mouse or
keyboard can communicate with the computer through this technology. Monitoring devices can
communicate with sensor devices in a small health care center. Home security devices can use
this technology to connect different sensors to the main security controller. Conference attendees
can synchronize their laptop computers at a conference.
Bluetooth was originally started as a project by the Ericsson Company. It is namedfor Harald
Blaatand, the king of Denmark (940-981) who united Denmark and Norway. Blaatand translates
to Bluetooth in English. Today, Bluetooth technology is the implementation of a protocol defined
by the IEEE 802.15 standard. The standard defines a wireless personal-area network (PAN)
operable in an area the size of a room or a hall.
Architecture
Bluetooth defines two types of networks: piconet and scatternet.
Piconets
A Bluetooth network is called a piconet, or a small net. A piconet can have up to eight stations,
one of which is called the primary; the rest are called secondaries. All the secondary stations
synchronize their clocks and hopping sequence with the primary. Note that a piconet can have
only one primary station. The communication between the primary and secondary stations can be
one-to-one or one-to-many. Although a piconet can have a maximum of seven secondaries,
additional secondaries can be in the parked state. A secondary in a parked state is synchronized
with the primary, but cannot take part in communication until it is moved from the parked state
to the active state. Because only eight stations can be active in a piconet, activating a station
from the parked state means that an active station must go to the parked state.
Scatternet
Piconets can be combined to form what is called a scatternet. A secondary station in one piconet
can be the primary in another piconet. This station can receive messages from the primary in the
first piconet (as a secondary) and, acting as a primary, deliver them to secondaries in the second
piconet. A station can be a member of two piconets.
Bluetooth Devices
A Bluetooth device has a built-in short-range radio transmitter. The current data rate is 1 Mbps
with a 2.4-GHz bandwidth. This means that there is a possibility of interference between the
IEEE 802.11b wireless LANs and Bluetooth LANs.
Bluetooth Layers
Bluetooth uses several layers that do not exactly match those of the Internet model.
L2CAP
The Logical Link Control and Adaptation Protocol, or L2CAP (L2 here means LL), is
roughly equivalent to the LLC sublayer in LANs. It is used for data exchange on an The 16-bit
length field defines the size of the data, in bytes, coming from the upper layers. Data can be up to
65,535 bytes. The channel ID (CID) defines a unique identifier for the virtual channel created at
this level.
The L2CAP has specific duties: multiplexing, segmentation and reassembly, quality of service
(QoS), and group management.
Multiplexing
The L2CAP can do multiplexing. At the sender site, it accepts data from one of the upper-layer
protocols, frames them, and delivers them to the baseband layer. At the receiver site, it accepts a
frame from the baseband layer, extracts the data, and delivers them to the appropriate protocol
layer.
Segmentation and Reassembly
The maximum size of the payload field in the baseband layer is 2774 bits, or 343 bytes. This
includes 4 bytes to define the packet and packet length. Therefore, the size of the packet that can
arrive from an upper layer can only be 339 bytes. However, application layers sometimes need to
send a data packet that can be up to 65,535 bytes (an Internet packet, for example). The L2CAP
divides these large packets into segments and adds extra information to define the location of the
segments in the original packet. The L2CAP segments the packets at the source and reassembles
them at the destination.
QoS
Bluetooth allows the stations to define a quality-of-service level. For the moment, it is sufficient
to know that if no quality-of-service level is defined, Bluetooth defaults to what is called best-
effort service; it will do its best under the circumstances.
2.12 Connecting Devices (Hub, Repeater, Bridge, Switch, Router, Gateways and Brouter) 1.
Repeater – A repeater operates at the physical layer. Its job is to regenerate the signal over the
same network before the signal becomes too weak or corrupted so as to extend the length to
which the signal can be transmitted over the same network. An important point to be noted about
repeaters is that they do not amplify the signal. When the signal becomes weak, they copy the
signal bit by bit and regenerate it at the original strength. It is a 2 port device.
2. Hub – A hub is basically a multiport repeater. A hub connects multiple wires coming from
ifferent branches, for example, the connector in star topology which connects different stations.
Hubs cannot filter data, so data packets are sent to all connected devices. In other words,
collision domain of all hosts connected through Hub remains one. Also, they do not have
intelligence to find out best path for data packets which leads to inefficiencies and wastage.
Types of Hub
• Active Hub :- These are the hubs which have their own power supply and can clean ,
boost and relay the signal along the network. It serves both as a repeater as well as wiring
center. These are used to extend maximum distance between nodes.
• Passive Hub :- These are the hubs which collect wiring from nodes and power supply
from active hub. These hubs relay signals onto the network without cleaning and boosting
them and can’t be used to extend distance between nodes.
3. Bridge – A bridge operates at data link layer. A bridge is a repeater, with add on
functionality of filtering content by reading the MAC addresses of source and destination. It is
also used for interconnecting two LANs working on the same protocol. It has a single input and
single output port, thus making it a 2 port device. Types of Bridges
• Transparent Bridges :- These are the bridge in which the stations are completely
naware of the bridge’s existence i.e. whether or not a bridge is added or deleted from the
network , reconfiguration of the stations is unnecessary. These bridges makes use of two