Data-Link Layer in Wired Networks
Data-Link Layer in Wired Networks
Wired Networks
Chapter 5
INTRODUCTION
In networking, communication at the network layer is like sending
postcards from one person to another. These postcards, called
datagrams, travel from one host to another worldwide. The Internet is
a collection of interconnected networks, and to reach its destination, a
datagram has to pass through these networks.
So, your data goes through different networks (like local and wide-area
networks) connected by routers, and these are the nodes. The links
between them are like the paths. Picture it as a relay with two end
runners (your devices) and routers in between, each handling a part of
the race. The whole journey involves six nodes, and the links represent
the connections between them. Easy enough, right?
Two Types of Links
In networking, how data moves between nodes depends on the data-
link layer. This layer controls the use of the transmission medium—
whether it's fully utilized or shared. There are point-to-point links
(exclusive to two devices) and broadcast links (shared among multiple
pairs). Think of a landline call between friends as point-to-point, while
chatting on cell phones involves a broadcast link, shared with others
using the airwaves.
Two Sublayers
The data-link layer, which manages how data moves between nodes, has
two parts: data link control (DLC) and media access control (MAC). DLC
handles common issues for both point-to-point and broadcast links, while
MAC focuses on broadcast-specific matters. Think of it like sorting tasks—
DLC deals with shared problems, and MAC handles stuff unique to
broadcast links. We'll dive into DLC first, then MAC, and explore a protocol
from each category.
DATA LINK CONTROL (DLC)
Data link control manages communication between adjacent nodes,
focusing on framing, flow and error control, and error
detection/correction, regardless of dedicated or broadcast links.
Framing organizes bits, while flow and error control ensure smooth
transmission. Error detection techniques are covered later in this
section.
Framing
Physical layer moves bits as signals from source to destination, ensuring
synchronized bit durations. Data-link layer organizes bits into frames,
like putting a letter in an envelope. Frames have sender and receiver
addresses, separating messages. It's better to use smaller frames to
avoid retransmitting a whole message for a single-bit error.
Frame size - Frames can be fixed or variable in size. Fixed frames use
size as a delimiter, like ATM WAN's cells. Variable framing, common in
local-area networks, requires defining frame boundaries. Historically,
character-oriented and bit-oriented approaches were used for this
purpose.
Character-Oriented Framing
character-oriented framing involves sending data in 8-bit characters,
like those in ASCII. Frames start and end with an 8-bit flag. To avoid
confusion, an escape character is used when the flag pattern appears in
the data. However, this creates a new issue, so escape characters in the
data are marked with another escape character. This method helps
prevent errors when dealing with various types of information. Despite
its past popularity, character-oriented framing faces challenges with
modern coding systems like Unicode, leading to a shift toward bit-
oriented protocols.
Bit-Oriented Framing
so in bit-oriented framing, data is a bunch of bits representing text,
graphics, audio, etc. Frames begin and end with a special 8-bit pattern
(01111110). But if this pattern appears in the data, we use bit stuffing.
If there's a 0 followed by five 1s, we add an extra 0 to avoid confusion.
The receiver removes this extra bit. Even if there's a 0 after five 1s, we
still add a 0, which the receiver later removes. This prevents the actual
flag (01111110) from being mistaken for data. So, bit stuffing ensures
smooth communication in bit-oriented protocols.
Flow Control
As we discussed in the transport layer (Chapter 3), flow control
coordinates the amount of data that can be sent before receiving an
acknowledgment. In the data-link layer, flow control is one of the
duties of the data link control sublayer. The idea of flow control in the
data-link layer follows the same principle we discuss for the transport
layer. Although at the transport layer flow control is end-to-end (host-
to-host), flow control at the data-link layer is node-to-node, across the
link.
Error Control
Error control in the data-link layer involves both detecting and
correcting errors. It lets the receiver tell the sender about lost or
damaged frames, leading to their retransmission. Unlike the end-to-
end error control in the transport layer, data-link layer error control is
node-to-node, ensuring frames are not corrupted as they pass
through each link. In simpler terms, it's about making sure data gets
across the link without hiccups.
Error Detection and Correction
At the data-link layer, if a frame is corrupted between the two nodes, it
needs to be corrected before it continues its journey to other nodes.
However, most link-layer protocols simply discard the frame and let
the upper-layer protocols handle the retransmission of the frame.
Some wireless protocols, however, try to correct the corrupted frame.
Error Detection Error Correction
Checksum
Cyclic Redundancy
Check (CRC)
Types of Errors
When bits travel, interference can cause unpredictable changes in the
signal. A single-bit error means one bit flips from 0 to 1 or vice versa.
On the other hand, a burst error involves two or more bits changing.
Burst errors are more likely because the duration of noise is usually
longer than one bit, affecting a group of bits. The number of affected
bits depends on the data rate and noise duration—higher rates mean
more affected bits. In a nutshell, single-bit errors are isolated flips,
while burst errors involve consecutive bit changes due to longer
interference.
Redundancy
The central concept in detecting or correcting errors is redundancy. To
be able to detect or correct errors, we need to send some extra bits
with our data. These redundant bits are added by the sender and
removed by the receiver. Their presence allows the receiver to detect
or correct corrupted bits
Example
A code scheme has a Hamming distance dmin = 4. This code guarantees the detection of up to three errors (d
= s + 1 or s= 3).
Linear Block Codes
Most block codes used today are linear block codes. Nonlinear block
codes are less common because they're tricky to analyze and
implement. Linear block codes, which we focus on, follow a rule: when
you XOR (add modulo-2) two valid codes, you get another valid code.
The technical definition involves abstract algebra, but for now, just
know that linear block codes play nice with XOR.
Example- The code in Table (page 23) is a linear block code because the result of
XORing any codeword with any other codeword is a valid codeword. For example,
the XORing of the second and third codewords creates the fourth one.
Minimum Distance for Linear Block Codes
It is simple to find the minimum Hamming distance for a linear block
code. The minimum Hamming distance is the number of 1s in the
nonzero valid codeword with the smallest number of 1s.
Example- In our first code (Table page 23), the numbers of 1s in the
nonzero codewords are 2, 2, and 2. So the minimum Hamming distance
is dmin = 2.
Parity-Check Code
A well-known error-detecting code is the parity-check code. It's a linear
block code that adds a parity bit to a k-bit dataword, making it n bits (n
= k + 1). The parity bit is chosen to ensure an even total of 1s in the
codeword. This makes the minimum Hamming distance dmin = 2,
meaning it can detect single-bit errors. For example, a parity-check
code with k = 2 and n = 3 is in Table (page 23) and another with k = 4
and n = 5 is in Table (next page).
Simple parity-check code (5,4)
The encoder uses a generator to add a parity bit (r0) to a 4-bit
dataword. The trick is to make the total number of 1s in the 5-bit
codeword even. This is done by adding the data bits (modulo-2),
making r0 = a3 + a2 + a1 + a0 (modulo-2). If the sum is even, r0 is 0; if
odd, r0 is 1.
Example:
Consider the data unit to be transmitted is 10010001 and even parity is used.
Then, code word transmitted to the receiver = 100100011
Consider during transmission, code word modifies as 101100111. (2 bits flip)
On receiving the modified code word, receiver finds the number of 1’s is even and even parity is used.
So, receiver assumes that no error occurred in the data during transmission though the data is corrupted.
Cyclic Codes
Cyclic codes are special linear block codes that have a neat trick: if you
shift a codeword in a circular way (like a rotation), you get another valid
codeword. For instance, if 1011000 is a codeword, left-shifting it gives
0110001, which is also a codeword. This shifting works like this: b1 = a0,
b2 = a1, and so on, until b0 = a6. The last bit of the first word wraps
around to become the first bit of the second word. It's like a circular
dance of bits!
Cyclic Redundancy Check
Cyclic codes, like CRC (cyclic redundancy check), are used to correct
errors in networks. Here's a simple example: In the encoder, if the
dataword has 4 bits, the codeword has 7 bits. We add 3 zeros to the
dataword's right side, making it 7 bits. This 7-bit result goes through a
generator that uses a predefined divisor of size 4. The generator does
modulo-2 division, and the remainder (r2r1r0) is added to the
dataword to create the codeword.
The decoder gets the possibly corrupted codeword and feeds a copy of
all 7 bits to the checker, a replica of the generator. The checker's
remainder, a 3-bit syndrome (n − k), goes to a decision logic analyzer. If
all syndrome bits are 0s, the left 4 bits of the codeword are accepted as
the dataword (no error); otherwise, they're discarded (error).
Encoder
The encoder pads the dataword with zeros, divides it by the divisor
using XOR for addition and subtraction. The modulo-2 binary division is
similar to decimal division. Each step involves XORing the divisor with 4
bits of the dividend, creating a 3-bit remainder. If the leftmost bit is 0,
an all-0s divisor is used. Repeat until no bits remain, and the 3-bit
remainder becomes check bits (r2, r1, r0) added to the dataword for
the codeword.
Decoder
During transmission, the codeword may change. The decoder uses the
same division process as the encoder. The remainder is the syndrome.
If the syndrome is all 0s, the dataword is likely error-free, and it's
accepted. Otherwise, if the syndrome has any non-zero values, the data
is discarded. In the absence of errors, the syndrome is 000; if there's a
single error, the syndrome is not all 0s, like in the case shown with 011
in Figure next page.
Divisor
Choosing the divisor, like 1011, depends on the desired code properties.
Criteria are discussed on the book website. Standard divisors in
networking, like CRC-8 or CRC-32, are named based on the polynomial
degree, with bits one more than the degree. For instance, CRC-8 has 9
bits, and CRC-32 has 33 bits. Check Table for common divisors.
• Important Notes-
• If the CRC generator is chosen according to the above rules, then-
• CRC can detect all single-bit errors
• CRC can detect all double-bit errors provided the divisor contains at
least three logic 1’s.
• CRC can detect any odd number of errors provided the divisor is a
factor of x+1.
• CRC can detect all burst error of length less than the degree of the
polynomial.
• CRC can detect most of the larger burst errors with a high probability.
• Burst Errors. If we assume the length of the burst error is L bits and r
is the length of the remainder (r is the length of the generator minus
1; it is also the value of the highest power in the polynomial
representing the generator):
• Solution:
• The generator polynomial G(x) = x4 + x + 1 is encoded as 10011.
• Clearly, the generator polynomial consists of 5 bits.
• So, a string of 4 zeroes is appended to the bit stream to be transmitted.
• The resulting bit stream is 11010110110000.
• Now, the binary division is performed as-
From here, CRC = 1110.
Now,
The code word to be
transmitted is obtained by
replacing the last 4 zeroes
of 11010110110000 with
the CRC.
Thus, the code word
transmitted to the receiver
= 11010110111110.
• Q. A bit stream 10011101 is transmitted using the standard CRC method. The
generator polynomial is x3+1.
• What is the actual bit string transmitted?
• Suppose the third bit from the left is inverted during transmission. How will
receiver detect this error?
• Solution:
• Part-01:
• The generator polynomial G(x) = x3 + 1 is encoded as 1001.
• Clearly, the generator polynomial consists of 4 bits.
• So, a string of 3 zeroes is appended to the bit stream to be transmitted.
• The resulting bit stream is 10011101000.
• Now, the binary division is performed and the remainder is obtained as 0100.
• From here, CRC = 100. (As 3 zeros were intially appended)
• Now,
• The code word to be transmitted is obtained by replacing the last 3 zeroes of
10011101000 with the CRC.
• Thus, the code word transmitted to the receiver = 10011101100.
• Part-02:
• According to the question,
• Third bit from the left gets inverted during transmission.
• So, the bit stream received by the receiver = 10111101100.
• Now,
• Receiver performs the binary division with the same generator polynomial which
gives the remainder as 0100.
• The remainder obtained on division is a non-zero value [i.e., 100 (Taking 3 bits).
• This indicates to the receiver that an error occurred in the data during the
transmission.
• Therefore, receiver rejects the data and asks the sender for retransmission.
• Q. Data word to be sent - 100100 and the generator polynomial is x3 + x2 + 1.
Perform the following:
• Case 1: When the receiver receives the correct codeword.
• Case 2: Fourth bit from the left gets inverted during transmission.
Checksum
Checksum is a method for detecting errors in a message. It's commonly
used in Internet communication at the network and transport layers.
The process involves dividing the message into m-bit units at the
source, creating a checksum, and sending it along. At the destination, a
new checksum is generated using the received message and original
checksum. If the new checksum is all 0s, the message is accepted;
otherwise, it's discarded. In practice, the checksum unit doesn't have to
be added at the message's end; it can be inserted anywhere.
Example
Suppose the message is a list of five 4-bit numbers that we want to send
to a destination. In addition to sending these numbers, we send the sum
of the numbers. For example, if the set of numbers is (7, 11, 12, 0, 6),
we send (7, 11, 12, 0, 6, 36), where 36 is the sum of the original
numbers. The receiver adds the five numbers and compares the result
with the sum. If the two are the same, the receiver assumes no error,
accepts the five numbers, and discards the sum. Otherwise, there is an
error somewhere and the message not accepted.
One’s Complement Addition
The issue with the previous example is that the sum may require more
than 4 bits. To address this, one's complement arithmetic can be used,
allowing representation of unsigned numbers between 0 and 2^(m) − 1
using only m bits. If a number exceeds m bits, the extra leftmost bits
are added to the m rightmost bits through wrapping.
Example
In the previous example, the decimal number 36 in binary is (100100)2. To change
it to a 4-bit number we add the extra leftmost bit to the right four bits as shown
below.
Instead of sending 36 as the sum, we can send 6 as the sum (7, 11, 12, 0, 6, 6). The
receiver can add the first five numbers in one’s complement arithmetic. If the result
is 6, the numbers are accepted; otherwise, they are rejected.
Checksum
To simplify the receiver's task, we can send the complement of the sum,
known as the checksum. In one's complement arithmetic, finding the
complement involves flipping all bits. This is equivalent to subtracting
the number from 2^m − 1. In one's complement arithmetic, there are
two zeros: a positive zero with all bits set to 0 and a negative zero with
all bits set to 1 (2^m − 1). Adding a number to its complement results in
a negative zero (all bits set to 1). When the receiver adds all numbers,
including the checksum, it gets a negative zero, which can be
complemented again to obtain a positive zero.
Example
Let us use the idea of the checksum in Example 5.9. The sender adds all
five numbers in one’s complement to get the sum = 6. The sender then
complements the result to get the checksum = 9, which is 15 − 6. Note
that 6 = (0110)2 and 9= (1001)2; they are complements of each other.
The sender sends the five data numbers and the checksum (7, 11, 12, 0,
6, 9). If there is no corruption in transmission, the receiver receives (7,
11, 12, 0, 6, 9) and adds them in one’s complement to get 15.
The sender complements 15 to get 0. This shows that data have
not been corrupted. Figure shows the process.
Internet Checksum
Traditionally, the Internet has used a 16-bit checksum. The sender and the receiver
follow the steps depicted
Algorithm
Other Approaches to the Checksum
The traditional checksum method has a significant flaw—it fails to
detect errors if two 16-bit items are swapped during transmission. This
is because the traditional checksum doesn't consider the order of data
items; it treats each item equally. To address this issue, weighted
checksums like Fletcher and Adler have been introduced.
Fletcher Checksum
Fletcher checksum provides weighted calculations for data items based on their
position. Two algorithms, 8-bit and 16-bit, were proposed by Fletcher. The 8-bit version
operates on 8-bit data items, generating a 16-bit checksum. It uses two accumulators, L
and R, with R adding a weighted component. The calculation is done modulo 256. The
16-bit Fletcher works similarly but operates on 16-bit data items, creating a 32-bit
checksum, and the calculation is done modulo 65,536.
Adler Checksum
The Adler checksum is a 32-bit checksum with a simple algorithm. In
contrast to the 16-bit Fletcher, it operates on single bytes, uses a prime
modulus (65,521), and initializes L to 1 instead of 0. The use of a prime
modulo is shown to enhance error detection in certain data
combinations.
HAMMING CODE
Hamming code is a block code that is capable of detecting up to two simultaneous bit errors
and correcting single-bit errors. It was developed by R.W. Hamming for error correction.
In this coding method, the source encodes the message by inserting redundant bits within
the message. These redundant bits are extra bits that are generated and inserted at specific
positions in the message itself to enable error detection and correction. When the
destination receives this message, it performs recalculations to detect errors and find the bit
position that has error.
• Therefore, the 7-bit Hamming code which will be transmitted from the sender to
the receiver is: 1010101.
Cont..
• Q. Consider the hamming code 1001100. Suppose during transmission the first
two bits from left is fliped. How the receiver will detect this error?
• Solution:
MULTIPLE ACCESS PROTOCOLS
The data-link layer comprises two sublayers: data link control (DLC) and
media access control (MAC). DLC, discussed earlier, manages data
transfer on dedicated links like dial-up telephone lines. In contrast,
when sharing media with others, a MAC protocol is needed to
coordinate access. For instance, in cellular communication, where the
channel is not dedicated, multiple users share the same band. In
multipoint or broadcast links, a multiple-access protocol is essential to
regulate access, preventing collisions and ensuring fair usage. Various
protocols address this issue, categorized into three groups for shared
link access.
ACCESS CONTROL
• Types of Communication Links- Communication links enable the stations to
communicate with each other. Stations may communicate using the following
types of links-
• 1. Point to Point Link- Point to Point link is a dedicated link that exists between
the two stations. The entire capacity of the link is used for transmission between
the two connected stations only. Depending upon the Type Of Channel, the data
flow takes place between the stations.
• 2. Broadcast Link- Broadcast link is a common link to which multiple stations
are connected. The capacity of the link is shared among the connected stations for
transmission.
• Access Control is a mechanism that controls the access of stations to the
transmission [Link] links require the access [Link] is because the
link is shared among several stations.
• Consider a situation where- Multiple stations place their data packets on the link
and starts transmitting simultaneously. Such a situation gives rise to a collision
among the data packets. Collision of data packets causes the data to get
corrupt.
• Access Control Methods- Access control methods are the methods used for
providing access control. They prevent the collision or deal with it and ensures
smooth flow of traffic on the network. They are implemented at the data link
layer of the OSI reference model.
• RANDOM ACCESS: In random access or contention methods, no station is
superior to another station and none is assigned the control over another. No
station permits, or does not permit, another station to send. At each instance, a
station that has data to send uses a procedure defined by the protocol to make
a decision on whether or not to send. This decision depends on the state of the
medium (idle or busy). In other words, each station can transmit when it desires
on the condition that it follows the predefined procedure.
• Two features give this method its name:
1. First, there is no scheduled time for a station to transmit. Transmission is
random among the stations. That is why these methods are called random
access.
2. Second, no rules specify which station should send next. Stations compete with
one another to access the medium. That is why these methods are also called as
contention methods.
• In a random access method, each station has the right to the medium without being
controlled by any other station. However, if more than one station tries to send,
there is an access conflict-collision-and the frames will be either destroyed or
[Link] avoid access conflict or to resolve it when it happens, each station
follows a procedure that answers the following questions:
ØWhen can the station access the medium?
ØWhat can the station do if the medium is busy?
ØHow can the station determine the success or failure of the transmission?
ØWhat can the station do if there is an access conflict?
ALOHA: ALOHA, the earliest random access method, was developed at the
University of Hawaii in early 1970. It was designed for a radio (wireless) LAN, but
it can be used on any shared medium.
Versions of ALOHA:
1. PURE ALOHA:
It allows the stations to transmit data at any time whenever they want. After
transmitting the data packet, station waits for some time. Then, following 2 cases
are possible-
• Case-01: Transmitting station receives an acknowledgement from the receiving
[Link] this case, transmitting station assumes that the transmission is successful.
• Case-02:Transmitting station does not receive any acknowledgement within
specified time from the receiving station. In this case, transmitting station
assumes that the transmission is unsuccessful. Then, Transmitting station uses a
Back Off Strategy and waits for some random amount of time. After back off
time, it transmits the data packet again. It keeps trying until the back off limit is
reached after which it aborts the transmission.
• Efficiency-
Efficiency of Pure Aloha (η) = G x e-2G
where G = Number of stations willing to transmit data
• Maximum Efficiency-
Maximum value of η occurs at G = 1/2
Substituting G = 1/2 in the above expression, we get-
Maximum efficiency of Pure Aloha
= 1/2 x e-2 x 1/2
= 1 / 2e
= 0.184
= 18.4% The maximum efficiency of Pure Aloha is very less due to large number of
collisions.
Vulnerable time: Let us find the length of time, the vulnerable time, in which there
is a possibility of collision.
Pure ALOHA vulnerable time = 2 x Tfr,
Where, Tfr = frame transmission time.
Q.1. A pure ALOHA network transmits 200-bit frames on a shared channel of 200
kbps. What is the requirement to make this frame collision-free?
Ans: Average frame transmission time Tfr = 200 bits/200 kbps or 1 ms.
The vulnerable time is 2 x 1 ms =2 ms.
This means no station should send later than 1 ms before this station starts
transmission and no station should start sending during the 1 ms period that this
station is sending.
Q.2. A pure ALOHA network transmits 200-bit frames on a shared channel of 200 kbps.
What is the throughput if the system (all stations together) produces:
a. 1000 frames per second
b. 500 frames per second
c. 250 frames per second
Solution:
The frame transmission time is 200bit/200 kbps or 1 ms.
• a. If the system creates 1000 frames per second, this is 1 frame per millisecond. The load
is 1. In this case S = G x e-2G or S = 1 x e-2x1 or S = 0.135 (13.5 percent). This means that
the throughput is 1000 X 0.135 =135 frames. Only 135 frames out of 1000 will
probably survive.
• b. If the system creates 500 frames per second, this is (1/2) frame per millisecond. The
load is (1/2). In this case S = G x e-2G or or S = 1/2 x e-2x1/2 or S = 0.184 (18.4 percent).
This means that the throughput is 500 x 0.184 =92 and that only 92 frames out of 500
will probably survive.
• c. Throughput is 250 x 0.152 = 38. Only 38 frames out of 250 will probably survive.
2. Slotted Aloha-
Slotted Aloha divides the time of shared channel into discrete intervals called as time slots. Any
station can transmit its data in any time slot. The only condition is that station must start its
transmission from the beginning of the time slot. If the beginning of the slot is missed, then station
has to wait until the beginning of the next time slot. A collision may occur if two or more stations
try to transmit data at the beginning of the same time slot.
= 100 bits/sec
Throughput of slotted aloha = Total number of stations x Throughput of each station
Total number of stations = Throughput of slotted aloha / Throughput of each station
∴ N = 368.
Carrier Sense Multiple Access (CSMA)
To minimize the chance of collision and, therefore, increase the performance, the
CSMA method was developed. The chance of collision can be reduced if a station
senses the medium before trying to use it. Carrier sense multiple access (CSMA)
requires that each station first listen to the medium (or check the state of the
medium) before sending. In other words, CSMA is based on the principle "sense
before transmit".
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.
Persistence Methods:
• What should a station do if the channel is busy? What should a station do if the
channel is idle?
• Three methods have been devised to answer these questions: the I-persistent
method, the nonpersistent method, and the p-persistent method.
Q. Suppose nodes A and B are on same 10 Mbps Ethernet segment and the propagation delay
between two nodes is 225 bit times. Suppose A and B send frames at t=0, the frames collide
then at what time, they finish transmitting a jam signal. Assume a 48 bit jam signal.
Propagation delay (Tp)
= 225 bit times
= 225 bit / 10 Mbps
= 22.5 x 10-6 sec
= 22.5 μsec
At t = 0,
• Nodes A and B start transmitting their frame.
• Since both the stations start simultaneously, so collision occurs at the mid way.
• Time after which collision occurs = Half of propagation delay.
• So, time after which collision occurs = 22.5 μsec / 2 = 11.25 μsec.
At t = 11.25 μsec,
• After collision occurs at t = 11.25 μsec, collided signals start travelling back.
• Collided signals reach the respective nodes after time = Half of propagation delay
• Collided signals reach the respective nodes after time = 22.5 μsec / 2 = 11.25 μsec.
• Thus, at t = 22.5 μsec, collided signals reach the respective nodes.
At t = 22.5 μsec,
• As soon as nodes discover the collision, they immediately release the jam signal.
• Time taken to finish transmitting the jam signal = 48 bit time = 48 bits/ 10 Mbps =
4.8 μsec.
• Thus,
• Time at which the jam signal is completely transmitted
• = 22.5 μsec + 4.8 μsec
• = 27.3 μsec or 273 bit times
• More practise numericals can be found at the link:
• [Link]
Q.
Poll:
The poll function is used by the primary device to solicit transmissions from the secondary
[Link] the primary is ready to receive data, it must ask (poll) each device in turn if it has
anything to send. When the first secondary is approached, it responds either with a NAK frame if it
has nothing to send or with data (in the form of a data frame) if it does. If the response is negative (a
NAK frame), then the primary polls the next secondary in the same manner until it finds one with
data to send. When the response is positive (a data frame), the primary reads the frame and returns
an acknowledgment (ACK frame), verifying its receipt.
Token Passing:
In the token-passing method, the stations in a network are organized in a logical ring. In other words,
for each station, there is a predecessor and a successor. The predecessor is the station which is
logically before the station in the ring; the successor is the station which is after the station in the
ring. The current station is the one that is accessing the channel now. The right to this access has
been passed from the predecessor to the current station. The right will be passed to the successor
when the current station has no more data to send.
In this method, a special packet called a token circulates through the ring. The possession of the
token gives the station the right to access the channel and send its data. When a station has some
data to send, it waits until it receives the token from its predecessor. It then holds the token and
sends its data. When the station has no more data to send, it releases the token, passing it to the next
logical station in the ring. The station cannot send data until it receives the token again in the next
round.
In this process, when a station receives the token and has no data to send, it just passes the token to
the next station.
• Logical Ring:
• In a token-passing network, stations do not have to be physically connected in a ring; the
ring can be a logical one.
• Figure below show four different physical topologies that can create a logical ring.
In the physical ring topology, when a station sends the token to its successor, the token
cannot be seen by other stations; the successor is the next one in line. This means that the
token does not have to have the address of the next successor. The problem with this
topology is that if one of the links-the medium between two adjacent stations fails, the
whole system fails.
The dual ring topology uses a second (auxiliary) ring which operates in the reverse
direction compared with the main ring.
The second ring is for emergencies only. If one of the links in the main ring fails, the
system automatically combines the two rings to form a temporary ring. After the failed link
is restored, the auxiliary ring becomes idle again. Note that for this topology to work, each
station needs to have two transmitter ports and two receiver ports. The high-speed Token
Ring networks called FDDI (Fiber Distributed Data Interface) and CDDI (Copper
Distributed Data Interface) use this topology.
In the bus ring topology, also called a token bus, the stations are connected to a single
cable called a bus.
They, however, make a logical ring, because each station knows the address of its successor
(and also predecessor for token management purposes).
When a station has finished sending its data, it releases the token and inserts the
address of its successor in the token.
Only the station with the address matching the destination address of the token gets the
token to access the shared media.
In a star ring topology, the physical topology is a star. There is a hub, however, that acts as
the connector. The wiring inside the hub makes the ring; the stations are connected to this
ring through the two wire connections. This topology makes the network less prone to
failure because if a link goes down, it will be bypassed by the hub and the rest of the
stations can operate.
ARP
Address Resolution Protocol (ARP)
When a node wants to send an IP datagram to another node on the
same link, it has the recipient's IP address. The source host also knows
the IP address of the default router, and each router in the path obtains
the next router's IP address from its forwarding table. However, to
move a frame through a link, we need the link-layer address of the next
node, not just its IP address. This is where the Address Resolution
Protocol (ARP) comes in. ARP, an auxiliary protocol in the network layer,
maps an IP address to a logical-link address. It takes an IP address from
the IP protocol, translates it to the corresponding link-layer address,
and passes it to the data-link layer.
When a host or router needs the link-layer address of another node on its network, it sends
an ARP request packet. This packet contains the sender's link-layer and IP addresses, as well
as the receiver's IP address. Since the sender doesn't know the receiver's link-layer address,
the query is broadcast using the link-layer broadcast address. All nodes on the network
receive and process the ARP request, but only the intended recipient replies with an ARP
response containing its IP and link-layer addresses. The response is unicast directly to the
requesting node. This process allows a node (e.g., A) with an IP packet for another node (e.g.,
B) to discover B's link-layer address dynamically. After receiving the ARP reply, A can use B's
link-layer address for subsequent packet delivery.
Packet Format
The ARP packet format, illustrated in Figure 5.48, comprises several
fields. The hardware type field specifies the link-layer protocol type,
with Ethernet assigned the type 1. The protocol type field indicates the
network-layer protocol, with IPv4 represented by (0800)_16. The
source hardware and source protocol addresses contain variable-length
fields representing the sender's link-layer and network-layer addresses.
Similarly, the destination hardware and destination protocol address
fields define the receiver's link-layer and network-layer addresses. An
ARP packet is directly encapsulated into a data-link frame, which
requires a field indicating that the payload belongs to ARP, not the
network-layer datagram.
Example
A host with IP address N1 and MAC address L1 has a packet to send to
another host with IP address N2 and physical address L2 (which is
unknown to the first host). The two hosts are on the same network.
Show the ARP request and reply packets encapsulated in Ethernet
frames (see Figure on next page).
Solution
Figure on next page shows the ARP request and reply packets. Note
that the ARP data field in this case is 28 bytes, and that the individual
addresses do not fit in the 4-byte boundary. That is why we do not
show the regular 4-byte boundaries for these addresses. Also note that
the IP addresses are shown in hexadecimal.
Ethernet Frame format
WIRED LANS: ETHERNET PROTOCOL
This chapter explores wired local and wide area networks (LANs and
WANs) within the TCP/IP protocol suite. While LANs are designed for
limited areas, they often connect to wider networks like the Internet. In
the past, various LAN technologies existed, but Ethernet, with its
adaptability and evolution across generations, became the dominant
choice. Ethernet, developed in the 1970s, has undergone four
generations, accommodating increasing transmission rates from 10
Mbps to 10 Gbps.
Standard Ethernet
We call the initial Ethernet technology, operating at 10 Mbps, Standard
Ethernet. Despite subsequent advancements in Ethernet, certain
features of Standard Ethernet have remained unchanged. Exploring this
standard version will provide a foundation for understanding the
evolution of the other three Ethernet technologies.
Frame Format
The Ethernet frame contains seven fields, as shown in Figure
• Preamble - The preamble is a 56-bit field with alternating 0s and 1s
added at the physical layer of an Ethernet frame. It serves to alert the
receiving system about an incoming frame and helps synchronize its
clock if needed. This pattern provides an alert and a timing pulse,
allowing stations to miss some bits at the frame's beginning.
Importantly, the preamble is not formally considered part of the
frame itself.
• Start frame delimiter (SFD) - The Start Frame Delimiter (SFD) is a 1-
byte field with the pattern 10101011. It signals the start of an
Ethernet frame, serving as a final opportunity for synchronization.
The last 2 bits (11)_2 indicate that the next field is the destination
address. Essentially, the SFD functions as a flag, marking the
beginning of the variable-length Ethernet frame. Like the preamble,
the SFD is added at the physical layer.
• Destination address (DA) - The Destination Address field is six bytes
(48 bits) in an Ethernet frame, holding the link-layer address of the
intended recipient station or stations. This address is crucial for
addressing purposes, determining which station(s) should receive the
packet. When the receiver identifies its own link-layer address, a
multicast address for a group it belongs to, or a broadcast address, it
extracts the data from the frame and forwards it to the upper-layer
protocol specified by the type field's value.
• Source address (SA) - This field is also six bytes and contains the link-
layer address of the sender of the packet. We will discuss addressing
shortly.
• Type - The Type field in an Ethernet frame specifies the upper-layer
protocol encapsulated within the frame, such as IP, ARP, OSPF, etc.
Similar to the protocol field in a datagram or a port number in a
segment or user datagram, it facilitates multiplexing and
demultiplexing—determining how to handle the encapsulated data
based on the specified upper-layer protocol.
• Data - The Data field in an Ethernet frame carries data from upper-
layer protocols, ranging from a minimum of 46 to a maximum of
1500 bytes. If the upper-layer data exceeds 1500 bytes, it must be
fragmented across multiple frames. Conversely, if the data is less than
46 bytes, it's padded with extra 0s. A padded data frame is delivered
to the upper-layer protocol without removing the padding, placing
the responsibility on the upper layer to manage padding. The upper-
layer protocol needs to be aware of the data length, often facilitated
by a length-defining field, as seen in a datagram.
• CRC - The last field contains error detection information, in this case
a CRC-32. The CRC is calculated over the addresses, types, and data
field. If the receiver calculates the CRC and finds that it is not zero
(corruption in transmission), it discards the frame.