0% found this document useful (0 votes)
61 views97 pages

DCN Unit - 3

The document discusses switching and the data link layer. It describes three types of switching: circuit switching, packet switching, and message switching. It then discusses various aspects of the data link layer, including its services, data link control, framing, flow and error control, error detection and correction techniques like CRC and checksum, sliding window protocols, and data link layer protocols like HDLC and PPP.

Uploaded by

Rohan Sai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views97 pages

DCN Unit - 3

The document discusses switching and the data link layer. It describes three types of switching: circuit switching, packet switching, and message switching. It then discusses various aspects of the data link layer, including its services, data link control, framing, flow and error control, error detection and correction techniques like CRC and checksum, sliding window protocols, and data link layer protocols like HDLC and PPP.

Uploaded by

Rohan Sai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 97

UNIT-III

Switching
Data Link layer

1
Switching
1. Circuit-Switched Networks
2. Packet Switching
3. Message Switching
Data Link Layer
Design issues in data link layer:
4. Services
5. Data Link Control
6. Framing
7. Flow and Error control
Error detection and correction:
8. CRC
9. Checksum
10. Hamming code
Flow control:
11. Sliding window protocols
Applications:
12. Data link layer protocols: HDLC, PPP
2
Introduction
• A network is a set of connected devices.
• Whenever we have multiple devices, we have the problem of how to
connect them to make one-to-one communication possible.
• Possible solutions are
- make a point-to-point connection between each pair of devices ( a
mesh topology)
- make a point-to-point connection between a central device and every
other device (a star topology)
- multipoint connections, a bus
• All the above are more or less impractical and wasteful when applied
to very large networks.
• A better solution is switching.

3
Switching
• A switched network consists of a series of interlinked nodes, called switches.

• Switches are devices capable of creating temporary connections between two or more
devices linked to the switch.

• In a switched network, some of these nodes are connected to the end systems, others
are used only for routing.

Switched Network 4
Taxonomy of Switched Networks

3. Message Switched Networks


In message switching, each switch stores the whole message and forwards it to the
next switch. It is phased out in general communications but still has networking
applications. 5
1. Circuit-switched Networks
• A circuit-switched network consists of a set of switches connected by physical links.
• A connection between two stations is a dedicated path made of one or more links.
• Each connection uses only one dedicated channel on each link.
• Each link is normally divided into n channels by using FDM or TDM.

A circuit-switched network 8-6


• Multiplexing can be implicitly included in the switch fabric.
• When end system A needs to communicate with end system M, system A
needs to request a connection to M that must be accepted by all switches as
well as by M itself.
• Note that end-to-end addressing is required for creating a connection
between the two end systems, but not required during data transfer.
• Circuit switching takes place at the physical layer.
• Before starting communication, the resources need to be reserved and
remain dedicated for the entire duration of data transfer. These resources,
such as channels, switch buffers, switch processing time, and switch i/o
ports.
• There is continuous flow of data although there may be periods of silence;
8-7

data are not packetized.


Circuit-switched Networks
Three phases
• Actual communication requires three phases:
- connection setup
- data transfer
- connection teardown

Setup phase
• Before the parties can communicate, a channel (circuit) is reserved on each link.
• Combination of channels defines the dedicated path.

Data transfer phase


• After the establishment of dedicated circuit (channels), the two parties can
transfer data.

Teardown phase
• When one of the parties needs to disconnect, a signal is sent to each switch to
release the resources.

8-8
• Not as efficient as the other two types of networks as resources
allocated for a connection are unavailable to other connections during
the entire duration of the connection.
• Delay is minimal.
• Switching at the physical layer

in the traditional telephone


network uses the circuit-

switching approach.

Delay in circuit-switched network


8-9
Circuit-Switched Network: Example 1
• A circuit-switched network to connect 8 telephones in a small area.

10
Circuit-Switched Network: Example 2
• A circuit-switched network that connects computers in two remote
offices of a private company.

11
2. Packet-Switched Networks

• If a message is going to pass through a packet-switched network, it needs


to be divided into packets of fixed or variable size.
• Size of the packet is determined by the network and governing protocol.
• In packet switching, there is no resource allocation for a packet, means
that there is no reserved bandwidth on the links, and there is no
scheduled processing time for each packet.
• Resources are allocated on demand.
• Allocation is done on a first-come, first served basis.

8-12
Datagram Networks
• In a datagram network, each packet is treated independently of all
others.

• Packets in this approach are referred to as datagrams.

• Switches in a datagram network are referred to as routers.

• Datagrams may arrive at their destination out of order.

• Datagrams may also be lost or dropped because of a lack of


resources.

• Sometimes referred to as connectionless networks.

• Switching in the Internet is done by using datagram approach at the


network layer.

8-13
Datagram Networks

Routing Table

