View
229
Download
0
Embed Size (px)
Citation preview
1
Data Link Layer
Two sublayer:
– Medium access sublayer (MAC)
– Logical link control (LLC)
2
Data Link Layer• LANs -- Referred to as:
– Multiaccess channels
– Random access channels
• LANs Characterized by: – Data rate of at least several Mbps
– Low error rates
– A diameter of not more than a few kilometers
– Complete ownership by a single organization
3
NetworksTwo types • Point-to-Point
e.g., WANs• Broadcast
e.g., Packet radio,
Satellite
LANs
Note: In between LANs and WANs are MANs.
4
Channel Allocation in LANs and MANs
• Static
e.g., FDM• Dynamic
e.g., Slotted time,
Carrier sense
Note: MANs use LANs Technology.
5
The 3 popular types of LCNs
6
Basic packet radio architecture
(a) Centralized (b) Distributed
Centralcontroller
CentralResources
7
ALOHAA medium access control technique for multiple access
transmission media.– Pure ALOHA -- a station transmits whenever it has data
to send. Unacknowledged transmissions are repeated.
Notation for analysis:– S: Throughput of the network – G: Total rate of data presented– I: Total Rate of data generated by the stations (input load)– D: Average delay between the time a packet is ready for
transmission and the completion of successful transmission.
8
ALOHA (cont.)Assumptions:
1. All packets are of constant length2. The channel is noise-free3. Packets do not queue at individual stations
(i.e., I=S)4. G is Poisson distributed
9
ALOHANET BroadcastChannel Multiplexing
GenerateACK
ACK queue 1
Data packet queue
2
Data packetto user nodes
Data packetfrom
user node
f1 channel
f2 channel
10
ALOHA Protocols
t0 t0 + t t0 + 2t t0 + 3t
Collides withthe start ofthe shaded
frame
Collides withthe end ofthe shaded
frame
Vulnerable Time
Vulnerable period for the shaded frame
t
11
Pure ALOHA (cont.)G = S + (# of retransmitted packets per unit time)
Now, express rate of retransmission as: G Pr(individual packet suffers a collision)
For a Poisson process with rate , The Pr of
transmission in a period of time t is 1 - e-t. Thus the Pr of transmission during the vulnerable period
is 1 - e-2G. ThereforeG = S + G(1 - e-2G)
So ALOHA: S = G e-2G
12
Pure ALOHA (cont.)Note: If we differentiate S = Ge-2G with respect to G
and set it equal to 0, we find the max occurs at G = 0.5 and that S = 1 / 2e = 0.18. So, the maximum thru put is only 18% of capacity.
ALOHANET uses a data rate of 9600bps max total throughput (sum of data arriving from all user nodes) is only 0.18 9600 = 1728bps.
13
Slotted ALOHAChannel is organized into uniform slots whose size
equals the packet transmission time. Transmission is permitted only to begin at a slot boundary.
Note: Since the vulnerable period is now reduced in half, the Pr of transmission during this period is 1 - e-G; thus we have
S-ALOHA: S = Ge-G
Now, differentiating with respect to G, we have the max possible value for S is 1 / e = 0.37 or 37%.
14
Slotted ALOHA (cont.)
Throughput versus offered traffic for ALOHA system
15
Delay (approx)Time interval from when a user is ready to transmit a
packet until when it is successfully received by the central node. Simply the sum of queuing delay, propagation delay, and transmission time.
Note: ALOHA has queueing delay = 0.
So, we need to view queueing time in the context of above definition for delay.
16
Delay (approx) (cont.)Expected # of transmissions per packet G / S Expected # of retransmissions per packet G / S -1
G / S - 1 = e2G - 1
so D = (e2G - 1) + a + 1,
where is the average delay for one retransmission
ALOHA:
D = (e2G - 1)(1 + 2a + w + (K+1)/2) + a + 1
Note: Assume no collision for w
17
IEEE 802 Standards For LANs Include: CSMA/CD
Token bus Token ring
Standards parts:
802.1 -- Introduction to set of standards and define the interface primitives
802.2 -- Describes upper part of data link layer which uses LLC protocol
802.3 - 802.5 -- Describe the three LAN standards
18
IEEE Standards For LANs
(a) Position of the transiver and interface(b) Connecting two cable segments with a repeater
19
Cable topology
A B
C
D
Tap
(a) Linear (a) Spine
20
Cable topology (cont.)
(c) Tree (d) Segmented
Selectiverepeater
A B C D E
F
21
Carrier Sense Multiple Access (CSMA)
Non-persistent: Transmit if idle Otherwise, delay, try againConstant or variable
Delay
Channel busy
Ready
1-persistent: Transmit as soon as channel goes idleIf collision, back off and try again
Time
P-persistent: Transmit as soon as channel goes idle with probability POtherwise, delay one slot, repeat process
CSMA persistence and backoff
•Nonpersistent •1-persistent•P-persistent
22
CSMA/CD Physical Layer
Current Standard
Baseband coaxial cable (50)
500 M segments, 100 Taps/segment
Maximum 4 repeaters in path
10 Mbps
Similar to Ethernet
23
For Baseband CSMA/CD, packet length should be at least twice the propagation delay (a 0.5)
24
For Broadband CSMA/CD, packet length should be at least quadruple the propagation delay (a 0.5)
25
Comparison of the channelutilization versus load for various random accessprotocols.
26
The 802.3 Frame Format
• Destination address– High-order bits (bit 47)
• 0 ordinary addresses
• 1 group addresses (multicast)
Preamble
Start of framedelimiter
Dest.address
Sourceaddress
Length ofData field
Data Pad Checksum
Byte 7 1 2 or 6 2 or 6 2 0 - 1500 0-46 4
27
The 802.3 Frame Format (cont.)• Destination address
– All 1 bits broadcasting
Note: Such frame is propagated by all bridges
– Bit 46 designated for:• Local address, assigned by network adm.
• Global (address, assigned by IEEE) 7 1013 global addresses.
• Data length and data Frame must be at least 64 bits long from the destination address to the checksum.
• Pad: Used to fill out the minimum size frame
28
IEEE STD 802.4: Token Bus• Example: GM (MAP)• Logically, all stations are organized into a ring• Note: 802.4
MAC protocol is very complex, with each station having to maintain 10 different times and more than 2 dozen state variables. More than 200 pages.
• Token A special control frame, and only the token holder is permitted to transmit frames.
29
IEEE STD 802.4: Token Bus (cont.)
A token bus
30
Token Bus MAC Sublayer Protocol
• Stations are inserted into ring in order of station address, from highest to lowest.
• Token passing is also done from high to low addresses.
• Four priority classes: (0, 2, 4, 6) for traffic, with 0 the lowest and 6 the highest. When the token comes into the station, it passes to priority 6 substation, which may begin transmitting frames, if it has any. When it is done, (or when its timer expires), the token is passed to the priority 4 substations, etc.
31
Token Bus Priority Scheme
Class 6to send?
TimerExpired?
YesSendframe
No
No
Yes
Use Token
Class 4to send?
TimerExpired?
YesSendframe
No
No
Yes
Class 2to send?
TimerExpired?
YesSendframe
No
No
Yes
Class 0to send?
TimerExpired?
YesSendframe
No
No
Yes
More datato send?
Want tostay in ring
Yes
Send set-successorframe to
predecessor
NoNo
YesPasstoken
32
Ring Maintenance Framecontrol field Name Meaning
00000000 Claim_token Claim token during ring
initialization00000001 Solicit_successor_1 Allows stations to enter the ring00000010 Solicit_successor_2 Allows stations to enter the ring 00000011 Who_follows Recover from lost token00000100 Resolve_contention Used when multiple stations want
to enter the ring00001000 Token Pass the token00001100 Set_successor Allows stations to leave the ring
The token bus control frames
33
Logical Ring MaintenanceAdding a station• Each station's interface must maintain address of
predecessor and successor stations.• Periodically, the token holder solicits bids from
stations not currently in the ring and wish to join.• Resolve contention -- token holder runs an
arbitration algorithm when 2 or more stations bid to enter. All station interfaces maintain 2 random bits which are used to delay all bids by 0, 1, 2, or 3 slot times.
34
Logical Ring Maintenance (cont.)Deleting a station• A station, X, with successor S, and predecessor P,
leaves the ring by sending P a set_successor frame.
Initialization• Special case of adding new station. When first
station comes on line, it notices that there is no traffic for a certain time period. Then it sends a claim_token frame, and later solicit bids from stations to join.
35
Failure (Stations)If a station tries to pass the token to a failed station, it
listens to see if the station either transmits a frame or passes the token. If it does neither, the token is passed a second time. If that also fails, the station transmits a who_follows, specifying the address of its successor. If this fails, the station sends a solicit_successor_2 frame, etc.
36
Failure (Stations) (cont.)Token failure• Use the ring initialization algorithm. Each station
has a timer that is reset whenever a frame appears on the network. When timer hits a threshold value, the station issues a claim_token.
Multiple tokens• If a station holding the token notices a
transmission from another station, it discards its token.
37
Sender looks for free token
Changes free token to busytoken and appends data
Receiver copies dataaddressed to it
Sender generates free tokenupon receipt of physicaltransmission header(from addressee)
38
(a) A ring network (b) Listen mode (c) Transmission mode
Ring interface Ring interface
1 bit delay
39
Four stations connected via a wire center
Station
Wire center
Cable
Bypass relay
Connector
40
When the sending station drains the frame from the ring, it examines the A and C bits:
1. A = 0 and C = 0: destination not present or not powered up.2. A = 1 and C = 0: destination present but frame not accepted.3. A = 1 and C = 1: destination present and frame copied.
Ring Maintenance (cont.)
41
Ring Maintenance• Monitor station oversees the ring • Every station has the capability of becoming the
monitor• Monitor station responsibility
– Lost token – Ring breaks – Cleaning up ring
• Orphan frame• Garbled frame
• 802.4 committee interested in fractory issues, 802.5 committee interested in office automation
42
IEEE token ring priority scheme
1. A is sending to B, D reserves at higher level2. A generates higher priority token and remembers lower priority3. D uses higher priority token to send data to C4. D generates token at higher level5. A sees the high priority token and captures it.6. A generates token at the pre-empted, lower priority level
1
2
3
4
5
6
43
Ring Maintenance (cont.)Framecontrol field Name Meaning
00000000
00000010
000000110000010000000101
00000110
Duplicate address test
Beacon
Claim tokenPurgeActive monitor present
Stand by monitor present
Test if two stations havesame addressUsed to locate breaks in the ringAttempt to become monitorReinitialize the ringIssued periodicallyby the monitorAnnounces the presence of potential monitors
Token ring control frames
44
FDDI (Fiber Distributed Data Interface)
• 100 Mbps over distances up to 200km up to 1000 stations.
• Distance between 2 successive nodes cannot exceed 2km.
• Uses multimode fiber.• Uses LEDs rather than lasers.• Design consists of 2 fiber rings.
45
An FDDI ring being used as a backbone to connect LANs and computers
46
(a) FDDI consists of two counterrotating rings.(b) In the event of failure of both rings at one point, the two rings can be joined together to form a single long ring.
47
FDDI (cont.)
• 2 classes of stations, A and B. – Class A stations connect to both rings.
– Class B stations only connect to 1 ring.
• Traffic (2 types) – Synchronous (e.g., audio, video info)
– Asynchronous (e.g., data traffic)
– Uses 4 out of 5 encoding schemes to save bandwidth
48
FDDI token ring operation
1. A seizes token and begins transmitting frame F1 to C
2. A appends token to end of transmission
3. B seizes token transmits F2 to D
4. B emits token. D copies F2. A absorbs F1.
5. A lets F2 and token pass. B absorbs F2.
6. B lets token pass
1
2
3 6
5
4
49
LAN standard MAC frame formats
Preamble SFD DA SA Length Data Pad FCS
7 1 2, 6 2, 6 2 0 - 1500 4(a) CSMA/CD
Preamble SD FC DA SA Data FCS ED
1 1 1 2, 6 2, 6 >= 0 4 1(a) Token Bus
SD AC FC DA SA Data FCS ED FS
(a) Token Ring
Preamble
8 1 1 2, 6 2, 6 >= 0 4 1 1(a) FDDI
AC: Access ControlDA: Destination AddressED: Ending Delimiter
FC: Frame ControlFCS: Frame Check SequenceFS: Frame Status
SA: Source AddressSD: Starting DelimiterSFD: Start Frame Delimiter
1 1 1 2, 6 2, 6 >= 0 4 1 1
SD FC DA SA Data FCS ED FS
Octets
50
Physical Layer Specificationsfor LAN standards
Name Cable Max. segment Nodes/seg. Advantages
10BASE5
10BASE2
10BASE-T
10BASE-F
Thick coax
Thin coax
Twisted pair
Fiber optics
500 m
200 m
100 m
2000 m
100
30
1024
1024
Good for backbones
Cheapest system
Easy maintenance
Best between buildings
The most common kinds of baseband 802.3 LANS
51
Physical Layer Specificationsfor LAN standards (cont.)
Broadband
Carrierband
Optical fiber
Coaxial Cable(75 ohm)Coaxial Cable(75 ohm)
Optical fiber
Broadband(AM/PSK)Broadband(FSK)ASK-Manchester
1, 5, 10
1, 5, 10
5, 10, 20
Not specified
7600
Not specified
TransmissionMedium
SignalingTechnique
Data Rate(Mbps)
Max. SegmentLength(m)
(b) IEEE 802.4 (Token Bus)
52
Physical Layer Specificationsfor LAN standards (cont.)
ShieldedTwisted Pair
DifferentialManchester
1, 4Not
specified
TransmissionMedium
SignalingTechnique
Data Rate(Mbps)
Max. # ofRepeaters
(c) IEEE 802.5 (Token Ring)
Max. distancebetween repeater
250
Optical fiber ASK-NRZI 100 2000 (m)
TransmissionMedium
SignalingTechnique
Data Rate(Mbps)
Max. # ofRepeaters
(d) Fiber Distributed Data Interface (FDDI)
Max. distancebetween repeater
1000
53
ActualRate(Mbps)
Token ring
Token bus
CSMA/CD bus
24.0
20.0
4.0
Data Rate (Mbps)4.0 20.0
Maximum potential data rate for LAN protocols; 2000 bits per packet;100 stations active out of 100 stations total
54
ActualRate(Mbps)
Token ring
Token bus
CSMA/CD bus
24.0
20.0
4.0
Data Rate (Mbps)4.0 20.0
500 bits per packet; 100 stations active out of 100 stations total
55
ActualRate(Mbps)
Token ring
Token bus
CSMA/CD bus
24.0
20.0
4.0
Data Rate (Mbps)4.0 20.0
2000 bits per packet; 1 station active out of 100 stations total
56
ActualRate(Mbps)
Token ring
Token bus
CSMA/CD bus
24.0
20.0
4.0
Data Rate (Mbps)4.0 20.0
500 bits per packet; 1 station active out of 100 stations total
57
Throughput
0.2
0.6
0.8
1.0
Throughput as a function of N for token passing and CSMA/CD
5 20 25Number of Stations
CSMA/CD a = 1.0
CSMA/CD a = 0.1
Token a = 1.0
Token a = 0.1
58
Slotted Ring
Medium Access Control Protocols in Wireless Networks
• CSMA
• 802.11
MAC Protocols: Issues in Wireless Networks
• Hidden Terminal Problem
• Reliability
• Collision avoidance
• Congestion control
• Fairness
• Energy efficiency
Hidden Terminal Problem
• Node B can communicate with both A and C• A and C cannot hear each other• When A transmits to B, C cannot detect the
transmission using the carrier sense mechanism• If C transmits, collision will occur at node B
B C DA
Radio Range
Exposed Station Problem
• Node B is transmitting to node A• Assume node C wishes to transmit to node D:
• it will first senses the channel,
• assumes falsely that it cannot transmit to node D
• delays transmission until idle channel is detected
• this is not true, collisions only occur at receiver, node A
A C DB
MACA Solution for Hidden Terminal/Exposed Station Problem [Karn90]
• When node A wants to send a packet to node B, node A first sends a Request-to-Send (RTS) to B.
• On receiving RTS, node B responds by sending Clear-to-Send (CTS), provided node A is able to receive the packet
• When a node (such as C) overhears a CTS, it keeps quiet for the duration of the transfer– Transfer duration is included in both RTS and CTS.
Range of A’s Transmitter
Range of B’s Transmitter
A BC D
E
RTS A BC D
E
CTS
Reliability
• Wireless links are prone to errors. High packet loss rate detrimental to transport-layer performance.
• Mechanisms needed to reduce packet loss rate experienced by upper layers
A B C D
A Simple Solution to Improve Reliability
• When node B receives a data packet from node A, node B sends an Acknowledgement (Ack). This approach adopted in many protocols [Bharghavan94,IEEE 802.11]
• If node A fails to receive an Ack, it will retransmit the packet
A B C D
IEEE 802.11 Wireless MAC
• Distributed and centralized MAC components– Distributed Coordination Function (DCF)– Point Coordination Function (PCF)
• DCF suitable for multi-hop ad hoc networking
IEEE 802.11 DCF • Uses RTS-CTS exchange to avoid hidden terminal
problem– Any node overhearing a CTS cannot transmit for the
duration of the transfer
• Uses ACK to achieve reliability• Any node receiving the RTS cannot transmit for
the duration of the transfer– To prevent collision with ACK when it arrives at the
sender– When B is sending data to C, node A will keep quiet
A B C D
Congestion Avoidance:IEEE 802.1 DCF
• When transmitting a packet, choose a backoff interval in the range [0,cw]– cw is contention window
• Count down the backoff interval when medium is idle– Count-down is suspended if medium becomes busy
• When backoff interval reaches 0, transmit RTS
Congestion Avoidance
• The time spent counting down backoff intervals is a part of MAC overhead
• Choosing a large cw leads to large backoff intervals and can result in larger overhead
• Choosing a small cw leads to a larger number of collisions (when two nodes count down to 0 simultaneously)
GSM (Global System for Mobile Communications)
Combination of ALOHA, TDM, FDM intertwined in complex ways
• Has a max of 200 full duplex channels per cell.• Each channel has an uplink and a downlink• Each frequency band has 200kHz wide• Uses 124 channels and supports 8 separate
connections, using TDM • Note: Europe GSM is fully digital
CDMA (Code Division Multiple Access)
Channel allocation scheme
• Each station to transmit over the entire frequency spectrum all the time
• Multiple simultaneous transmissions are separated using coding theory
72
Multiple LANs connected by a backbone to handle a total loadhigher than the capacity of a single LAN.
Clusteron a single LAN
The internal structureof the network layer (cont.)
73
Operationof a LANbridge from 802.3 to802.4.
Network
LLC
MAC
Physical
Bridge
The internal structureof the network layer (cont.)
74
IEEE 802 frame formats
802.3
802.4
802.5
Preamble
Startdelimiter
AccessControl
Dest. &source
addressesData Checksum Frame
status
FrameControl
LengthPad
Enddelimeter
75
Problems encountered in building bridges from 802.x to 802.y
802.3(CSMA/CD)
1,5,8,9,101,2,5,6,7,10
802.4(Token Bus)1,49,1,2,3,6,7
802.5(Token Ring)1,2,4,81,2,3,8,9,106,7
802.3802.4802.5
Destination LAN
SourceLAN
Action1. Reformate the frame and compute new checksum2. Reverse the bit order3. Copy the priority, meaningful or not4. Generate a ficticious priority5. Discard priority6. Drain the ring (somehow)7. Set A and C bits (by lying)8. Worry about congestion (fast LAN to slow LAN)9. Worry about token handoff ACK being delayed or impossible10. Panic if frame is too long for destination LAN
Parameters assumed:<802.3> 1518-byte frames, 10Mbps (minus collisions)<802.4> 8191-byte frames, 10Mbps<802.5> 5000-byte frames, 4Mbps
76
Bridges From 802.x to 802.yProblems:
• Different Frame Format Among LANs
• Interconnected LANs Do Not Run at The Same Data Rate
• LANs Have Different Max Frame Length
• Value of Timers in The Higher Layer May Time Out too Early When Sending a Long Frame
77
Bridges From 802.x to 802.y (cont.)
802.3--802.3Fairly straightforward. • If destination LAN is heavily loaded, then frames
must be buffered; otherwise, they are discarded.
802.4--802.3Two problems: priority bits in 802.4 frames. 802.4 frames may request an ACK from the
destination. What should the bridge do?
78
Bridges From 802.x to 802.y (cont.)
802.5--802.3Similar problem as before:• 802.5 has frame status byte with A and C bits
which are set by the destination to tell sender whether the frame was copied. What should the bridge do?
802.3--802.4 What to put in the priority bits? Assuming enough
delay has already, bridge may transmit all frames at highest priority.
79
Bridges From 802.x to 802.y (cont.)
802.4--802.4• What to do with the temporary token handoff?
802.5--802.4 Same problem as before with the A and C bits.
Note: priority bits are different in the two LANs.
802.3--802.5 Bridge must generate priority bits.
80
Bridges From 802.x to 802.y (cont.)
802.4--802.5• Frames may be too long.• Token handoff problem.
802.5--802.5 What to do with the A and C bits?
81
Transparent Bridges or Spanning Tree (802)
• There Should be No Hardware Changes Required, No Software Changes Required, etc. Just Plug in The Cable & Walk Away
• Each Bridge Has a Hash Table for Looking up Destination Addresses
• Initially, All Bridges Hash Tables Are Empty. Flooding is Used to Have Bridges Learn Destination Addresses
• To Handle Dynamic Topologies, The Arrival Time is Noted in Every Hash Table Entry
• Periodically, The Hash Table is Scanned & All Old Entries Are Purged
82
LANs and Bridges
Bridge 1 Bridge 2
A B C D
LAN1
LAN2
LAN3
LAN4
A Configuration with 4 LANs and 2 Bridges
Connectivity:
• Bridge 1: Connected to LAN 1 & LAN 2.• Bridge 2: Connected to LANs ___, ___ and ___.
Note: A frame arriving at Bridge 1 on LAN 1 destined for A can be discarded immediately because it is already on the right LAN.
83
LANs and Bridges (cont.)However, a frame arriving on LAN 1 destined for
___, ___, or ___ must be forwarded.Hash Table (located inside bridge) ==> look up
destination address. Example: Bridge 2's table would list A as belonging
to ___.Note: Bridges learn destinations after the initial
flooding. By looking at the source address, they can tell which machine is accessible on which LAN.
84
LANs and Bridges (cont.)Example: If Bridge 1 sees a frame on LAN 2 coming
from C, it knows that C must be reachable via ___, so it makes an entry in its hash table noting this. A subsequent frame addressed to C coming in on LAN 2 will be ______; whereas if this same frame comes in on LAN 1, it will be ______.
Note: Whenever a frame that is already in the table arrives, its entry is updated with the current time. Periodically, a process in the bridge scans the hash table and purges all entries more than a few minutes old.
85
Routing Procedure For An Incoming Frame
• If Destination & Source LANs Are The Same, Discard Frame
• If Destination & Source LANs Are Different, Forward Frame
• If The Destination LAN is Unknown, Use Flooding
86
Source Routing BridgesNote: CSMA/CD & Token Bus Chose Transparent
Bridges. The Token Ring Group Chose Source Routing
Source Routing --- Assumes That The Sender of Each Frame Knows Whether or Not The Destination is on Its Own LAN
The Frame Header Contains The Exact Path That Frame is To Follow: A Route is A Seq. of Bridge, LAN, Bridge, LAN, .....
87
Source Routing Bridges (cont.)When sending a frame to a different LAN, the source
machine sets the high order bit of the destination address to 1 to mark it. Also, it includes in the frame header the exact path that frame is to follow.
A route is just a sequence of Bridges, LAN, Bridge, ...
Example: Route from A to C in previous figure:(B1, L2, B2, L3)B1--4bitsL2--12 bits
88
Source Routing Bridges (cont.)This algorithm lends itself to three possible
implementations:1. Software: the bridge runs in promiscuous mode,
copying all frames to its memory to see if they have the high-order destination bit set to 1. If so, the frame is inspected further, otherwise, it is not.
2. Hybrid: the bridge's LAN interface inspects the high-order destination bit and only gives its frames with the bit set. This interface is easy to build into hardware and greatly reduces the number of frames the bridge must inspect.
89
Source Routing Bridges (cont.)3. Hardware: the bridge's LAN interface not only
checks the high-order destination bit, but it also scans the route to see if this bridge must do forwarding. Only frames that must actually be forwarded are given to the bridge. This implementation require the most complex hardware, but wastes no bridge CPU cycles because all irrelevant frames are screened out.
90
Discovering Routes: If destination address is unknown, the source issues a
broadcast frame (copied by every bridge) asking where it is. When the reply comes back, the bridges record their identity in it, so that the sender can observe routes taken, and choose the best route.