0% found this document useful (0 votes)
14 views

Module 4 - Link Layer

Uploaded by

Ankit Raj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Module 4 - Link Layer

Uploaded by

Ankit Raj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Module 4 - Link Layer

Learning Objective:
After studying this module, students will be able to:
1. Understand the concept of Physical Layer, Packet Switching, Circuit Switching
2. Explain Multiplexing: TDM FDM.
3. Explain Multiple Access: Random Access, Controlled Access, Channelization
4. Know about LAN: Token Ring, FDDI, Ethernet- Fast Ethernet.
5. Understand the concept of Data Link Layer: Protocols, Error Detection and
Correction, Flow Control protocols, Error control protocols
Structure
4.1 Error Detection and Correction
4.2 Medium Access Control – ALOHA, CSMA/CD, CSMA/CA
4.3 Local Area Networks – Addresses and Address Resolution, Switches and Routers,
VLANs, Label Switching
4.4 Summary
4.5 References
4.1 Error Detection and Correction
Bit-level error detection and correction (detecting and correcting bit corruptions in data link
layer frames transmitted from one node to another physically connected neighbour) is
provided by the data link layer. It turns out that these are two services that are often used.
Chapter 3 explained that the transport layer also often provides error detection and correction
services. This section reviews some of the simplest techniques that can be used to detect and
possibly correct such bit errors. A thorough treatment of the theory and implementation of
this subject is itself the subject of many textbooks (e.g. [Schwartz 1980]), and the treatment
here is necessarily brief. The goal here is to intuitively understand the possibilities offered by
error detection and correction techniques, how some simple techniques work, and how they
are used in practice at the data link layer. to confirm.
Figure 5.2-1 shows our survey setup. At the sending node, the data D, which is to be
"protected" against bit errors, is enhanced with an error detection and correction bit EDC.
Data that is usually protected includes not only the datagrams passed by the network layer for
transmission over the link, but also link-level addressing information, sequence numbers, and
other fields in the headers of data link frames. included. Both D and EDC are sent to the
receiving node in link-level frames. A sequence of bits D' and EDC' is received at the
receiving node. Note that D' and EDC' may differ from the original D and EDC due to bit
flips during transmission.

Error Detection and Correction Scenario


The challenge for the receiver is to determine if D' is identical to the original D, since it only
received D' and EDC'. What is important is the exact wording of the recipient determination
in Figure 5.2-1 (we are not asking if an error occurred, but if an error was detected!). Error
detection and correction techniques may allow the receiver to recognize that bit errors have
occurred, but this is not always the case. This means that even with error detection bits,
undetected bit errors can occur H.

The recipient does not know that the information received contains bit errors. As a result, the
receiver may deliver a corrupted datagram to the network layer, or may be unaware that the
contents of another field in the frame's header have been corrupted.

Therefore, error detection schemes should be chosen to reduce the probability of such
occurrences. In general, more sophisticated error detection and correction techniques (that is,
techniques that are less likely to tolerate undetected bit errors) incur more overhead. More
computation is required to compute and transmit more error detection and correction bits.

Let's examine three techniques for detecting errors in transmitted data. Parity checks (to
illustrate the basic idea behind error detection and correction), checksum schemes (more
commonly used at the transport layer), and cyclic redundancy checks (typically used for data
used in the link layer).
Parity Checking
The simplest form of error detection is to use a single parity bit. Let D in Figure 5 be the
information to be sent

Figure 2: One-bit even parity


Operation on the receiving side is also simple with a single parity bit. The receiving side just
counts the number of 1's in her d+1 bits received. In an even parity scheme, if an odd number
of 1-valued bits are found, the receiver knows that at least one bit error has occurred.
Specifically, it recognizes that an odd number of bit errors have occurred.

But what if there is an even number of bit errors? You should be confident that this will cause
an undetected error. If the probability of bit errors is small, and one can assume that each bit
is independently erroneous, the probability of multiple bit errors in a packet is very small. In
this case, one parity bit is sufficient.

