Mod 2
Mod 2
Presentation Material
Department of Computer Science & Engineering
Data Link Layer – MAC (Media Access Control) and LLC (Logical Link Control)
sublayer functionalities
Design Issues: Framing – Flow control (Simplest protocol, Stop and wait, sliding window)
Error control- CRC, Hamming code
Ethernet Basics-Multi Access Protocols: ALOHA, CSMA/CD
Connecting Devices: Hubs, Bridges, Switches, Routers, and Gateways
• The Data Link Layer protocols are Ethernet, token ring and PPP.
• An important characteristic of a Data Link Layer is that datagram can be handled by different link
layer protocols on different links in a path. For example, the datagram is handled by Ethernet on the
first link, PPP on the second link.
Frames
A frame contains (see the image below),
1. A frame header contains control information
2. A payload field for holding the packet
3. A frame trailer
6
Logical Link Control:
• data link control handles framing, flow control, and error control. In IEEE Project 802, flow control, error
control, and part of the framing duties are collected into one sublayer called the logical link control. Framing
is handled in both the LLC sublayer and the MAC sublayer.
• The LLC provides one single data link control protocol for all IEEE LANs. In this way, the LLC is different
from the media access control sublayer, which provides different protocols for different LANs.
• A single LLC protocol can provide interconnectivity between different LANs because it makes the MAC
sublayer transparent. Figure shows one single LLC protocol serving several MAC protocols.
21-09-2022 7
• The IEEE has subdivided data link layer into two sublayers: logical link control (LLC) and media access control
(MAC).
21-09-2022 8
• Framing LLC defines a protocol data unit (PDU) that is somewhat similar to that of HDLC.
• The header contains a control field like the one in HDLC; this field is used for flow and error control. The
two other header fields define the upper-layer protocol at the source and destination that uses LLC.
• These fields are called the destination service access point (DSAP) and the source service access point
(SSAP). The other fields defined in a typical data link control protocol such as HDLC are moved to the MAC
sublayer.
• In other words, a frame defined in HDLC is divided into a PDU at the LLC sublayer and a frame at the MAC
sublayer, as shown in above Figure.
• Need for LLC The purpose of the LLC is to provide flow and error control for the upper-layer protocols that
actually demand these services.
Figure High Level Data Link Control (HDLC) frame compared with LLC and MAC frames
Design Issues
• Framing
• Flow Control(Simplest Protocol, Stop and wait, Sliding
Window)
• Error Control(CRC, Hamming Code)
10
Framing
10.23
Stop and Wait
• Simple
• Inefficient
Sliding Window Protocol
• The sliding window is a technique for sending multiple frames at a time. It controls the data packets
between the two devices where reliable and gradual delivery of data frames is needed. It is also used
in TCP (Transmission Control Protocol)
• In this technique, each frame has sent from the sequence number. The sequence numbers are used to find
the missing data in the receiver end. The purpose of the sliding window technique is to avoid duplicate
data, so it uses the sequence number.
Go – Back – N ARQ
Go – Back – N ARQ provides for sending multiple frames before receiving the acknowledgement for the first
frame. It uses the concept of sliding window, and so is also called sliding window protocol. The frames are
sequentially numbered and a finite number of frames are sent. If the acknowledgement of a frame is not
received within the time period, all frames starting from that frame are retransmitted.
Selective Repeat ARQ
This protocol also provides for sending multiple frames before receiving the
acknowledgement for the first frame. However, here only the erroneous or lost frames are
retransmitted, while the good frames are received and buffered.
• Ways of doing Error Control :
There are basically two ways of doing Error control as given
below :
•
1. Error Detection :
Error detection, as name suggests, simply means detection or identification
of errors. These errors may cause due to noise or any other impairments
during transmission from transmitter to the receiver, in communication
system. It is class of technique for detecting garbled i.e. unclear and
distorted data or message.
2. Error Correction :
Error correction, as name suggests, simply means correction or solving or
fixing of errors. It means reconstruction of original data that is error-free. But
error correction method is very costly and is very hard.
CYCLIC CODES
2. All the bit positions that are a power of 2 are marked as parity bits (n=1, 2, 4, 8,….n).
48
4. Each data bit is included in a unique set of parity bits, as determined its bit position in binary form.
a. Parity bit 1 covers all the bits positions. For P1: it checks 1bit and skips 1bit till it reaches the MSB bit
acc/to example it is D7 (1, 3, 5, 7, etc).
b. Parity bit 2 covers all the bits positions, starting from second bit position from LSB. Now for P2: it
checks 2bits and skips 2bits till it reaches the MSB acc/to example it is D7 (2, 3, 6, 7, etc).
c. Parity bit 4 covers all the bits positions, starting from 4th bit position from LSB. Now for P4: it checks
4bits and skips 4bits till it reaches the MSB acc/to example it is D7 (4,5,6,7, etc).
49
4. Since we check for even parity set a parity bit to 1 if the total number of ones in the
positions it checks is odd.
5. Set a parity bit to 0 if the total number of ones in the positions it checks is even.
50
Detecting Errors
51
Correcting the errors
52
Ethernet Basics
Ethernet is a set of technologies and protocols that are used primarily in LANs. However, Ethernet
can also be used in MANs and even WANs. It was first standardized in the 1980s as IEEE 802.3
standard. Since then, it has gone through four generations, as shown in the following chart
Standard Ethernet is also referred to as Basic Ethernet. It uses 10Base5 coaxial cables for
communications. Ethernet provides service up to the data link layer. At the data link layer,
Ethernet divides the data stream received from the upper layers and encapsulates it into
frames, before passing them on to the physical layer.
53
Standard Ethernet has many physical layer implementations. The four main
physical layer implementations are shown in the following diagram
54
What is a multiple access protocol?
• When a sender and receiver have a dedicated link to transmit data packets, the data link control is enough to
handle the channel.
• Suppose there is no dedicated path to communicate or transfer the data between two devices. In that case,
multiple stations access the channel and simultaneously transmits the data over the channel.
• It may create collision and cross talk. Hence, the multiple access protocol is required to reduce the collision
and avoid crosstalk between the channels.
• For example, suppose that there is a classroom full of students. When a teacher asks a question, all the
students (small channels) in the class start answering the question at the same time (transferring the data
simultaneously). All the students respond at the same time due to which data is overlap or data lost.
Therefore it is the responsibility of a teacher (multiple access protocol) to manage the students and make
them one answer.
Figure 12.2 Taxonomy of multiple-access protocols discussed in this chapter
12.57
A. Random Access Protocol
• In this protocol, all the station has the equal priority to send the data over a channel.
• In random access protocol, one or more stations cannot depend on another station nor any station
control another station.
• Depending on the channel's state (idle or busy), each station transmits the data frame. However, if
more than one station sends the data over a channel, there may be a collision or data conflict.
• Due to the collision, the data frame packets may be lost or changed. And hence, it does not receive by
the receiver end.
• Following are the different methods of random-access protocols for broadcasting frames on the
channel.
o Aloha
o CSMA
o CSMA/CD
1. ALOHA Random Access Protocol
• It is designed for wireless LAN (Local Area Network) but can also be used in a shared medium to
transmit data.
• Using this method, any station can transmit data across a network simultaneously when a data
frameset is available for transmission.
• Aloha Rules
3. Collision and data frames may be lost during the transmission of data through multiple stations.
• Whenever data is available for sending over a channel at stations, we use Pure Aloha.
• In pure Aloha, when each station transmits data to a channel without checking whether the channel is
idle or not, the chances of collision may occur, and the data frame can be lost.
• When any station transmits the data frame to a channel, the pure Aloha waits for the receiver's
acknowledgment.
• If it does not acknowledge the receiver end within the specified time, the station waits for a random
amount of time, called the backoff time (Tb).
• And the station may assume the frame has been lost or destroyed. Therefore, it retransmits the frame
until all the data are successfully transmitted to the receiver.
Vulnerable time:
• The vulnerable time is in which there is a possibility of collision. We assume that the stations send fixed-length frames
with each frame taking Tfr S to send. The following figure shows the vulnerable time for station A.
• Station A sends a frame at time t. Now imagine station B has already sent a frame between t - T fr and t. This leads to a
collision between the frames from station A and station B. The end of B's frame collides with the beginning of A's frame.
• On the other hand, suppose that station C sends a frame between t and t + Tfr . Here, there is a collision between
frames from station A and station C. The beginning of C's frame collides with the end of A's frame. We see vulnerable
time during which a collision may occur in pure ALOHA , is 2 times the frame transmission time.
62
Procedure for Pure ALOHA
63
• The time-out period is equal to the maximum possible round-trip propagation delay, which is
twice the amount of time required to send a frame between the two most widely separated
stations (2 x Tp) The back-off time TB is a random value that normally depends on K (the
number of attempted unsuccessful transmissions). The formula for TB depends on the
implementation. One common formula is the binary exponential back-off.
• In this method, for each retransmission, a multiplier in the range 0 to 2K - 1 is randomly chosen
and multiplied by Tp (maximum propagation time) or Tfr (the average time required to send
out a frame) to find TB' Note that in this procedure, the range of the random numbers
increases after each collision. The value of Kmax is usually chosen as 15.
64
Slotted Aloha
• The slotted Aloha is designed to overcome the pure Aloha's efficiency because pure Aloha has a very high
possibility of frame hitting. In slotted Aloha, the shared channel is divided into a fixed time interval called slots.
• So that, if a station wants to send a frame to a shared channel, the frame can only be sent at the beginning of
the slot, and only one frame is allowed to be sent to each slot.
• In slotted ALOHA we divide the time into slots of Tfr s and force the station to send only
at the beginning of the time slot. The following figure shows an example of frame
collisions in slotted ALOHA.
• Because a station is allowed to send only at the beginning of the synchronized time slot,
if a station misses this moment, it must wait until the beginning of the next time slot.
This means that the station which started at the beginning of this slot has already
finished sending its frame. But, still there is the possibility of collision if two stations try
to send at the beginning of the same time slot. However, the vulnerable time is now
reduced to one-half, equal to Tfr. The following figure shows the situation.
•
66
CSMA (Carrier Sense Multiple Access)
• It is a carrier sense multiple access based on media access protocol to sense the traffic on a channel
(idle or busy) before transmitting the data. It means that if the channel is idle, the station can send data
to the channel. Otherwise, it must wait until the channel becomes idle. Hence, it reduces the chances
of a collision on a transmission medium.
• The possibility of collision still exists because of propagation delay, when a station sends a frame, it still
takes time (although very short) for the first bit to reach every station and for every station to sense it. In
other words, a station may sense the medium and find it idle, only because the first bit sent by another
station has not yet been received. At time t1 station B senses the medium and finds it idle, so it sends a
frame. At time t2 (t2> t1) station C senses the medium and finds it idle because, at this time, the first bits
from station B have not reached station C. Station C also sends a frame. The two signals collide and both
frames are destroyed.
68
Vulnerable Time:
• The vulnerable time for CSMA is the propagation time Tp. This is the time needed for a signal to
propagate from one end of the medium to the other. When a station sends a frame, and any other station
tries to send a frame during this time, a collision will result. But if the first bit of the frame reaches the end
of the medium, every station will already have heard the bit and will refrain from sending. The following
figure shows the worst case. The leftmost station A sends a frame at time t1 which reaches the rightmost
station D at time t1 + Tp. The gray area shows the vulnerable area in time and space.
69
70
(i) I-persistent CSMA
• In this method, station that wants to transmit data continuously senses the channel to check whether the channel is idle or
busy.
• If the channel is busy, the station waits until it becomes idle.
• When the station detects an idle-channel, it immediately transmits the frame with probability 1. Hence it is called I-persistent
CSMA.
• This method has the highest chance of collision because two or more stations may find channel to be idle at the same time
and transmit their frames.
• When the collision occurs, the stations wait a random amount of time and start allover again.
71
Drawback of I-persistent
• The propagation delay time greatly affects this protocol. Let us suppose, just after the station I begins its transmission,
station 2 also became ready to send its data and senses the channel. If the station I signal has not yet reached station 2,
station 2 will sense the channel to be idle and will begin its transmission. This will result in collision. Even if propagation
delay time is zero, collision will still occur. If two stations became .ready in the middle of third station’s transmission,
both stations will wait until the transmission of first station ends and then both will begin their transmission exactly
simultaneously. This will also result in collision.
72
(ii)Non-persistent CSMA
• In this scheme, if a station wants to transmit a frame and it finds that the channel is busy (some other station is
transmitting) then it will wait for fixed interval oftime.
• After this time, it again checks the status of the channel and if the channel is free it will transmit.
• A station that has a frame to send senses the channel.
• If the channel is idle, it sends immediately.
• If the channel is busy, it waits a random amount of time and then senses the channel again.
• In non-persistent CSMA the station does not continuously sense the channel for the purpose of capturing it when it detects
the end of previous transmission.
Advantage of non-persistent
• It reduces the chance of collision because the stations wait a random amount of time. It is unlikely that two or more
stations will wait for same amount of time and will retransmit at the same time.
Disadvantage of non-persistent
• It reduces the efficiency of network because the channel remains idle when there may be stations with frames to send.
This is due to the fact that the stations wait a random amount of time after the collision.
73
74
(iii) p-persistent CSMA
• This method is used when channel has time slots such that the time slot duration is equal to or greater than the
maximum propagation delay time.
• Whenever a station becomes ready to send, it senses the channel.
• If channel is busy, station waits until next slot.
• If channel is idle, it transmits with a probability p.
• With the probability q=l-p, the station then waits for the beginning of the next time slot.
• If the next slot is also idle, it either transmits or waits again with probabilities p and q.
• This process is repeated till either frame has been transmitted or another station has begun transmitting.
• In case of the transmission by another station, the station acts as though a collision has occurred and it waits a random
amount of time and starts again.
Advantage of p-persistent
• It reduces the chance of collision and improves the efficiency of the network.
75
76
If the frame is successfully received, the station sends another frame. If any collision is detected in the
CSMA/CD, the station sends a jam/ stop signal to the shared channel to terminate data transmission.
After that, All the stations it waits for a random time before sending a frame to a channel.
Wireless Lan 802.11
• Wireless LAN stands for Wireless Local Area Network. It is also called LAWN (Local
Area Wireless Network). WLAN is one in which a mobile user can connect to a Local
Area Network (LAN) through a wireless connection.
• The IEEE 802.11 group of standards defines the technologies for wireless LANs. For
path sharing, 802.11 standard uses the Ethernet protocol and CSMA/CA (carrier sense
multiple access with collision avoidance).
• Wireless LANs provide high speed data communication in small areas such as building
or an office. WLANs allow users to move around in a confined area while they are still
connected to the network.
80
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 a greater ease than wired LANs.
• The system is portable within the network coverage and access to the
network is not bounded by the length of the cables.
• Installation and setup is much easier than wired counterparts.
• The equipment and setup costs are reduced.
81
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.
82
Connecting Devices: Hubs, Bridges, Switches,
Routers and Gateways
• Frames arriving on any of the lines are sent out on all the others. It is broadcast device. If two
frames arrive at the same time, they will collide, just as on a coaxial cable.
• Like repeaters, hubs are physical layer devices that do not examine the link layer addresses or use
them in any way. It is not an intelligent device.
∙ Like a hub, a modern bridge has multiple ports, usually enough for 4 to 48 input lines of a certain type.
Unlike in a hub, each port is isolated to be its own collision domain.
∙ When a frame arrives, the bridge extracts the destination address (for Ethernet, it is 48 bit) from the frame
header and looks it up in a table to see where to send the frame.
∙ The bridge only outputs the frame on the port where it is needed and can forward multiple frames at the
same time.
• i. Store-and-forward switch: It stores the frame in the input buffer until the whole packet has arrived.
• ii. Cut-through switch: It forwards the packet to the output buffer as soon as the destination address is
received.
• They are responsible for receiving, analysing, and forwarding data packets among the connected
computer networks.
• When a data packet arrives, the router inspects the destination address, consults its routing tables
to decide the optimal route and then transfers the packet along this route.
• Features of Routers
∙ It connects different networks together and sends data packets from one network to another.
∙ A router can be used both in LANs (Local Area Networks) and WANs (Wide Area Networks).
∙ It transfers data in the form of IP packets. In order to transmit data, it uses IP address mentioned in
the destination field of the IP packet.
∙ Routers have a routing table in it that is refreshed periodically according to the changes in the
network. In order to transmit data packets, it consults the table and uses a routing protocol.
∙ In order to prepare or refresh the routing table, routers share information among each other.
∙ Routers are more expensive than other networking devices like hubs, bridges and switches.
∙ Wireless Router − They provide WiFi connection WiFi devices like laptops, smartphones etc. They can also
provide standard Ethernet routing. For indoor connections, the range is 150 feet while its 300 feet for outdoor
connections.
∙ Broadband Routers − They are used to connect to the Internet through telephone and to use voice over
Internet Protocol (VoIP) technology for providing high-speed Internet access. They are configured and
provided by the Internet Service Provider (ISP).
∙ Edge Routers − They connect the internal network to the external networks, and are suitable for transferring
data packets across networks. They use Border Gateway Protocol (BGP) for connectivity. There are two
types of edge routers, subscriber edge routers and label edge routers.
• Brouters − Brouters are specialised routers that can provide the functionalities of bridges as well. Like a
bridge, brouters help to transfer data between networks. And like a router, they route the data within the
devices of a network.
Gateway:
• A gateway is a network node that forms a passage between two networks operating with different
transmission protocols.
• The most common type of gateways, the network gateway operates at layer 3, i.e. network layer of
the OSI (open systems interconnection) model.
• However, depending upon the functionality, a gateway can operate at any of the seven layers of
OSI model. It acts as the entry – exit point for a network since all traffic that flows across the
networks should pass through the gateway.
• Only the internal traffic between the nodes of a LAN does not pass through the gateway.
• Features of Gateways:
∙ Gateway is located at the boundary of a network and manages all data that inflows or outflows from
that network.
∙ A gateway operates as a protocol converter, providing compatibility between the different protocols
used in the two different networks.
∙ The feature that differentiates a gateway from other network devices is that it can operate at any
layer of the OSI model.
∙ It also stores information about the routing paths of the communicating networks.
∙ When used in enterprise scenario, a gateway node may be supplemented as proxy server or
firewall.
∙ A gateway is generally implemented as a node with multiple NICs (network interface cards)
connected to different networks. However, it can also be configured using software.
94
Difference between a gateway and a router
• Gateways and routers are similar in that they both can
be used to regulate traffic between two or more
separate networks. However, a router is used to join
two similar types of networks and a gateway is used to
join two dissimilar networks. Dissimilar could be used
to describe networks that use different primary
protocols.
• Due to this logic, a router may be considered a
gateway, but a gateway is not always considered a
router. Routers are the most common gateway, used to
connect a home or enterprise network to the internet.
95