Chapter 2: Direct Link Networks (continued) Slide Set 5 Reminder + Announcements • Quiz January 27th. • Chapters 1 and 2.1 to 2.6 (Upto this set of slides) • Bring Scantron sheets, calculators In this set.. • Reliable Transmissions -retransmissions. • Ethernet Why retransmissions ? • Error correction although feasible, is not enough to handle all kinds of errors -especially burst errors. • Corrupt frames cannot be deciphered and are therefore dropped. • Retransmissions needed to provide reliability. ACKs and Time-outs • When frames are sent piggyback an acknowledgement (ACK) for received packets onto sent packets. • If no ACK received up to a preset time-out, resend frame. • Called ARQ -- Automatic Repeat request. 1 Ack 1 100 Stop and Wait • Allow only one outstanding packet at any given time. • If ACK not received within time-out, send again. Receiver Sender Fram Receiver Sender Fram e e ACK ACK Fram e ACK (c) (a) Receiver Sender Fram e Receiver Sender Fram e ACK Fram Fram e e ACK ACK (b) (d) How efficient is Stop and Wait ? • Consider a 1.5 Mbps link with 45 ms RTT. • BW - Delay product = 67.5 Kb = 8KB. • You can fill 8 Kilo bytes of data prior to receiving an ACK. • However, if your frame size is 1 KB, you are using only 1/8 of the capacity. – Inefficient. Sliding Window • What we really like is that the 9th frame be transmitted when ACK for the first frame arrives :). • Say we do this -- A window of packets sent -- as ACKs are received window slides i.e., more packets sent. • Now what do we need in addition ? • Need to know which packets have been received and which have not. – Packets labeled using sequence numbers. Sender Receiver Some definitions • We have a window of packets sent -- Send Window Size or SWS. • Last Acknowledgement received is denoted LAR. • LFS represents the last frame sent. • NOTE: LFS - LAR <= SWS. Sender Functions <─ SWS ■■■ ■■■ LAR LFS • When an ACK is received, the LAR moves to the right. • This allows for the transmission of an additional frame. Receiver functions < ─ Notation: RWS ■■■ ■■■ RWS -- Receive Window Size LAF -- Largest Acceptable Frame. LFR • LAF LFR -- Last Frame Received. When frame with Seq_Num arrives: 1. 2. 3. 4. 5. If Seq_Num <= LFR or Seq Num > LAF, discard. – Frame is outside window. – Frame within window. If LFR < Seq_Num < LAF, accept frame. Let Seq_Num_to_Ack be the largest sequence number yet to be acked. This implies, all frames <= Seq_Num_to_Ack have been received. LFR = Seq_Num_to_Ack Adjust LAF = LFR + RWS. An Example • Let LFR =5 and RWS = 4. • This implies LAF = 9 • If packets 7 and 8 arrive (not 6), they are buffered. – Note that they are out of order. • Typically, Receiver will resend an ACk for packet 5. • When 6 arrives, it can cumulatively ACK all buffered packets i.e., it ACKs 8 and moves LFR to 8 and LAF to 12. Other possibilities • Send NAK (negative acknowledgement) for lost packets -- example for 6, when 7 is received. • Duplicate ACKs -- send an ACK for 5 again when 7 is received to trigger retransmission of 6. • Selective ACKs : Explicitly ACK frames that are received -- more complex. Setting the Window Size • SWS -- Set considering the BW product. • RWS -- Receiver can set it to something appropriate -- may depend on buffering resources. – If RWS = 1 what happens to out of order frames ? Sequence number wrapping • Sequence numbers are finite -thus there is a need to reuse -called wrap around. • What is the relationship between the SWS and MaxSeqNum ? Maximum Sequence Number and SWS • • • Should it not be SWS <= MaxSeqNum + 1 ? Let us consider an example: – Sender has eight Seq Nums from 0 to 7. – SWS = RWS = 7. – Sender transmits frames 0-6 – Receiver gets them, ACKs but ACKs get lost. – Receiver expects 7 and next 0...5. But sender sends the previous 0..5. – When the receiver gets these, he cannot distinguish. Thus, when RWS = SWS, SWS < (MaxSeqNum+1)/2. (Verify that system works). Sequence Numbers and SWS • For other cases i.e., when RWS is not equal to SWS, other rules may apply. • Depends on the specific case. • A different way with TCP -- we will see later. • Easy solution -- large Sequence number space. Flow Control + • Feedback control that allows the receiver to throttle the sender. • Informs sender not only about what frames it has received but also how many more frames it can receive. • Need this in order to ensure that receiver buffer does not overflow. • Read rest of the parts on Sliding Window -- implementation etc. Multiple Access • Nodes send and receive frames over a shared “direct link” network. • One way -- contention based i.e., nodes contend to send -- example Ethernet. • A second way is scheduled access -everyone knows when and how to send -i.e., they take turns -- example Token Ring. • Decentralized operations needed. CSMA - CD • Stands for Carrier Sense Multiple Access with Collision Detection. • Carrier sensing -- nodes can distinguish between an idle and a busy line. • Collision detection -- nodes can detect when a transmission is “interfered” with. • CSMA-CD can work on a bus architecture as an example. • Forms the basis for Ethernet. The Ethernet Standard • Specified by IEEE. • Referred to as the 802.3 standard. • Initially started out as a standard for a bus topology -- 10 Mbps Ethernet. • Today, we have switched Ethernet -Fast Ethernet with 100 Mbps and Gigabit Ethernet with 1000 Mbps. Ethernet on a Coax • We consider the 10 Mbps Ethernet. • Ethernet implemented on a coax cable of up to 500m. • Hosts tap into this cable and must be at least 2.5 meters apart. • Transceiver which is attached detects idle line and drives signal. Transceiver Ethernet cable Adaptor Host Repeaters • Multiple Ethernet segments can be joined using “repeaters”. • Repeaters amplify and forward signals. • No more than four repeaters between any two hosts. – This ensures that maximum reach of Ethernet = 2500 meters. – We will see why this is needed later. É É É É Repeater Host Ethernet -- Signal broadcasts • Signal broadcast over the multiple-access link – Broadcast means, sent to everyone. • Each node propagates signal in both directions. • Repeaters forward on all outgoing segments. • Note: Ethernet uses Manchester encoding. Cables • Use of a 10base2 cable -- 10 Mbps, base --> it is baseband -frequency shifting -- No more than 200 m (actually only 185 m). • 10base T -- T stands for twisted pair. Ethernet Frame 64 48 48 16 Preamble Dest addr Src addr Type 32 Body CRC • Nuggets: (Other details refer book) • 64 bit preamble for synchronization. • 48 bit hardware or Ethernet address. • Ethernet frame size: up to 1500 bytes of data and “at least” 46 bytes --> padding may be necessary. • Note -- Body carries IP datagram -- length of IP header specified packet size -- can determine padding. Ethernet Address • Ethernet address unique for every host. • Technically address belongs to adaptor and not host -- burned into ROM. • 6 bytes -- represented as six numbers separated by colons: 8:0:2b:e4:b:1:2. • Each number corresponds to a pair of hexadecimal units -- one for each of the nibbles in the byte. Addressing (cont) • Uniqueness: Each manufacturer (e.g. AMD) is allocated a different prefix -- 8:0:2b --> 24 bits. • Every frame transmitted on the Ethernet is received by every adaptor on the network -- the address is recognized and only the particular adaptor recovers frame. • All 1’s implies broadcast -- every adaptor picks it up. • An address that has the 1st bit set to 1 but is not the broadcast address is used for multicast. Transmitter Algorithm • • Intelligence mainly on transmitter side - receiver dumb. Algorithm: 1. If line idle, transmit frame immediately; no negotiation with other adaptors. 2. If line busy, wait for the line to be idle and either a. Transmit immediately (1-persistent version) b. Transmit with a probability p (p-persistent version). With a probability q=1-p, defer the transmission for a later time. Why p-persistency? • Deference is needed since multiple transmitters may be waiting to transmit. • If for example, p = 0.25, one could have up to 4 transmitters on average -- only one would transmit when the line is free. • If multiple transmitters send simultaneously, a collision will result. Waiting time • Each node looks at a “slot” time. • Each slot is of a duration equal to that of a frame. • When node has something to send, in each idle slot, it sends with a probability p, and defers to the next slot with a probability q and so on. • Just a note: 1-persistency is good if nodes are lightly loaded -- has been found effective. Upon Collision Detection • When an adaptor detects a collision, it transmits a 32 bit jamming sequence and stops transmission. • Minimal amount of data sent 64 bit preamble + 32 jamming sequence = 96 bits. • How does a node detect a collision ? As nodes send, they monitor the line for other transmissions. Runt frame • If two hosts that simultaneously transmit are very close to each other, they can detect a collision quickly. • In this case, enough only the 96 bits are sent -- such a frame is called a runt frame. Effects of distance on CD • • • • • • • • What if nodes are far apart ? Let us consider the case where propagation time is d. Let A transmit at time t. A’s transmission jams that of node B which just begins transmission at “t+d”. It then sends out a jamming sequence -this takes another d seconds to reach A. Thus, A knows of the collision at “t+2d”. A has to be transmitting at this time in order to realize the collision i.e., it has to be transmitting for 2d seconds. Note that 2d = RTT. So transmission time should be at least equal to RTT. A B A B A B A B (a) (b) (c) (d) Transmission time and RTT • To repeat : Transmission time at least equal to RTT. • Now since RTT is at most 51.2 ms given that maximum reach is 2500 meters. • Thus, Transmission time at least 51.2 ms. On a 10 Mbps link, transmitter needs to send at least 512 bits. • Thus, we have a minimum size of 46 bytes for the body (header makes frame 512 bits). Ethernet back-off • Once adaptor detects collision, it waits before trying again. • First delay -- selected randomly from the pair 0, (21-1)51.2 ms = {0, 51.2} ms. • If a second collision is experienced, choose backoff time from 0, (22-1)51.2 ms i.e, from {0, 51.2, 102.4 and 153.6} ms. • Thus, after N collisions choose a back-off time from {0.. (2N-1)51.2} ms. • In reality, Ethernet gives up after a maximum number of attempts which is 16. However, maximum value of N is fixed; typically N = 10. Key properties • Ethernet works best when loads are light -small number of active nodes. • Typically utilization is less than 30 %. • Easy to administer and maintain; inexpensive. • Currently, switched Ethernet. Hub Hub Next time • Token Ring, • FDDI, • Wireless LANs.