However, measurements have shown that errors often occur in "bursts" rather than
independently of each other. Clearly there is a need for a more robust error detection scheme
(and, fortunately, it's in use!). But before looking at error detection schemes in use, let's
consider a simple generalization of 1-bit parity to understand error correction techniques.

Figure 3: Two-dimensional even parity


Figure 3 shows a two-dimensional generalization of the single-bit parity scheme. Here,
the d bits in D are divided into i rows and j columns. A parity value is computed for each row
and for each column. The resulting i+j+1 parity bits are the data link frame's error detection
bits.
Now suppose there is a 1-bit error in the original d information bit. In this two-dimensional
parity scheme, parity in both columns and rows containing flipped bits is erroneous. So the
receiver not only knows that a single bit error has occurred, but actually uses the column and
row indices of the columns and rows with parity errors to identify the corrupted bit and
correct this error. can.
Figure 5.2-3 shows an example where the bit with value 0 at location (1,1) is corrupted and
switched to 1. This error is detectable and correctable at the receiving end. Although we have
focused on the original d information bits, one error in the parity bit itself is also detectable
and correctable. Two-dimensional parity can also detect any combination of two errors in one
packet (but not correctly!). Additional properties of the 2D parity scheme will be explored in
the last exercise of the chapter. The ability of a receiver to detect and correct errors is called
Forward Error Correction (FEC). These techniques are commonly used in audio storage and
playback devices such as audio CDs.
In a network environment, the FEC technique can be used alone or in combination with the
ARQ technique described in FEC techniques are valuable because they reduce the number of
retransmissions required. Perhaps more importantly, the error can be corrected immediately
on the receiving end. This avoids the sender having to wait for the round-trip delay required
to receive her NAK packet and propagate the retransmitted packet to the receiver. This is a
potentially important advantage for real-time network applications [Rubenstein 1998]. Recent
studies investigating his use of FEC in error control protocols include [Biersack 1992,
Nonnenmacher 1998, Byers 1998, Shacham 1990].
Checksum Method
In the checksum method, d is the data bit in Figure 5. possible to view the bit string to be sent
as a polynomial whose coefficients are the 0 and 1 values in the bit string, with operations on
the bit string interpreted as polynomial arithmetic.

Figure 4: CRC codes


The CRC code works like this: Consider a d-bit data piece D that the sending node wants to
send to the receiving node. The sender and receiver must first agree on an r+1 bit pattern
known as the generator. Let this be G.

The most significant (leftmost) bit of G must be 1. Figure 4 shows the key idea behind the
CRC code. Given a data item D, the sender selects r additional bits R and the resulting d+r bit
pattern (interpreted as a binary number) is exact in G using modulo-2 arithmetic. Add them to
D so that it is divisible.

Therefore, the process of error checking with CRC is straightforward. The receiver divides
the received bit d+r by G. If the remainder is non-zero, the receiver knows that an error has
occurred. Otherwise the data is accepted as correct.

All CRC calculations are performed in modulo 2 arithmetic, with no extra carry or borrow in
subtraction. This means that addition and subtraction are identical and both correspond to
bitwise exclusive OR (XOR) of the operands. For example yes

1011 XOR 0101 = 1110


1001 XOR 1101 = 0100
Also, we similarly have
1011 - 0101 = 1110
1001 - 1101 = 0100
Multiplication and division are the same as in base 2 arithmetic, except that any required
addition or subtraction is done without carries or borrows. As in regular binary arithmetic,
multiplication by 2k left shifts a bit pattern by k places. Thus, given D and R, the
quantity D*2r XOR R yields the d+r bit pattern shown in Figure 5.2-4. We'll use this
algebraic characterization of the d+r bit pattern from Figure 5.2-4 in our discussion below.
Let us now turn to the crucial question of how the sender computes R. Recall that we want to
find R such that there is an n such that
D*2r XOR R = nG
That is, we want to choose R such that G divides into D*2rXOR R without remainder. If we
exclusive-or (i.e., add modulo 2, without carry) R to both sides of the above equation, we get
D*2r = nG XOR R
This equation tells us that if we divide D*2r by G, the value of the remainder is precisely R.
In other words, we can calculate R as
R = remainder ( D*2r / G )
Figure 5: An example CRC calculation
Figure 5 illustrates this calculation for the case of D = 101110, d = 6 and G = 1001, r=3.
The nine bits transmitted in this case are 101110 011. You should check these calculations for
yourself and also check that indeed D2r = 101011 * G XOR R.

International standards have been defined for 8-, 12-, 16- and 32-bit generators, G. An 8-bit
CRC is used to protect the 5-byte header in ATM cells. The CRC-32 32-bit standard, which
has been adopted in a number of link-level IEEE protocols, uses a generator of

GCRC-32 = 100000100110000010001110110110111

Each of the CRC standards can detect burst errors of less than r+1 bits and any odd number
of bit errors. Furthermore, under appropriate assumptions, a burst of length greater
than r+1 bits is detected with probability 1 - 0.5r. The theory behind CRC codes and even
more powerful codes is beyond the scope of this text.

4.2 Medium Access Control – ALOHA, CSMA/CD, CSMA/CA


A media access control is a network data transfer policy that determines how data is
transmitted between two computer terminals through a network cable. The media access
control policy involves sub-layers of the data link layer 2 in the OSI reference model.
The essence of the MAC protocol is to ensure no collisions and facilitate the transmission of
data packets between two computer terminals. Collisions occur when two or more end
devices send data/information at the same time. This leads to communication disruptions and
can prove costly for organizations that rely heavily on data transmission.
Media Access Control Methods
This network channel is the network channel through which data is sent between end nodes to
avoid collisions, and there are three different methods that serve this purpose.
1. Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA)
2. Carrier Sense Multiple Access with Collision Detection (CSMA/CD)
3. Request Priority
4. Token Passing Coordinated shared communication using access to network channels
ALOHA scheme and arbitration. Developed in the 1970s by Norman Abramson and
collaborators at the University of Hawaii. The system was originally developed for
terrestrial-based broadcasting, but is now used in satellite communication systems.
When two or more systems try to transmit on the same channel at the same time, a shared
communication system such as ALOHA must handle collisions.
Nodes in the ALOHA system transmits whenever data is ready to be transmitted. If other
nodes are transmitting at the same time, a collision will occur and the transmitted frame will
be lost. However, a node can confirm that a frame has been sent by listening for broadcasts
on media, including itself.
ALOHA means "hello".
ALOHA is basically a multiple access protocol that describes how all end devices can access
the medium without interfering or colliding with each other. Works at the data link layer.
Roberts created a protocol in 1972 where he doubled the capacity of ALOHA. The Slotted
ALOHA protocol divides the time interval into individual slots, each corresponding to a
frame time.
To avoid collisions, this approach requires synchronization between sending nodes.
version of ALOHA pure ALOHA Total transmission time for pure ALOHA is continuous.
Stations transmit frames whenever frames are available. The sender waits an arbitrary amount
of time before retransmitting a frame if it collides and is discarded.
Slotted ALOHA
Slotted ALOHA increases pure ALOHA capacity and reduces collisions. Slots are discrete
periods used to divide shared channels. Stations can only transmit data at the beginning of
each timeslot. Collisions can occur even if multiple stations attempt to transmit at the start of
the same time slot.
CSMA/CD
It is a MAC (Media Access Control) protocol. Defines how a network device responds when
two devices try to use a data channel simultaneously and a data collision occurs. CSMA/CD
rules define how long a device should wait in case of a collision. A medium often uses
multiple data nodes, so each data node receives transmissions from each other node on the
medium.
There are three CSMA access modes: 1 Persistent, P Persistent, and O Persistent. 1-persistent
is used in his CSMA/CD systems such as Ethernet. This mode waits for the media to be idle
before sending data. P-persistent is used in his CSMA/CA (collision avoidance) systems such
as Wi-Fi. This mode waits for the medium to become idle before sending data with
probability p. If the data node does not send data (probability 1-p), the sender waits for the
medium to become idle again. Then send the data with the same probability p. O-persistent is
used in Cobra Net, LonWorks, and Controller Area Networks. In this mode, each data node is
assigned a transmission order. When the medium is idle, the next data node can send data.
The next data node in line waits for the medium to become idle again before sending its data.
After each data node sends its data, the send order is updated to reflect which data nodes have
already sent, and each data node moves through the queue.
CSMA/CA
WLAN uses a mechanism called Carrier Sense, Multiple Access/Collision Avoidance
(CSMA/CA). Unlike Ethernet, wireless media cannot detect collisions. WLAN does not
allow devices to send and receive data at the same time. You can only do one or the other.
Therefore, collisions cannot be detected. To avoid collisions, devices use Ready-to-Send
(RTS) and Clear-to-Send (CTS) signals. When the device is ready to transmit, it first senses
the airwaves of the current signal. If none, generate an RTS signal indicating that data is
about to be sent. It then transmits data and terminates with a CTS signal to indicate that
another wireless device is ready to transmit.
4.3 Local Area Networks – Address and Address Resolution, Switches and Routers,
VLANs, Label Switching
The Address Resolution Protocol (ARP) is used to resolve ever-changing Internet Protocol
(IP) addresses to a local area network (LAN).
This mapping step is important because IP addresses and MAC addresses are of different
lengths and must be translated so that systems can see each other. The most used IP today is
IP version 4 (IPv4). IP addresses are 32 bits long. However, MAC addresses are 48 bits long.
ARP translates 32-bit addresses to 48 and vice versa.
There is a networking model known as the Open Systems Interconnection (OSI) model. First
developed in the late 1970s, the OSI model uses layers to help IT teams visualize what is
happening in a particular network system. This helps her identify which layers affect the
applications, devices, or software installed on her network, as well as her IT or engineering
professional responsible for managing that layer.
MAC addresses, also known as the data link layer, establish and terminate connections
between two physically connected devices so that data transfers can occur. IP addresses are
also called the network layer, or the layer responsible for forwarding packets of data through
various routers. ARP works between these layers.