• A switch in a datagram networks uses a routing table that is


based on the destination address.
• Routing tables are dynamic and are updated periodically.
• Every datagram carries a header.
• The destination address in the header of a datagram remains
the same during the entire journey of the packet.

8-14
Datagram Networks
• Efficiency of a datagram network is better than of a circuit-switched
network.
• Datagram network may have greater delay than a virtual-circuit
network.
• Although there are no setup and teardown phases, each datagram may
experience a wait at a switch before it is forwarded.
• Delay is not uniform.

8-15
Delay in datagram network
Virtual-Circuit Networks
• A virtual-circuit network (VCN) is a cross between a circuit-switched network and a
datagram network.
• It has some characteristics of both:
- there are setup, data transfer, and teardown phases as in a circuit-switched
network
(CSN)
- resources can be allocated during setup phase, as in a CSN, or on demand as in a
datagram network (DN)
- As in DN, data are packetized and each packet carries an address in the header. This
address is local i.e., it is the address of the next switch not the end system
- As in CSN, all packets follow the same path established during the connection
- VCN is normally implemented in the data link layer, while CSN is in physical layer
and
DN in the network layer

8-16
Virtual-Circuit Networks
Addressing
• Two types of addressing: global and local (virtual-circuit identifier: VCI)
• Global address is used only to create a VCI.

Virtual Circuit Identifier


- the identifier that is actually used for data transfer is called the VCI.
- unlike global address, it is a small number that has only switch scope, used by a
frame between two switches.

8-17
Virtual-Circuit Networks
Three Phases
• Data transfer phase, setup phase, teardown phase

Data Transfer Phase


• To transfer a frame from S to its D, all switches need to have a table entry for this
virtual-circuit.

Setup Phase
• Switch creates an entry for a virtual-circuit.
• Two steps are required: the setup request and the acknowledgement.

Teardown Phase
• Two frames are exchanged: the teardown request and teardown confirmation.

8-18
Data transfer Phase

Source-to-destination data transfer in a virtual-circuit network

19
Setup Phase: Setup Request

8-20
Setup Phase: Acknowledgement

8-21
Virtual-Circuit Networks
• In virtual-circuit switching, all packets belonging to the same source and
destination travel the same path; but the packets may arrive at the
destination with different delays if resource allocation is on demand.
• Switching at the data link layer in a switched WAN is normally implemented
by using virtual-circuit techniques.

8-22
4. Data Link Layer Services
• Two main functions of the data link layer are
- data link control
- media access control
5. Data Link Control
Data link control deals with the design and procedures for
communication between two adjacent nodes:
node-to-node communication

• Responsibilities of data link control are framing, flow control


and error control.

• Media access control – how to share the link


23
6. Framing
• Data link layer needs to pack bits into frames, so that each frame is
distinguishable from another

• Framing separates a message from one source to a destination, or from other


messages to other destinations, by adding a sender address and a destination
address

• A message is divided into smaller frames, to facilitate reliable transmission.

• Frames can be of fixed or variable size.

• Fixed-size framing: Eg. ATM

• Variable-size framing
– Need a way to define the end of the frame and the beginning of the next
– Character-oriented approach and bit-oriented approach
24
Character-Oriented Protocols
• Frame structure

• Byte stuffing: process of adding 1 extra byte whenever there is a flag


or escape character in the text

25
Bit-Oriented Protocols
• Frame structure

• Bit stuffing: process of adding one extra 0 whenever five consecutive


1s follow a 0 in the data

26
7. Flow and Error Control
• Data link control = flow control + error control

• Flow control refers to a set of procedures used to restrict the amount of data
that the sender can send before waiting for acknowledgement

• Error control in the data link layer is based on automatic repeat request (ARQ).

• ACK, NAK(Negative ACK), Piggybacking (ACKs and NAKs in data frames)

27
Error Detection and Correction
Data can be corrupted
during transmission.

Some applications require that


errors be detected and corrected.

In a single-bit error, only 1 bit in the data unit has changed.

A burst error means that 2 or more bits in the data unit have changed.

Single-bit error Burst error of length 8

To detect or correct errors, we need to send extra (redundant) bits with data.

28
Cyclic codes are special linear block codes with
one extra property. In a cyclic code, if a codeword
is cyclically shifted (rotated), the result is another
codeword.
Cyclic Redundancy Check
Hardware Implementation
Polynomials
Cyclic Code Analysis
Advantages of Cyclic Codes
Other Cyclic Codes

29
8. A CRC code with C(7, 4)

30
CRC encoder and decoder

31
Division in CRC encoder

32
Division in the CRC decoder for two cases

33
The CRC encoder design using shift registers

34
General design of encoder and decoder of a CRC code

35
Using Polynomials

• We can use a polynomial to represent a binary


