The Data Link Layer: Reading: Ch. 2.2, 2.6, 3.1, 3.2
The Data Link Layer: Reading: Ch. 2.2, 2.6, 3.1, 3.2
The Data Link Layer: Reading: Ch. 2.2, 2.6, 3.1, 3.2
• Network Categories
– DAN, LAN, MAN, WAN
2
Message, Segment, Packet, and Frame
host host
HTTP message
HTTP HTTP
TCP segment
TCP TCP
router router
Application OSI
Network Network
4
The Link Layer
Packet Network
host-to-host
Frame
Link
node-to-node
frame-by-frame
Physical
101101001000100101010 node-to-node
bit-by-bit
Link
Node Node
• Link: physical medium connecting nodes
– Twisted pair: the wire that connects to telephones
– Coaxial cable: the wire that connects to TV sets
– Optical fiber: high-bandwidth long-distance links
– Space: propagation of radio waves, microwaves, …
6
Links: Delay and Bandwidth
• Delay
– Latency for propagating data along the link
– Corresponds to the “length” of the link
– Typically measured in seconds
• Bandwidth
– Amount of data sent (or received) per unit time
– Corresponds to the “width” of the link
– Typically measured in bits per second
delay
7
Connecting More Than Two Nodes
Workstation Workstation
Workstation Workstation
Workstation Workstation
• Bus topology
. . .
• Ethernet cable:
10 Base 5
Baseband Cable no longer
10Mbps
(digital signalling) than 500 m
9
Broadcast Networks (2)
• Star topology
Hub
• Ethernet cable:
100 Base T
Baseband Twisted Pairs
100Mbps
(digital signalling)
• Broadcast medium
– All stations receive a copy of the message sent
– But most communication is intended to be only between
two computers on a network
16
Ethernet Physical Layer
Terminator
Transceiver
Cable
Host 4 Twisted Pairs
15 Pin Connectors
Channel Logic
Manchester Phase Encoding
17
Star Topology
Hub
18
Ethernet Physical Layer
Repeater
Host
Ethernet
segment
19
Ethernet Physical Restrictions
20
Manchester Encoding
Data stream 1 0 1 1 0 0
Encoded
bit pattern
21
Ethernet: MAC Layer
• Data encapsulation
– Frame Format
– Addressing
– Error Detection
• Access to the medium
– CSMA/CD
– Backoff Algorithm
22
Ethernet: Frame Format
Destination Source
Preamble MAC MAC Type Data CRC
address address
23
Ethernet – Questions:
24
Ethernet: MAC Layer
• Data encapsulation
– Frame Format
– Addressing
– Error Detection
• Access to the medium
– CSMA/CD
– Backoff Algorithm
25
Ethernet Addressing
• Broadcast address:
FF-FF-FF-FF-FF-FF
26
Question
27
Ethernet: MAC Layer
• Data encapsulation
– Frame Format
– Addressing
– Error Detection
• Access to the medium
– CSMA/CD
– Backoff Algorithm
28
Ethernet: Medium Access
29
Medium Access Protocols
• CSMA
– 1-Persistent CSMA
– Non-Persistent CSMA
– p-Persistent CSMA
• CSMA/CD
• Idea:
– Listen to the channel before transmitting a packet.
30
1-Persistent CSMA
packet
A B C
Transmit a packet
Collision
32
1-Persistent CSMA (cont’d)
A B C
• Example:
– If stations B and C become ready in the middle of A’s
transmission, B and C will wait until the end of A’s
transmission and then both will begin transmitted
simultaneously, resulting in a collision.
34
1- Persistent vs. Non-Persistent CSMA
packet
A B C
37
CSMA/CD
• In CSMA protocols
– If two stations begin transmitting at the same time, each
will transmit its complete packet, thus wasting the channel
for an entire packet time
• In CSMA/CD protocols
– The transmission is terminated immediately upon the
detection of a collision
– CD = Collision Detect
38
CSMA/CD
39
Collision detection time
How long does it take to realize there has been a collision?
Time=0
A B
T = end-to-end
Time=T-ε
propagation
delay
A B
Time=2T
A B
Worst case: 2 x T
To detect the collision, A must transmit for at least 2xT time.
40
Ethernet: MAC Layer
• Data encapsulation
– Frame Format
– Addressing
– Error Detection
• Access to the medium
– CSMA/CD
– Backoff Algorithm
41
Ethernet Backoff Algorithm
A B
42
Binary Exponential Backoff
A B
44
State Diagram for CSMA/CD
Packet?
No
Yes
Discard
Packet Jam channel
attempts < 16 b=CalcBackoff()
wait(b);
attempts++;
attempts == 16
45
Ethernet – Collision Detection
46
CSMA/CD – Question 1
H1
H2
H10 100
100
100 Hub
100 H3
H1
H2
100 100
H10
100 100
100
H9 100
100 H3
48
CSMA/CD – Question 3
49
Extending Networks with
Interconnecting Devices
Goals for Today’s Class
• Network Categories
– DAN, LAN, MAN, WAN
51
Interconnecting Devices
Ethernet Ethernet
Repeater Ethernet
Bridge
Router
Token- X.25
ring Network
Gateway
52
TCP/IP Suite and OSI Reference Model
OSI
TCP/IP Suite Reference
Model
53
Shuttling Data at Different Layers
Application gateway
Transport gateway
Frame Packet TCP User
Router header header header data
Bridge, switch
Repeater, hub
54
Physical Layer: Repeaters
Repeater
IP IP
LLC LLC
4, 5, 8, 9, 16,
32, 64 Ports
• Network Categories
– DAN, LAN, MAN, WAN
58
Link Layer: Bridges/LAN Switches
Token-ring
Bridge
IP IP
Bridge
LLC LLC LLC
802.3 MAC LAN 802.3 MAC 802.5 MAC LAN 802.5 MAC
59
Bridges vs. LAN Switches
60
Bridges vs. LAN Switches
61
LAN Switches: Store and Forward
62
Hubs vs. LAN Switches
HighSpeed
Backplane
CSMA/CD CSMA/CD CSMA/CD CSMA/CD
Input Output
Buffers Buffers
Hub Switch
63
Link Layer: LAN Switches
64
Hubs and Switches Used Together
65
Bridge/LAN Switch Filtering
66
Advantages Over Hubs/Repeaters
67
Disadvantages Over Hubs/Repeaters
A B
switches
69
Cut-Through Switching
A B
switches
70
Goals for Today’s Class
• Network Categories
– DAN, LAN, MAN, WAN
71
Network Layer: Routers
72
Network Layer: Routers
Application Application
TCP TCP
73
Bridges vs. Routers (1)
74
Bridges vs. Routers (2)
75
A Routed Enterprise Network
Router
Internet
Hub
FDDI
FDDI
76
A Switched Enterprise Network
Router
Internet
Switch
77
Bridges vs. Routers (3)
Routers Bridges
78
Need for Routing
Bridge 2
LAN 3 LAN 4
79
Transparent Bridges
• Two parts to
Bridge LAN 5
transparent bridges:
1. Learning & Forwarding Bridge
2. Spanning Tree Algorithm
LAN 1
Bridge
LAN 3 LAN 4
80
Transparent Bridges: Learning & Forwarding
A C
switch
D
81
Transparent Bridges: Learning
A C
D
82
Transparent Bridges: Forwarding (Miss)
When in B
doubt,
shout!
A C
D
83
Transparent Bridges: Learning & Forwarding
84
Example
Bridge 1 Bridge 2
A B C D E F
85
Danger of Loops
86
Solution: Spanning Trees
87
Constructing a Spanning Tree
93
Transport Layer: Gateways
94
Network Categories
Network Categories
96
DAN – Desk Area Network
• Privately owned
• Small distance (desk, 1-4 meters)
• Share printers, files, Internet connections, etc.
• Speeds generally 10 Mbps or 100 Mbps
– Mbps – megabits/sec – 1,000,000 bits per second
– compare to MB/sec – megabytes/sec
• Star topology
• Low delay
• Very few errors
97
LAN – Local Area Network
98
LAN – Local Area Network
• Privately owned
• Distance
– Room [Meters]
– Building [100 Meters]
– Campus [Kilometers]
• Share printers, files, Internet connections, etc.
• May include hubs & switches
• Low Delay
• Very Few Errors
99
LAN Topologies (1)
• Star
• Tree
100
LAN Topologies (2)
101
MAN – Metropolitan Area Network
102
MAN – Metropolitan Area Network
• Distance
– city (~ 10 Kilometers)
• One or two cables
• No switching elements
• Topology
– DQDB – Distributed Queue Dual Bus for 2 cable
configuration
– DQDB is the standard for data communication (IEEE
802.6); network extends up to 20 miles (30km) long and
operate at speeds of 34 to 155 Mbit/s.
103
MAN Topology
104
WAN – Wide Area Network
105
WAN – Wide Area Network
Router
Destination
Subnet
• Bus
• Star
• Tree
• Mesh
• Hybrid
107
Summary
• Ethernet technology
• Shuttling data from one link to another
– Bits, frames, packets, …
– Repeaters/hubs, bridges/switches, routers, …
• Network Categories
– DAN, LAN, MAN, WAN
108