Working of ARP
When a new computer joins a local area network (LAN), it is given a unique IP address for
identification and communication purposes.
A data packet arrives at the gateway and is intended for a specific host computer. A gateway,
the hardware on a network that allows data to flow from one network to another, asks the
ARP program to find a MAC address that matches an IP address. The ARP cache maintains a
list of each IP address and its associated MAC address.

The ARP cache is dynamic, but users on the network can also configure static ARP tables
containing IP and MAC addresses.

An ARP cache is maintained by all operating systems on IPv4 Ethernet networks. Each time
a device requests a MAC address to send data to another device connected to the LAN, the
device checks her ARP cache to see if an IP to MAC address connection has already been
established. Make sure, If it exists, no new request is needed. However, if translation has not
yet occurred, a request for a network address is sent and ARP is performed.

The size of the ARP cache is limited by design, addresses typically remain in the cache for
only a few minutes. It is emptied periodically to free up disk space. This design is also for
privacy and security to prevent IP address theft and spoofing by cyber attackers. MAC
addresses are fixed, but IP addresses are constantly updated.

Clean-up process removes unused addresses. This also applies to data related to
communication failures with computers that are not connected to the network or powered on.

Address Resolution Protocol and its relationship to DHCP and DNS

-ARP is the process of associating a dynamic IP address with a physical machine's MAC
address.