word.
• Each bit from right to left is mapped onto a power
term.
• The rightmost bit represents the “0” power term.
The bit next to it the “1” power term, etc.
• If the bit is of value zero, the power term is
deleted from the expression.

36
A polynomial to represent a binary word

37
CRC division using polynomials

38
The divisor in a cyclic code is normally called the generator polynomial
or simply the generator.

In a cyclic code,
If s(x) ≠ 0, one or more bits is corrupted.
If s(x) = 0, either

a. No bit is corrupted. or
b. Some bits are corrupted, but the
decoder failed to detect them.

A good polynomial generator needs to have the following characteristics:


1. It should have at least two terms.
2. The coefficient of the term x0 should
be 1.
3. It should not divide xt + 1, for t
between 2 and n − 1.
4. It should have the factor x + 1.

39
Standard polynomials

40
9. CHECKSUM
The checksum is used in the Internet by several
protocols, not at the data link layer.
Suppose our data 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 data are not accepted.
We can make the job of the receiver easier if we send the negative (complement)
of the sum, called the checksum. In this case, we send (7, 11, 12, 0, 6, −36). The
receiver can add all the numbers received (including the checksum). If the result
is 0, it assumes no error; otherwise, there is an error.
41
42
10. Hamming Code
Hamming codes were originally designed with dmin = 3 (2 bit error detection and
single bit error correction).
A codeword consists of n bits of which k are data bits and r are check bits.
Let m = r, then we have: n = 2m -1
and k = n-m

Hamming code C(7, 4) - n=7, k = 4

43
The structure of the encoder and decoder for a Hamming code

Modulo 2 arithmetic Modulo 2 arithmetic


r0 = a2 + a1 + a0 s0 = b2 + b1 + b0 + q0
r1 = a3 + a2 + a1 s1 = b3 + b2 + b1 + q1
r2 = a1 + a0 + a3 s2 = b1 + b0 + b3 + q2

44
Logical decision made by the correction logic analyzer

Let us trace the path of three datawords from the sender to the destination:

1. The dataword 0100 becomes the codeword 0100011.


The codeword 0100011 is received. The syndrome is 000, the final
dataword is 0100.

2. The dataword 0111 becomes the codeword 0111001.


The received codeword is: 0011001. The syndrome is
011. After flipping b2 (changing the 1 to 0), the final
dataword is 0111.

3. The dataword 1101 becomes the codeword 1101000. The


codeword 0001000 is received. The syndrome is 101.
After flipping b0, we get 0000, the wrong dataword. This
shows that our code cannot correct two errors. 45
We need a dataword of at least 7 bits. Calculate
values of k and n that satisfy this requirement.
Solution
n = 2m − 1, k = n − m

1. If we set m = 3, the result is n = 23 − 1=7 and k =


7 − 3, or 4, which is < 7.

2. If we set m = 4, then n = 24 − 1 = 15 and k = 15 −


4 = 11, which satisfies the condition k>7. So the
code is C(15, 11)

46
Burst Errors
• Burst errors are very common, in particular in wireless environments
where a fade will affect a group of bits in transit. The length of the
burst is dependent on the duration of the fade.
• One way to counter burst errors, is to break up a transmission into
shorter words and create a block (one word per row), then have a
parity check per word.
• The words are then sent column by column. When a burst error
occurs, it will affect 1 bit in several words as the transmission is read
back into the block format and each word is checked individually.

47
Burst error correction using Hamming code

48
11. Sliding Window Protocols
Noiseless Channels: Simplest Protocol
• Simplest protocol with no flow or error control

49
Simplest Protocol
• Sender-site algorithm

• Receiver-site algorithm

50
Stop-and-Wait Protocol
• Simple tokens of ACK and flow control added

51
Stop-and-Wait Protocol
• Sender-site algorithm

• Receiver-site algorithm

52
Stop-and-Wait Protocol: Example

53
Noisy Channels: Stop-and-Wait ARQ

• Stop-and-wait Automatic Repeat Request (ARQ)


• Error correction in Stop-and-Wait ARQ is done by
keeping a copy of the sent frame and retransmitting of
the frame when the timer expires
• In Stop-and-Wait ARQ, we use sequence numbers to
number the frames. The sequence numbers are based on
modulo-2 arithmetic
• Acknowledgment number always announces in modulo-
2 arithmetic the sequence number of the next frame
expected.

54
Stop-and-Wait ARQ

55
• Sender-site algorithm

56
Stop-and-Wait ARQ
• Receiver-site algorithm

57
Stop-and-Wait ARQ: Example

58
Go-Back-N ARQ
• Pipelining improves the efficiency of the transmission
• In the Go-Back-N Protocol, the sequence numbers are modulo 2m, where m
is the size of the sequence number field in bits
• The send window is an abstract concept defining an imaginary box of size 2m
− 1 with three variables: Sf, Sn, and Ssize
• The send window can slide one or more slots when a valid acknowledgment
arrives.

