CS 31204: Computer Networks – The Data Link Layer
INDIAN INSTITUTE OF TECHNOLOGY
KHARAGPUR
Department of Computer Science and Engineering
Abhijnan Chakraborty
What We Have Learnt So Far …
Software, Kernel
Firmware, Device Driver
Hardware
Physical
Data Link
Network
Transport
Application
Indian Institute of Technology Kharagpur
The Data Link Layer
Physical
Data Link
Network
Transport
Application
Logical Link Control
Medium Access Control
Indian Institute of Technology Kharagpur
Every Layer Adds Up Their Own Services
Data Link
Network
Addressing
Routing
Framing and Access Control
Error Control
Flow Control
Switching
Physical
AD/DA Conversion
Modulation
Coding
Analog Communication
MAC
LLC
Indian Institute of Technology Kharagpur
Data Link Layer Switching
Do not send traffic onto ports where it is not needed
Indian Institute of Technology Kharagpur
Data Link Layer Switching
Indian Institute of Technology Kharagpur
Learning Switches / Bridges
Collision Domain - 1
Collision Domain - 2
The old topology – not used now a days
This topology is mostly used
- Single machine at every switch port
Indian Institute of Technology Kharagpur
Learning Switches / Bridges
Indian Institute of Technology Kharagpur
Learning Switches/ Bridges
Indian Institute of Technology Kharagpur
Learning Switches / Bridges
Port A
Source = MAC1 Destination = MAC2
Indian Institute of Technology Kharagpur
Learning Switches / Bridges
Port A
Source = MAC1 Destination = MACx
Port A, MAC1
Indian Institute of Technology Kharagpur
Learning Switches / Bridges
Port A
Port A, MAC1
Source = MACx Destination = MAC1
Delete old entries if not used for some time
Indian Institute of Technology Kharagpur
Learning Switches / Bridges – The Rules / Mechanism
Source: Computer Network, Tanenbaum, Wetherall, The Medium Access Control Sublayer, Section 8
Indian Institute of Technology Kharagpur
Cut Through Switching
Indian Institute of Technology Kharagpur
Spanning Tree Switches
Indian Institute of Technology Kharagpur
Spanning Tree Switches
B1
B2
B3
B4
B5
B6
Indian Institute of Technology Kharagpur
Spanning Tree Protocol (STP)
Indian Institute of Technology Kharagpur
Spanning Tree Protocol (STP)
Indian Institute of Technology Kharagpur
Spanning Tree Protocol (STP)
“I think that I shall never see�A graph more lovely than a tree.�A tree whose crucial property�Is loop-free connectivity.�A tree that must be sure to span�So packets can reach every LAN.�First, the root must be selected.�By ID, it is elected.�Least-cost paths from root are traced.�In the tree, these paths are placed.�A mesh is made by folks like me,�Then bridges find a spanning tree.”
-Radia Perlman
Indian Institute of Technology Kharagpur
Network Devices at Different Layers
Repeater, Hub
Bridge, Switch
Router
Transport Gateway
Application Gateway
Physical Layer
Data Link Layer
Network Layer
Transport Layer
Application Layer
Indian Institute of Technology Kharagpur
Error Detection and Correction
Indian Institute of Technology Kharagpur
Error Detecting Codes - Parity Bit
Indian Institute of Technology Kharagpur
Error Detecting Codes – Interleaving Parity
Source: Computer Network, Tanenbaum, Wetherall, The Data Link Layer, Section 2
Even parity
N parity bits are used for kN data bits
k bit errors will be reliably detected with at most one error per row
Indian Institute of Technology Kharagpur
Error Detecting Codes – Checksum
Indian Institute of Technology Kharagpur
Example – 8 bit Checksum
Indian Institute of Technology Kharagpur
Error Detection Code – Cyclic Redundancy Check (CRC)
Indian Institute of Technology Kharagpur
Error Detection Code – Cyclic Redundancy Check (CRC)
Indian Institute of Technology Kharagpur
Error Detection Code – Cyclic Redundancy Check (CRC)
Indian Institute of Technology Kharagpur
CRC – Example
A polynomial code with r check bits can detect all burst errors less than on equal to r
Indian Institute of Technology Kharagpur
Forward Error Correction (FEC)
Indian Institute of Technology Kharagpur
Hamming Distance
Codeword-1 11001101
Codeword-2 01001010
XOR 10000111
Hamming distance is 4
Indian Institute of Technology Kharagpur
Hamming Distance for Error Detection
d
Indian Institute of Technology Kharagpur
Hamming Distance for Error Correction
d
d
2d + 1
Indian Institute of Technology Kharagpur
Hamming Distance for Error Correction - Example
Indian Institute of Technology Kharagpur
Hamming Codes - Encoding
P1 | P2 | M3 | P4 | M5 | M6 | M7 | P8 | M9 | M10 | M11 |
0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |
2x positions are for parity bits, rest for data bits
Gives a code with Hamming distance of 3
One bit error can be corrected
Indian Institute of Technology Kharagpur
Hamming Codes – Decoding with Single Bit Error
P1 | P2 | M3 | P4 | M5 | M6 | M7 | P8 | M9 | M10 | M11 |
0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 |
Check the parity bits
We can find out an error in M5
Indian Institute of Technology Kharagpur
Hamming Codes – Decoding with Single Bit Error
Check the parity bits
We can find out a mismatch at M7, M6 and M5
We can correct at most one bit error
P4 is the common parity bit – so the error is there
P1 | P2 | M3 | P4 | M5 | M6 | M7 | P8 | M9 | M10 | M11 |
0 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |
Indian Institute of Technology Kharagpur
Framing
00110101000100010
Indian Institute of Technology Kharagpur
Flag bits at the Beginning of the Frame
Indian Institute of Technology Kharagpur
Ethernet Frame Structure
Indian Institute of Technology Kharagpur
Byte Stuffing (PPPoE)
A
SFD
B
A
ESC
SFD
B
A
ESC
B
A
ESC
ESC
B
Indian Institute of Technology Kharagpur
Bit Stuffing (HDLC)
Indian Institute of Technology Kharagpur
Bit Stuffing Example
Indian Institute of Technology Kharagpur
The Channel Allocation Problem
Devices are connected to a hub
A wireless Network
A Cellular Network
Indian Institute of Technology Kharagpur
Multiple Access Protocols
Multiple access protocol
Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross
Indian Institute of Technology Kharagpur
Static Channel Allocation
Indian Institute of Technology Kharagpur
Time Division Multiple Access (TDMA)
1
3
4
1
3
4
6-slot
frame
6-slot
frame
Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross
Indian Institute of Technology Kharagpur
Frequency Division Multiple Access (FDMA)
frequency bands
time
FDM cable
Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross
Indian Institute of Technology Kharagpur
Dynamic Channel Allocation
Indian Institute of Technology Kharagpur
Slotted ALOHA
Assumptions:
Operation:
randomization – why?
Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross
Indian Institute of Technology Kharagpur
Slotted ALOHA
Pros:
Cons:
1
1
1
1
2
3
2
2
3
3
node 1
node 2
node 3
C
C
C
S
S
S
E
E
E
C: collision
S: success
E: empty
Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross
Indian Institute of Technology Kharagpur
Slotted ALOHA: Throughput
Indian Institute of Technology Kharagpur
Slotted ALOHA: Throughput
Indian Institute of Technology Kharagpur
Pure ALOHA
t0 + 1
t0 - 1
t0
will overlap
with end of
i’s frame
will overlap
with start of
i’s frame
Indian Institute of Technology Kharagpur
Multiple Access Protocol
Indian Institute of Technology Kharagpur
Carrier Sense Multiple Access (CSMA)
Indian Institute of Technology Kharagpur
CSMA: collisions
spatial layout of nodes
Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross
Indian Institute of Technology Kharagpur
p-persistent CSMA
Indian Institute of Technology Kharagpur
Collision in CSMA (CSMA/CD)
Indian Institute of Technology Kharagpur
CSMA/CD
spatial layout of nodes
Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross
Indian Institute of Technology Kharagpur
Collision Detection and its Impact over MAC Frame Length
Indian Institute of Technology Kharagpur
Ethernet Performance - Contention Interval
Indian Institute of Technology Kharagpur
Ethernet Performance
Indian Institute of Technology Kharagpur
Ethernet Performance
Indian Institute of Technology Kharagpur
Ethernet Performance
Image Source: Computer Networks, Tanenbaum
Indian Institute of Technology Kharagpur
Can You Detect Collision over Wireless?
Indian Institute of Technology Kharagpur
Hidden Terminal Problem
Image Source: https://www.youtube.com/watch?v=X-H2tLesBUQ
Indian Institute of Technology Kharagpur
Exposed Terminal Problem
Image Source: https://en.wikipedia.org/wiki/Exposed_node_problem
Indian Institute of Technology Kharagpur
Wireless Scenario
Indian Institute of Technology Kharagpur
Virtual Carrier Sensing (VCS) – CSMA/CA
Image Source: Asymmetric RTS/CTS for Exposed Node Reduction in IEEE 802.11 Ad Hoc Networks
Request to Send (RTS)
Clear to Send (CTS)
Indian Institute of Technology Kharagpur
Setting up Network Allocation Vector (NAV)
Image Source: https://community.arubanetworks.com/t5/Technology-Blog/Understanding-802-11-Medium-Contention/ba-p/232034
Indian Institute of Technology Kharagpur
IEEE 802.11 Distributed Coordination Function (DCF)
Indian Institute of Technology Kharagpur
Virtual LAN (VLAN)
Image Source: https://www.cisco.com
Indian Institute of Technology Kharagpur
VLAN Support in 802.1Q
Indian Institute of Technology Kharagpur