Router versus Switch comparison chart

Router Switch

Layer Network Layer (Layer 3 devices) Data Link Layer. Network


switches operate at Layer 2 of the
OSI model.

Function Directs data in a network. Passes Allow connections to multiple


data between home computers, and devices, manage ports, manage
between computers and the modem. VLAN security settings

Data Packet Frame (L2 Switch) Frame &


Transmission Packet (L3 switch)
form

Ports 2/4/5/8 Switch is a multiport Bridge. 24/48


ports

Device Type Networking device Active Device (With Software) &


Networking device

Transmission At Initial Level Broadcast and First broadcast; then unicast &
Type Unicast & Multicast multicast as needed.

Used in (LAN, LAN, MAN, WAN LAN


MAN, WAN)

Table Store IP address in the Routing table Switches use content accessible
and maintain the address on its own. memory CAM tables which are
typically accessed by ASIC
(Application Specific integrated
chips).

Transmission Full duplex Half/Full duplex


Mode

Broadcast In Router, every port has its own Switch has one broadcast domain
Domain Broadcast domain. [unless VLAN implemented]

Definition A router is a networking device that A network switch is a computer


connects a local network to other networking device that is used to
local networks. At the Distribution connect many devices together on
Layer of the network, routers direct a computer network. A switch is
traffic and perform other functions considered more advanced than a
critical to efficient network hub because a switch will on send
operation. msg to device that needs or request
it

Speed 1-100 Mbps (Wireless); 100 Mbps - 10/100 Mbps, 1 Gbps


1 Gbps (Wired)

Necessary for No, but provides additional No


Internet security and allows for multiple
Connection? connections.

Address used Uses IP address Uses MAC address


for data
transmission

Connections Can connect to multiple PCs or Can connect to multiple PCs or


networking devices via Ethernet or networking devices (L3 switches)
Wi-Fi via Cat5, Cat5e

Device Intelligent Device Intelligent Device


Category
Security Provides security measures to Port security
protect network

Used for Connecting two or more networks Connecting two or more nodes in
the same network (L2) or different
network (L3)

Manufacturers Cisco, Netgear, Linksys, Asus, TP- Cisco and D-link Juniper
Link, D-Link

Bandwidth Bandwidth sharing is Dynamic There is no sharing port can be 10,


sharing (Enables either static or dynamic 100, 1000 and 10000 Mbps
bandwidth sharing for modular cable individual
interfaces. The default percent-value
is 0. The percent-value range is 1-
96.)

Routing Take faster routing decisions Take more time for complicated
Decision routing decisions

NAT (Network Routers can perform NAT Switches cannot perform NAT
Address
Translation)

Faster In a different network environment In a LAN environment, an L3


(MAN/ WAN), a router is faster than switch is faster than a router (built-
an L3 switch. in switching hardware)

Features Firewall VPN Dynamic handling of Priority rt range On/Off setting of


Bandwidth port VLAN Port mirroring

Examples Linksys WRT54GL Juniper MX & Alcatel's OmniSwitch 9000; Cisco


EX series Cisco 3900, 2900, 1900 Catalyst switch 4500 and 6500 (10
Gbps)

4.4 Summary
⮚ The task of the data link layer is to convert the raw bit stream offered by the physical
layer into a stream of frames for use by the network layer.
⮚ Various framing methods are used, including character count, byte stuffing, and bit
stuffing. Data link protocols can provide error control to retransmit damaged or lost
frames.
⮚ To prevent a fast sender from overrunning a slow receiver, the data link protocol can
also provide flow control.
4.5 References
1. Tannenbaum, “Computer Network”, Pearson Education
2. Godbole, “Data Communications and Networking”, Tata Mc Graw-Hill
3. Forouzan,” Communications and Networking”, Tata Mc Graw-Hill

You might also like