59
Go-Back-N ARQ
• Receive window for Go-Back-N ARQ
• The receive window is an abstract concept defining an imaginary box of size 1
with one single variable Rn. The window slides when a correct frame has
arrived; sliding occurs one slot at a time.

60
Go-Back-N ARQ
• Sliding windows, Timers, ACK, Resending a frame

61
Go-Back-N ARQ: Send Window Size
• In Go-Back-N ARQ, the size of the send window must be less than 2m; the size
of the receiver window is always 1
• Stop-and-Wait ARQ is a special case of Go-Back-N ARQ in which the size of the
send window is 1

62
Go-Back-N ARQ: Sender Algorithm

63
Go-Back-N ARQ: Receiver Algorithm

64
Go-Back-N ARQ: Example 1

65
Go-Back-N ARQ: Example 2

66
Selective Repeat ARQ
• Sender window size

• Receive window size

67
Selective Repeat ARQ

68
Selective Repeat ARQ: Window Size
• The size of the sender and receiver window must be at most one-half of 2m

69
Selective Repeat ARQ: Sender-Site Algorithm

70
Selective Repeat ARQ: Receiver-Site Algorithm

71
Selective Repeat ARQ: Example

72
Piggybacking
• To improve the efficiency of the bidirectional protocols
• Piggybacking in Go-Back-N ARQ

73
12. HDLC
• High-level Data Link Control
• Two common transfer mode: normal response mode (NRM) and
asynchronous balanced mode (ABM)

74
HDLC: Frames
• I(information)-frames, S(supervisory)-frames, U(unnumbered frame)-
frames
• Flag field: 01111110 to identify both the beginning and the end of a frame
and serve as synchronization pattern for receiver
• FCS field: 2- or 4-byte ITU-T CRC for error detection

75
HDLC: Frames
• Control Field: 1- or 2-byte segment of the frame used for flow and
error control
• Determine the type of frame and define its functionality
• Control field for I-frame: P/F (poll/final bit for primary/secondary)

76
HDLC: Frames
• Control field for S-frame
• Receive ready (RR), Receive not ready (RNR), Reject (REJ) Selective
reject (SREJ)

77
HDLC: Frames
• Control field for U-frame

78
HDLC: Example 1
• Connection and disconnection

79
HDLC: Example 2
• Piggybacking without error

80
HDLC: Example 3
• Piggybacking with error

81
HDLC: Bit Stuffing and Unstuffing

82
Point-to-Point Protocol: PPP
• One of the most common protocols for point-to-point access
• Many Internet users who need to connect their home
computer to the server of an Internet service provider use
PPP
• A point-to-point link protocol is required to control and
manage the transfer of data
• PPP defines/provides
– the format of the frame to be exchanged between devices
– how two devices negotiate the establishment of the link and the exchange of
data
– how network layer data are encapsulated in the data link frame
– how two devices can authenticate each other
– multiple network layer services
– connection over multiple links
– Network address configuration
• But, several services are missing for simplicity
– no flow control, simple error control (detection and discard), no sophisticate
addressing for multipoint configuration
83
PPP Frame
• Flag: 01111110 the same as HDLC, but it treated as a byte because of PPP
is a byte-oriented protocol
• Address: 11111111 (broadcast address)
• Control: No need because PPP has no flow control and limited error
control
• PPP is a byte-oriented protocol using byte stuffing with the escape byte
01111101

84
PPP: Transition States

85
PPP: Multiplexing
• PPP uses another set of other protocols to establish the link, authenticate
the parties, and carry the network layer data
• Three sets of protocols defined for powerful PPP: LCP, two APs, several
NCPs

86
LCP: Encapsulated in a Frame

8-87
LCP: Common Options
• Options are inserted in the information field of the
configuration packets

8-88
Authentication
• Authentication means validating the identity of a user
who needs to access
• PPP is designed for use over dial-up links
 User authentication is necessary
• PPP has two protocols for authentication
– Password Authentication Protocol (PAP)
– Challenge Handshake Authentication Protocol
(CHAP)

89
Password Authentication Protocol (PAP)

90
Challenge Handshake Authentication
Protocol (CHAP)
• Three-way hand-shaking authentication protocol with greater security
than PAP

91
Network Control Protocol: NCP
• PPP is a multiple-network layer protocol.
• It can carry a network data packet from protocols defined by the
Internet, OSI, Xerox, DECnet, AppleTalk, Novel
• IPCP (IP Control Protocol)
– Configures the link used to carry IP packets in the Internet

92
IPCP Packet

IP Datagram in a PPP frame

93
Multiple PPP

94
Example (1)

95
Example (2)

96
The End

97

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy