3. Retransmissions Handling loss 4. MulFple Access Classic Ethernet, 802.11 5. Switching Modern Ethernet Topics (2) CSE 461 University of Washington 1
Topic Two strategies to handle errors: 1. Detect errors and retransmit frame (AutomaFc Repeat request, ARQ) 2. Correct errors with an error correcfng code Done this CSE 461 University of Washington 2
Context on Reliability Where in the stack should we place reliability funcfons? ApplicaFon Transport Network Link Physical CSE 461 University of Washington 3
Context on Reliability (2) Everywhere! It is a key issue Different layers contribute differently ApplicaFon Transport Network Link Physical Recover acfons (correctness) Mask errors (performance opfmizafon) CSE 461 University of Washington 4
ARQ ARQ o[en used when errors are common or must be corrected E.g., WiFi, and TCP (later) Rules at sender and receiver: Receiver automafcally acknowledges correct frames with an ACK Sender automafcally resends a[er a Fmeout, unfl an ACK is received CSE 461 University of Washington 5
Normal operafon (no loss) Sender Receiver Frame Timeout Time ACK ARQ (2) CSE 461 University of Washington 6
Loss and retransmission Sender Receiver Frame X Timeout Time Frame ARQ (3) ACK CSE 461 University of Washington 7
So What s Tricky About ARQ? Two non-trivial issues: How long to set the Fmeout?» How to avoid accepfng duplicate frames as new frames» Want performance in the common case and correctness always CSE 461 University of Washington 8
Timeouts Timeout should be: Not too big (link goes idle) Not too small (spurious resend) Fairly easy on a LAN Clear worst case, lible variafon Fairly difficult over the Internet Much variafon, no obvious bound We ll revisit this with TCP (later) CSE 461 University of Washington 9
Duplicates What happens if an ACK is lost? Sender Frame Receiver Timeout X ACK CSE 461 University of Washington 10
Duplicates (2) What happens if an ACK is lost? Sender Frame Receiver Timeout X ACK Frame ACK New Frame?? CSE 461 University of Washington 11
Or the Fmeout is early? Duplicates (3) Timeout Sender Frame ACK Receiver CSE 461 University of Washington 12
Or the Fmeout is early? Duplicates (4) Timeout Sender Frame ACK Frame ACK Receiver New Frame?? CSE 461 University of Washington 13
Sequence Numbers Frames and ACKs must both carry sequence numbers for correctness To disfnguish the current frame from the next one, a single bit (two numbers) is sufficient Called Stop-and-Wait CSE 461 University of Washington 14
In the normal case: Sender Receiver Stop-and-Wait Time CSE 461 University of Washington 15
In the normal case: Stop-and-Wait (2) Sender Receiver Timeout Frame 0 ACK 0 Time Frame 1 ACK 1 CSE 461 University of Washington 16
With ACK loss: Stop-and-Wait (3) Sender Receiver Frame 0 Timeout X ACK 0 CSE 461 University of Washington 17
With ACK loss: Stop-and-Wait (4) Sender Receiver Frame 0 Timeout X ACK 0 Frame 0 ACK 0 It s a Resend! CSE 461 University of Washington 18
With early Fmeout: Stop-and-Wait (5) Sender Frame 0 Timeout ACK 0 Receiver CSE 461 University of Washington 19
With early Fmeout: Stop-and-Wait (6) Sender Frame 0 Timeout ACK 0 Receiver OK Frame 0 ACK 0 It s a Resend CSE 461 University of Washington 20
LimitaFon of Stop-and-Wait It allows only a single frame to be outstanding from the sender: Good for LAN, not efficient for high BD Ex: R=1 Mbps, D = 50 ms How many frames/sec? If R=10 Mbps? CSE 461 University of Washington 21
Sliding Window GeneralizaFon of stop-and-wait Allows W frames to be outstanding Can send W frames per RTT (=2D) Various opfons for numbering frames/acks and handling loss Will look at along with TCP (later) CSE 461 University of Washington 22
Topic MulFplexing is the network word for the sharing of a resource Classic scenario is sharing a link among different users Time Division MulFplexing (TDM)» Frequency Division MulFplexing (FDM)» CSE 461 University of Washington 23
Time Division MulFplexing (TDM) Users take turns on a fixed schedule 2 2 2 2 CSE 461 University of Washington 24
Frequency Division MulFplexing (FDM) Put different users on different frequency bands Overall FDM channel CSE 461 University of Washington 25
TDM versus FDM In TDM a user sends at a high rate a fracfon of the Fme; in FDM, a user sends at a low rate all the Fme Rate TDM FDM Time CSE 461 University of Washington 26
TDM versus FDM (2) In TDM a user sends at a high rate a fracfon of the Fme; in FDM, a user sends at a low rate all the Fme Rate TDM FDM Time CSE 461 University of Washington 27
TDM/FDM Usage StaFcally divide a resource Suited for confnuous traffic, fixed number of users Widely used in telecommunicafons TV and radio stafons (FDM) GSM (2G cellular) allocates calls using TDM within FDM CSE 461 University of Washington 28
MulFplexing Network Traffic Network traffic is bursty ON/OFF sources Load varies greatly over Fme Rate Rate Time Time CSE 461 University of Washington 29
MulFplexing Network Traffic (2) Network traffic is bursty Inefficient to always allocate user their ON needs with TDM/FDM Rate Rate R Time R Time CSE 461 University of Washington 30
MulFplexing Network Traffic (3) MulFple access schemes mulfplex users according to their demands for gains of stafsfcal mulfplexing Two users, each need R Rate Rate R Time R Time Together they need R < 2R Rate R <2R Time CSE 461 University of Washington 31
MulFple Access We will look at two kinds of mulfple access protocols 1. Randomized. Nodes randomize their resource access abempts Good for low load situafons 2. ContenFon-free. Nodes order their resource access abempts Good for high load or guaranteed quality of service situafons CSE 461 University of Washington 32
Topic How do nodes share a single link? Who sends when, e.g., in WiFI? Explore with a simple model Assume no-one is in charge; this is a distributed system CSE 461 University of Washington 33
Topic (2) We will explore random mulfple access control (MAC) protocols This is the basis for classic Ethernet Remember: data traffic is bursty Busy! Zzzz.. Ho hum CSE 461 University of Washington 34
ALOHA Network Seminal computer network connecfng the Hawaiian islands in the late 1960s When should nodes send? A new protocol was devised by Norm Abramson Hawaii CSE 461 University of Washington 35
ALOHA Protocol Simple idea: Node just sends when it has traffic. If there was a collision (no ACK received) then wait a random Fme and resend That s it! CSE 461 University of Washington 36
Some frames will be lost, but many may get through ALOHA Protocol (2) Good idea? CSE 461 University of Washington 37
ALOHA Protocol (3) Simple, decentralized protocol that works well under low load! Not efficient under high load Analysis shows at most 18% efficiency Improvement: divide Fme into slots and efficiency goes up to 36% We ll look at other improvements CSE 461 University of Washington 38
Classic Ethernet ALOHA inspired Bob Metcalfe to invent Ethernet for LANs in 1973 Nodes share 10 Mbps coaxial cable Hugely popular in 1980s, 1990s : 2009 IEEE CSE 461 University of Washington 39
CSMA (Carrier Sense MulFple Access) Improve ALOHA by listening for acfvity before we send (Doh!) Can do easily with wires, not wireless So does this eliminate collisions? Why or why not? CSE 461 University of Washington 40
CSMA (2) SFll possible to listen and hear nothing when another node is sending because of delay CSE 461 University of Washington 41
CSMA (3) CSMA is a good defense against collisions only when BD is small X CSE 461 University of Washington 42
CSMA/CD (with Collision DetecFon) Can reduce the cost of collisions by detecfng them and aborfng (Jam) the rest of the frame Fme Again, we can do this with wires Jam! X X X X X X X X Jam! CSE 461 University of Washington 43
CSMA/CD ComplicaFons Want everyone who collides to know that it happened Time window in which a node may hear of a collision is 2D seconds X CSE 461 University of Washington 44
CSMA/CD ComplicaFons (2) Impose a minimum frame size that lasts for 2D seconds So node can t finish before collision Ethernet minimum frame is 64 bytes X CSE 461 University of Washington 45
CSMA Persistence What should a node do if another node is sending? What now? Idea: Wait unfl it is done, and send CSE 461 University of Washington 46
CSMA Persistence (2) Problem is that mulfple waifng nodes will queue up then collide More load, more of a problem Now! Uh oh Now! CSE 461 University of Washington 47
CSMA Persistence (3) IntuiFon for a beber solufon If there are N queued senders, we want each to send next with probability 1/N Send p=½ Whew Send p=½ CSE 461 University of Washington 48
Binary ExponenFal Backoff (BEB) Cleverly esfmates the probability 1st collision, wait 0 or 1 frame Fmes 2nd collision, wait from 0 to 3 Fmes 3rd collision, wait from 0 to 7 Fmes BEB doubles interval for each successive collision Quickly gets large enough to work Very efficient in pracfce CSE 461 University of Washington 49
Classic Ethernet, or IEEE 802.3 Most popular LAN of the 1980s, 1990s 10 Mbps over shared coaxial cable, with baseband signals MulFple access with 1-persistent CSMA/CD with BEB CSE 461 University of Washington 50
Ethernet Frame Format Has addresses to idenffy the sender and receiver CRC-32 for error detecfon; no ACKs or retransmission Start of frame idenffied with physical layer preamble Packet from Network layer (IP) CSE 461 University of Washington 51
Modern Ethernet Based on switches, not mulfple access, but sfll called Ethernet We ll get to it in a later segment Switch Switch ports Twisted pair CSE 461 University of Washington 52
Topic How do wireless nodes share a single link? (Yes, this is WiFi!) Build on our simple, wired model Send? Send? CSE 461 University of Washington 53
Wireless ComplicaFons Wireless is more complicated than the wired case (Surprise!) 1. Nodes may have different areas of coverage doesn t fit Carrier Sense» 2. Nodes can t hear while sending can t Collision Detect» CSMA/CD CSE 461 University of Washington 54
Different Coverage Areas Wireless signal is broadcast and received nearby, where there is sufficient SNR CSE 461 University of Washington 55
Hidden Terminals Nodes A and C are hidden terminals when sending to B Can t hear each other (to coordinate) yet collide at B We want to avoid the inefficiency of collisions CSE 461 University of Washington 56
Exposed Terminals B and C are exposed terminals when sending to A and D Can hear each other yet don t collide at receivers A and D We want to send concurrently to increase performance CSE 461 University of Washington 57
Nodes Can t Hear While Sending With wires, detecfng collisions (and aborfng) lowers their cost More wasted Fme with wireless Wired Collision X X Resend Wireless Collision XXXXXXXXX Time XXXXXXXXX Resend CSE 461 University of Washington 58
Possible SoluFon: MACA MACA uses a short handshake instead of CSMA (Karn, 1990) 802.11 uses a refinement of MACA (later) Protocol rules: 1. A sender node transmits a RTS (Request-To-Send, with frame length) 2. The receiver replies with a CTS (Clear-To-Send, with frame length) 3. Sender transmits the frame while nodes hearing the CTS stay silent Collisions on the RTS/CTS are sfll possible, but less likely CSE 461 University of Washington 59
MACA Hidden Terminals AàB with hidden terminal C 1. A sends RTS, to B A B C D CSE 461 University of Washington 60
MACA Hidden Terminals (2) AàB with hidden terminal C 2. B sends CTS, to A, and C too A RTS B C D CSE 461 University of Washington 61
MACA Hidden Terminals (3) AàB with hidden terminal C 2. B sends CTS, to A, and C too A RTS CTS B CTS Alert! C D CSE 461 University of Washington 62
MACA Hidden Terminals (4) AàB with hidden terminal C 3. A sends frame while C defers Frame Quiet... CSE 461 University of Washington 63
MACA Exposed Terminals BàA, CàD as exposed terminals B and C send RTS to A and D A B C D CSE 461 University of Washington 64
MACA Exposed Terminals (2) BàA, CàD as exposed terminals A and D send CTS to B and C A RTS B C RTS D CSE 461 University of Washington 65
MACA Exposed Terminals (3) BàA, CàD as exposed terminals A and D send CTS to B and C All OK All OK A RTS CTS B C RTS CTS D CSE 461 University of Washington 66
MACA Exposed Terminals (4) BàA, CàD as exposed terminals A and D send CTS to B and C A Frame B C Frame D CSE 461 University of Washington 67
802.11, or WiFi Very popular wireless LAN started in the 1990s Clients get connecfvity from a (wired) AP (Access Point) It s a mulf-access problem J Various flavors have been developed over Fme Faster, more features Access Point Client To Network CSE 461 University of Washington 68
802.11 Physical Layer Uses 20/40 MHz channels on ISM bands 802.11b/g/n on 2.4 GHz 802.11 a/n on 5 GHz OFDM modulafon (except legacy 802.11b) Different amplitudes/phases for varying SNRs Rates from 6 to 54 Mbps plus error correcfon 802.11n uses mulfple antennas; see 802.11 with MulFple Antennas for Dummies CSE 461 University of Washington 69
802.11 Link Layer MulFple access uses CSMA/CA (next); RTS/CTS opfonal Frames are ACKed and retransmibed with ARQ Funky addressing (three addresses!) due to AP Errors are detected with a 32-bit CRC Many, many features (e.g., encrypfon, power save) Packet from Network layer (IP) CSE 461 University of Washington 70
802.11 CSMA/CA for MulFple Access Sender avoids collisions by inserfng small random gaps E.g., when both B and C send, C picks a smaller gap, goes first Send? Send? Time CSE 461 University of Washington 71
The Future of 802.11 (Guess) Likely ubiquitous for Internet connecfvity Greater diversity, from low- to high-end devices InnovaFon in physical layer drives speed And power-efficient operafon too More seamless integrafon of connecfvity Too manual now, and limited (e.g., device-to-device) CSE 461 University of Washington 72
Topic How do we connect nodes with a switch instead of mulfple access Uses mulfple links/wires Basis of modern (switched) Ethernet Switch CSE 461 University of Washington 73
Switched Ethernet Hosts are wired to Ethernet switches with twisted pair Switch serves to connect the hosts Wires usually run to a closet Switch Switch ports Twisted pair CSE 461 University of Washington 74
What s in the box? Remember from protocol layers: Hub, or repeater Physical Physical All look like this: Switch Link Link Router Network Link Network Link CSE 461 University of Washington 75
Inside a Hub All ports are wired together; more convenient and reliable than a single shared wire CSE 461 University of Washington 76
Inside a Switch Uses frame addresses to connect input port to the right output port; mulfple frames may be switched in parallel... Fabric CSE 461 University of Washington 77
Inside a Switch (2) Port may be used for both input and output (full-duplex) Just send, no mulfple access protocol 1 2 3 4... 1 à 4 and 2 à 3 CSE 461 University of Washington 78
Inside a Switch (3) Need buffers for mulfple inputs to send to one output Input............ Output Input Buffer Fabric Output Buffer CSE 461 University of Washington 79
Inside a Switch (4) Sustained overload will fill buffer and lead to frame loss XXX Loss! Input............ Output Input Buffer Fabric Output Buffer CSE 461 University of Washington 80
Advantages of Switches Switches and hubs have replaced the shared cable of classic Ethernet Convenient to run wires to one locafon More reliable; wire cut is not a single point of failure that is hard to find Switches offer scalable performance E.g., 100 Mbps per port instead of 100 Mbps for all nodes of shared cable / hub CSE 461 University of Washington 81
Switch Forwarding Switch needs to find the right output port for the desfnafon address in the Ethernet frame. How? Want to let hosts be moved around readily; don t look at IP Ethernet Frame Source............ DesFnaFon CSE 461 University of Washington 82
Backward Learning Switch forwards frames with a port/address table as follows: 1. To fill the table, it looks at the source address of input frames 2. To forward, it sends to the port, or else broadcasts to all ports CSE 461 University of Washington 83
1: A sends to D Backward Learning (2) Switch D Address Port A B C D CSE 461 University of Washington 84
2: D sends to A Backward Learning (3) Switch D Address Port A 1 B C D CSE 461 University of Washington 85
3: A sends to D Backward Learning (4) Switch D Address Port A 1 B C D 4 CSE 461 University of Washington 86
3: A sends to D Backward Learning (5) Switch D Address Port A 1 B C D 4 CSE 461 University of Washington 87
Learning with MulFple Switches Just works with mulfple switches and a mix of hubs assuming no loops, e.g., A sends to D then D sends to A Switch CSE 461 University of Washington 88
Learning with MulFple Switches (2) Just works with mulfple switches and a mix of hubs assuming no loops, e.g., A sends to D then D sends to A Switch CSE 461 University of Washington 89
Topic How can we connect switches in any topology so they just work This is part 2 of switched Ethernet Loops yikes! CSE 461 University of Washington 90
Problem Forwarding Loops May have a loop in the topology Redundancy in case of failures Or a simple mistake Want LAN switches to just work Plug-and-play, no changes to hosts But loops cause a problem Redundant Links CSE 461 University of Washington 91
Forwarding Loops (2) Suppose the network is started and A sends to F. What happens? A B C D Le[ / Right E F CSE 461 University of Washington 92
Forwarding Loops (3) Suppose the network is started and A sends to F. What happens? A à C à B, D-le[, D-right D-le[ à C-right, E, F D-right à C-le[, E, F C-right à D-le[, A, B C-le[ à D-right, A, B D-le[ à D-right à A E C D B Le[ / Right F CSE 461 University of Washington 93
Spanning Tree SoluFon Switches collecfvely find a spanning tree for the topology A subset of links that is a tree (no loops) and reaches all switches They switches forward as normal on the spanning tree Broadcasts will go up to the root of the tree and down all the branches CSE 461 University of Washington 94
Spanning Tree (2) Topology One ST Another ST CSE 461 University of Washington 95
Spanning Tree (3) Topology One ST Another ST Root CSE 461 University of Washington 96
Spanning Tree Algorithm Rules of the distributed game: All switches run the same algorithm They start with no informafon Operate in parallel and send messages Always search for the best solufon Ensures a highly robust solufon Any topology, with no configurafon Adapts to link/switch failures, CSE 461 University of Washington 97
Radia Perlman (1952 ) Key early work on roufng protocols RouFng in the ARPANET Spanning Tree for switches (next) Link-state roufng (later) Now focused on network security CSE 461 University of Washington 98
Outline: Spanning Tree Algorithm (2) 1. Elect a root node of the tree (switch with the lowest address) 2. Grow tree as shortest distances from the root (using lowest address to break distance Fes) 3. Turn off ports for forwarding if they aren t on the spanning tree CSE 461 University of Washington 99
Spanning Tree Algorithm (3) Details: Each switch inifally believes it is the root of the tree Each switch sends periodic updates to neighbors with: Its address, address of the root, and distance (in hops) to root Switches favors ports with shorter distances to lowest root Uses lowest address as a Fe for distances Hi, I m C, the root is A, it s 2 hops away or (C, A, 2) C CSE 461 University of Washington 100
Spanning Tree Example 1 st round, sending: A sends (A, A, 0) to say it is root B, C, D, E, and F do likewise 1 st round, receiving: A sfll thinks is it (A, A, 0) B sfll thinks (B, B, 0) C updates to (C, A, 1) D updates to (D, C, 1) E updates to (E, A, 1) F updates to (F, B, 1) A,A,0 E,E,0 C,C,0 D,D,0 B,B,0 F,F,0 CSE 461 University of Washington 101
Spanning Tree Example (2) 2 nd round, sending Nodes send their updated state 2 nd round receiving: A remains (A, A, 0) B updates to (B, A, 2) via C C remains (C, A, 1) D updates to (D, A, 2) via C E remains (E, A, 1) F remains (F, B, 1) A,A,0 E,A,1 C,A,1 D,C,1 B,B,0 F,B,1 CSE 461 University of Washington 102
Spanning Tree Example (3) 3 rd round, sending Nodes send their updated state 3 rd round receiving: A remains (A, A, 0) B remains (B, A, 2) via C C remains (C, A, 1) D remains (D, A, 2) via C-le[ E remains (E, A, 1) F updates to (F, A, 3) via B A,A,0 E,A,1 C,A,1 D,A,2 B,A,2 F,B,1 CSE 461 University of Washington 103
Spanning Tree Example (4) 4 th round Steady-state has been reached Nodes turn off forwarding that is not on the spanning tree A,A,0 C,A,1 B,A,2 Algorithm confnues to run Adapts by Fming out informafon E.g., if A fails, other nodes forget it, and B will become the new root E,A,1 D,A,2 F,A,3 CSE 461 University of Washington 104
Spanning Tree Example (5) Forwarding proceeds as usual on the ST IniFally D sends to F: A,A,0 B,A,2 C,A,1 And F sends back to D: D,A,2 E,A,1 F,A,3 CSE 461 University of Washington 105
Spanning Tree Example (6) Forwarding proceeds as usual on the ST IniFally D sends to F: D à C-le[ C à A, B A à E B à F A,A,0 C,A,1 B,A,2 And F sends back to D: F à B B à C C à D (hm, not such a great route) E,A,1 D,A,2 F,A,3 CSE 461 University of Washington 106