Computer Networks Lecture ch05a


Published on

1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Computer Networks Lecture ch05a

  1. 1. Chapter 5: The Data Link Layer <ul><li>Our goals: </li></ul><ul><li>understand principles behind data link layer services: </li></ul><ul><ul><li>error detection, correction </li></ul></ul><ul><ul><li>sharing a broadcast channel: multiple access </li></ul></ul><ul><ul><li>link layer addressing </li></ul></ul><ul><ul><li>reliable data transfer, flow control: done! </li></ul></ul><ul><li>instantiation and implementation of various link layer technologies </li></ul>
  2. 2. Link Layer <ul><li>5.1 Introduction and services </li></ul><ul><li>5.2 Error detection and correction </li></ul><ul><li>5.3Multiple access protocols </li></ul><ul><li>5.4 Link-Layer Addressing </li></ul><ul><li>5.5 Ethernet </li></ul><ul><li>5.6 Hubs and switches </li></ul><ul><li>5.7 PPP </li></ul><ul><li>5.8 Link Virtualization: ATM and MPLS </li></ul>
  3. 3. Link Layer: Introduction <ul><li>Some terminology: </li></ul><ul><li>hosts and routers are nodes </li></ul><ul><li>communication channels that connect adjacent nodes along communication path are links </li></ul><ul><ul><li>wired links </li></ul></ul><ul><ul><li>wireless links </li></ul></ul><ul><ul><li>LANs </li></ul></ul><ul><li>2-PDU is a frame , encapsulates datagram </li></ul>data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
  4. 4. Link layer: context <ul><li>Datagram transferred by different link protocols over different links: </li></ul><ul><ul><li>e.g., Ethernet on first link, frame relay on intermediate links, 802.11 on last link </li></ul></ul><ul><li>Each link protocol provides different services </li></ul><ul><ul><li>e.g., may or may not provide rdt over link </li></ul></ul><ul><li>transportation analogy </li></ul><ul><li>trip from Princeton to Lausanne </li></ul><ul><ul><li>limo: Princeton to JFK </li></ul></ul><ul><ul><li>plane: JFK to Geneva </li></ul></ul><ul><ul><li>train: Geneva to Lausanne </li></ul></ul><ul><li>tourist = datagram </li></ul><ul><li>transport segment = communication link </li></ul><ul><li>transportation mode = link layer protocol </li></ul><ul><li>travel agent = routing algorithm </li></ul>
  5. 5. Link Layer Services <ul><li>framing: </li></ul><ul><ul><li>encapsulate datagram into frame, adding header, trailer </li></ul></ul><ul><li>link access: </li></ul><ul><ul><li>implement channel access if shared medium, </li></ul></ul><ul><ul><li>physical addresses used in frame headers to identify source, dest </li></ul></ul><ul><ul><ul><li>different from IP address! </li></ul></ul></ul><ul><li>reliable delivery between two physically connected devices: </li></ul><ul><ul><li>we learned how to do this already (chapter 3) </li></ul></ul><ul><ul><li>seldom used on low bit error link (fiber, some twisted pair) </li></ul></ul><ul><ul><li>wireless links: high error rates </li></ul></ul><ul><ul><ul><li>Q : why both link-level and end-end reliability? </li></ul></ul></ul>
  6. 6. Link Layer Services (cont.) <ul><li>flow control: </li></ul><ul><ul><li>pacing between sender and receivers </li></ul></ul><ul><li>error detection: </li></ul><ul><ul><li>errors caused by signal attenuation, noise </li></ul></ul><ul><ul><li>receiver detects presence of errors </li></ul></ul><ul><ul><ul><li>signals sender for retransmission or drops frame </li></ul></ul></ul><ul><ul><li>error detection is a very common service among link-layer protocols </li></ul></ul><ul><li>error correction: </li></ul><ul><ul><li>receiver identifies and corrects bit error(s) without resorting to retransmission </li></ul></ul><ul><ul><li>ATM provides link-layer error correction for the packet header rather than for the entire packet </li></ul></ul><ul><li>half-duplex and full-duplex: </li></ul><ul><ul><li>with half duplex, nodes at both ends of link can transmit, but not at same time </li></ul></ul>
  7. 7. Adaptors Communicating <ul><li>link layer implemented in “adaptor” (aka NIC) </li></ul><ul><ul><li>Ethernet card, PCMCI card, 802.11 card </li></ul></ul><ul><li>sending side: </li></ul><ul><ul><li>encapsulates datagram in a frame </li></ul></ul><ul><ul><li>adds error checking bits, rdt, flow control, etc. </li></ul></ul><ul><li>receiving side </li></ul><ul><ul><li>looks for errors, rdt, flow control, etc </li></ul></ul><ul><ul><li>extracts datagram, passes to rcving node </li></ul></ul><ul><li>adapter is semi-autonomous </li></ul><ul><li>link & physical layers </li></ul>sending node frame rcving node datagram frame adapter adapter link layer protocol
  8. 8. Link Layer <ul><li>5.1 Introduction and services </li></ul><ul><li>5.2 Error detection and correction </li></ul><ul><li>5.3Multiple access protocols </li></ul><ul><li>5.4 Link-Layer Addressing </li></ul><ul><li>5.5 Ethernet </li></ul><ul><li>5.6 Hubs and switches </li></ul><ul><li>5.7 PPP </li></ul><ul><li>5.8 Link Virtualization: ATM </li></ul>
  9. 9. Error Detection <ul><li>EDC= Error Detection and Correction bits (redundancy) </li></ul><ul><li>D = Data protected by error checking, may include header fields </li></ul><ul><li>Error detection not 100% reliable! </li></ul><ul><ul><li>protocol may miss some errors, but rarely </li></ul></ul><ul><ul><li>larger EDC field yields better detection and correction </li></ul></ul>
  10. 10. Parity Checking <ul><li>single bit parity: </li></ul><ul><li>odd parity, even parity </li></ul><ul><li>detect single bit errors </li></ul><ul><li>e.g., one-bit even parity </li></ul><ul><li>two dimensional bit parity: </li></ul><ul><li>detect and correct single bit errors </li></ul><ul><li>can also detect (but not correct!) any combination of two errors </li></ul><ul><li>e.g., two-dimensional even parity </li></ul><ul><li>forward error correction (FEC) </li></ul><ul><li>ability of the receiver to both detect and correct errors </li></ul><ul><li>potentially important advantage for real-time network applications </li></ul>
  11. 11. Internet checksum <ul><li>Sender : </li></ul><ul><li>treat segment contents as sequence of 16-bit integers </li></ul><ul><li>checksum: addition (1’s complement sum) of segment contents </li></ul><ul><li>sender puts 1's complement of this sum into checksum field </li></ul><ul><li>Receiver: </li></ul><ul><li>1's complement sum is computed over the same set of octets, including the checksum field. </li></ul><ul><li>if the result is all 1 bits (- 0 in 1's complement arithmetic), </li></ul><ul><ul><li>NO - error detected </li></ul></ul><ul><ul><li>YES - no error detected. But maybe errors nonetheless? </li></ul></ul><ul><li>Goal: </li></ul><ul><li>detect “errors” (e.g., flipped bits) in transmitted segment </li></ul><ul><li>used at TCP, UDP, IP header </li></ul>
  12. 12. Cyclic Redundancy Check (CRC) <ul><li>a.k.a. polynomial codes </li></ul><ul><li>view data bits, D , as a binary number </li></ul><ul><li>choose r+1 bit pattern (generator), G </li></ul><ul><li>goal: choose r CRC bits, R , such that </li></ul><ul><ul><li><D,R> exactly divisible by G </li></ul></ul><ul><ul><li>receiver knows G , divides <D,R> by G . </li></ul></ul><ul><ul><li>if non-zero remainder: error detected! </li></ul></ul><ul><ul><li>can detect all burst errors less than r+1 bits and any odd number of bit errors </li></ul></ul><ul><li>modulo 2 arithmetic </li></ul><ul><li>widely used in practice (ATM, HDLC) </li></ul>
  13. 13. CRC Example <ul><li>want: </li></ul><ul><ul><li>D . 2 r XOR R = nG </li></ul></ul><ul><li>equivalently: </li></ul><ul><ul><li>D . 2 r = nG XOR R </li></ul></ul><ul><li>equivalently: </li></ul><ul><li>if we divide D . 2 r by G , want reminder R </li></ul><ul><li>8-bit CRC is used to protect the 5-byte header in ATM cells </li></ul><ul><li>CRC-32 32-bit standard, which has been adopted in a number of link-level IEEE protocols, uses a generator </li></ul><ul><li>G CRC-32 = 100000100110000010001110110110111 </li></ul>R = remainder D . 2 r G
  14. 14. Link Layer <ul><li>5.1 Introduction and services </li></ul><ul><li>5.2 Error detection and correction </li></ul><ul><li>5.3Multiple access protocols </li></ul><ul><li>5.4 Link-Layer Addressing </li></ul><ul><li>5.5 Ethernet </li></ul><ul><li>5.6 Hubs and switches </li></ul><ul><li>5.7 PPP </li></ul><ul><li>5.8 Link Virtualization: ATM </li></ul>
  15. 15. Multiple Access Links and Protocols <ul><li>Two types of “links”: </li></ul><ul><li>point-to-point link </li></ul><ul><ul><li>PPP for dial-up access </li></ul></ul><ul><ul><li>point-to-point link between Ethernet switch and host </li></ul></ul><ul><li>broadcast link: shared wire or medium </li></ul><ul><ul><li>traditional Ethernet </li></ul></ul><ul><ul><li>upstream HFC </li></ul></ul><ul><ul><li>802.11 wireless LAN </li></ul></ul>
  16. 16. Multiple Access protocols <ul><li>single shared broadcast channel </li></ul><ul><li>two or more simultaneous transmissions by nodes: interference </li></ul><ul><ul><li>only one node can send successfully at a time </li></ul></ul><ul><ul><li>collision if node receives two or more signals at the same time </li></ul></ul><ul><ul><li>multiple access problem : how to coordinate the access of multiple sending and receiving nodes to a shared broadcast channel </li></ul></ul><ul><li>multiple access protocol </li></ul><ul><li>distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit </li></ul><ul><li>communication about channel sharing must use channel itself! </li></ul><ul><ul><li>no out-of-band channel for coordination </li></ul></ul><ul><li>what to look for in multiple access protocols: </li></ul><ul><ul><li>synchronous or asynchronous </li></ul></ul><ul><ul><li>information needed about other stations </li></ul></ul><ul><ul><li>robustness (e.g., to channel errors) </li></ul></ul><ul><ul><li>performance </li></ul></ul>
  17. 17. Multiple Access Protocols (cont.) <ul><li>claim: humans use multiple access protocols all the time </li></ul><ul><li>as humans, we've evolved an elaborate set of protocols for sharing the broadcast channel: </li></ul><ul><ul><li>give everyone a chance to speak </li></ul></ul><ul><ul><li>don't speak until you are spoken to </li></ul></ul><ul><ul><li>don't monopolize the conversation </li></ul></ul><ul><ul><li>raise your hand if you have a question </li></ul></ul><ul><ul><li>don't interrupt when someone is speaking </li></ul></ul><ul><ul><li>don't fall asleep when someone else is talking </li></ul></ul><ul><li>you can also &quot;guess&quot; multiple access protocols </li></ul>
  18. 18. MAC Protocols: a taxonomy <ul><li>Three broad classes: </li></ul><ul><li>Channel partitioning protocols </li></ul><ul><ul><li>divide channel into smaller “pieces” (time slots, frequency, code) </li></ul></ul><ul><ul><li>allocate piece to node for exclusive use </li></ul></ul><ul><li>Random access protocols </li></ul><ul><ul><li>channel not divided, allow collisions </li></ul></ul><ul><ul><li>“ recover” from collisions </li></ul></ul><ul><li>Taking-turns protocols </li></ul><ul><ul><li>Nodes take turns, but nodes with more to send can take longer turns </li></ul></ul>
  19. 19. Ideal Multiple Access Protocol <ul><li>desirable characteristics </li></ul><ul><li>assume broadcast channel of rate R bps </li></ul><ul><li>when only one node has data to send, that node has a throughput of R bps </li></ul><ul><li>when M nodes have data to send, each of these nodes has a throughput of R / M bps </li></ul><ul><li>protocol is fully decentralized </li></ul><ul><ul><li>no special node to coordinate transmissions </li></ul></ul><ul><ul><li>no synchronization of clocks, slots </li></ul></ul><ul><li>protocol is simple, so that it is inexpensive to implement </li></ul>
  20. 20. Channel Partitioning MAC Protocols: TDM <ul><li>partition of broadcast channel's bandwidth </li></ul><ul><li>TDM (Time Division Multiplexing): channel divided into N time slots, one per user </li></ul><ul><li>FDM (Frequency Division Multiplexing): frequency subdivided </li></ul><ul><li>TDM: time division multiplexing </li></ul><ul><li>each station gets fixed length slot (length = packet trans time) in each round </li></ul><ul><li>it eliminates collisions and is perfectly fair </li></ul><ul><li>node must always wait for its turn in the transmission sequence </li></ul><ul><li>unused slots go idle </li></ul><ul><li>example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle </li></ul>time slot
  21. 21. Channel Partitioning MAC Protocols: FDM <ul><li>FDM: frequency division multiplexing </li></ul><ul><li>channel spectrum divided into frequency bandwidth </li></ul><ul><li>each station assigned fixed frequency bandwidth </li></ul><ul><li>unused transmission time in frequency bands go idle </li></ul><ul><li>example: 6-station LAN, 1,3,4 have packet, frequency bandwidth 2,5,6 idle </li></ul>frequency bands time
  22. 22. Random Access Protocols <ul><li>When node has packet to send </li></ul><ul><ul><li>transmit at full channel data rate R. </li></ul></ul><ul><ul><li>no a priori coordination among nodes </li></ul></ul><ul><li>two or more transmitting nodes ➜ “collision” </li></ul><ul><ul><li>each node waits a random delay before retransmitting the frame </li></ul></ul><ul><li>random access MAC protocol specifies: </li></ul><ul><ul><li>how to detect collisions </li></ul></ul><ul><ul><li>how to recover from collisions (e.g., via delayed retransmissions) </li></ul></ul><ul><li>examples of random access MAC protocols: </li></ul><ul><ul><li>slotted ALOHA </li></ul></ul><ul><ul><li>ALOHA </li></ul></ul><ul><ul><li>CSMA, CSMA/CD, CSMA/CA </li></ul></ul>
  23. 23. Slotted ALOHA <ul><li>Assumptions </li></ul><ul><li>all frames same size </li></ul><ul><li>time is divided into equal size slots, time to transmit 1 frame </li></ul><ul><li>nodes start to transmit frames only at beginning of slots </li></ul><ul><li>nodes are synchronized </li></ul><ul><li>if 2 or more nodes transmit in slot, all nodes detect collision </li></ul><ul><li>Operation </li></ul><ul><li>when node obtains fresh frame, it transmits in next slot </li></ul><ul><li>no collision, node can send new frame in next slot </li></ul><ul><li>if collision, node retransmits frame in each subsequent slot with prob. p until success </li></ul>
  24. 24. Slotted ALOHA <ul><li>Pros </li></ul><ul><li>single active node can continuously transmit at full rate of channel </li></ul><ul><li>highly decentralized </li></ul><ul><ul><li>only slots in nodes need to be in sync </li></ul></ul><ul><li>simple </li></ul><ul><li>Cons </li></ul><ul><li>collisions, wasting slots </li></ul><ul><li>idle slots </li></ul><ul><li>nodes may be able to detect collision in less than time to transmit packet </li></ul><ul><li>clock synchronization </li></ul>
  25. 25. Slotted Aloha efficiency <ul><li>Q: what is max fraction of successful slots? </li></ul><ul><li>A: suppose N stations have packets to send </li></ul><ul><ul><li>each transmits in slot with probability p </li></ul></ul><ul><ul><li>probability that a single node has a success is </li></ul></ul><ul><ul><li>S = p (1-p) N-1 </li></ul></ul><ul><ul><li>because there are N nodes, the probability that an arbitrary node has a success is </li></ul></ul><ul><li> S = Prob (only one transmits) </li></ul><ul><li>= N p (1-p) N-1 </li></ul><ul><ul><li>p* that maximizes the efficiency for N nodes: </li></ul></ul><ul><li>S = N p* (1-p*) N-1 = (1 - 1/N) N-1 </li></ul><ul><li>= 1/e = 0.37 as N  infinity </li></ul><ul><ul><li>37% of slots do useful work. thus the effective transmission rate of the channel is not R bps but only 0.37 R bps! </li></ul></ul><ul><ul><li>37% of the slots go empty and 26% of slots have collisions </li></ul></ul>Efficiency is the long-run fraction of successful slots when there is many nodes, each with many frames to send
  26. 26. Pure (unslotted) ALOHA <ul><li>unslotted Aloha: simpler, no synchronization </li></ul><ul><li>when frame first arrives </li></ul><ul><ul><li>transmit immediately without waiting for beginning of slot </li></ul></ul><ul><li>collision probability increases: </li></ul><ul><ul><li>frame sent at t 0 collides with other frames sent in [t 0 -1,t 0 +1] </li></ul></ul>
  27. 27. Pure Aloha (cont.) <ul><li>P(success by a given node) = P(node transmits) • </li></ul><ul><li>P(no other node transmits in [p 0 -1, p 0 ]) • </li></ul><ul><li>P(no other node transmits in [p 0 , p 0 +1]) </li></ul><ul><li>= p • (1 - p) N-1 • (1 - p) N-1 = p • (1 - p) 2(N-1) </li></ul><ul><li>P(success by any of N nodes) = N p . (1 - p) 2(N-1) </li></ul><ul><ul><li>1/(2e) = 0.18 . . . choosing optimum p as N  infinity </li></ul></ul>S = throughput (success rate) G = offered load = Np 0.5 1.0 1.5 2.0 0.1 0.2 0.3 0.4 Pure Aloha Slotted Aloha protocol constrains effective channel throughput!
  28. 28. CSMA: Carrier Sense Multiple Access <ul><li>CSMA: listen before transmit: </li></ul><ul><li>if channel sensed idle: transmit entire pkt </li></ul><ul><li>if channel sensed busy, defer transmission </li></ul><ul><ul><li>1-persistent CSMA: when a station has data to send, it first listens to the channel to see if anyone else is transmitting at that moment. if the channel is busy, the station waits until it becomes idle. when the station detects an idle channel, it transmits a frame. if a collision occurs, the station waits a random amount of time and starts all over again. </li></ul></ul><ul><ul><li>non-persistent CSMA: retry after random interval if the channel is already busy </li></ul></ul><ul><ul><li>p-persistent CSMA: retry immediately with probability p when channel becomes idle. it applies to slotted channels </li></ul></ul><ul><li>human analogy: don’t interrupt others! </li></ul>
  29. 29. CSMA collisions collisions can still occur: propagation delay means two nodes may not hear each other’s transmission collision: entire packet transmission time wasted spatial layout of nodes note: role of distance & propagation delay in determining collision probability
  30. 30. CSMA/CD (Collision Detection) <ul><li>CSMA/CD: carrier sense multiple access with collision detection </li></ul><ul><ul><li>carrier sensing, deferral as in CSMA </li></ul></ul><ul><ul><li>collisions detected within short time </li></ul></ul><ul><ul><li>colliding transmissions aborted, reducing channel wastage </li></ul></ul><ul><ul><li>persistent or non-persistent retransmission </li></ul></ul><ul><li>collision detection: </li></ul><ul><ul><li>easy in wired LANs: measure signal strengths, compare transmitted, received signals </li></ul></ul><ul><ul><li>difficult in wireless LANs: receiver shut off while transmitting </li></ul></ul><ul><li>human analogy: the polite conversationalist </li></ul>
  31. 31. CSMA/CD collision detection
  32. 32. Taking-turns protocols <ul><li>channel partitioning MAC protocols: </li></ul><ul><ul><li>share channel efficiently at high load </li></ul></ul><ul><ul><li>inefficient at low load: delay in channel access, 1/N bandwidth allocated even if only 1 active node! </li></ul></ul><ul><li>random access MAC protocols </li></ul><ul><ul><li>efficient at low load: single node can fully utilize channel </li></ul></ul><ul><ul><li>high load: collision overhead </li></ul></ul><ul><li>taking-turns protocols </li></ul><ul><ul><li>look for best of both worlds! </li></ul></ul>
  33. 33. “ Taking Turns” MAC protocols <ul><li>Polling: </li></ul><ul><li>master node “invites” slave nodes to transmit in turn </li></ul><ul><li>Request to Send, Clear to Send msgs </li></ul><ul><li>concerns: </li></ul><ul><ul><li>polling overhead </li></ul></ul><ul><ul><li>latency </li></ul></ul><ul><ul><li>single point of failure (master) </li></ul></ul><ul><li>Token passing: </li></ul><ul><li>control token passed from one node to next sequentially. </li></ul><ul><li>token message </li></ul><ul><li>concerns: </li></ul><ul><ul><li>token overhead </li></ul></ul><ul><ul><li>latency </li></ul></ul><ul><ul><li>single point of failure (token) </li></ul></ul>
  34. 34. Reservation-based protocols <ul><li>Distributed Polling: </li></ul><ul><li>time divided into slots </li></ul><ul><li>begins with N short reservation slots </li></ul><ul><ul><li>reservation slot time equal to channel end-end propagation delay </li></ul></ul><ul><ul><li>station with message to send post reservation </li></ul></ul><ul><ul><li>reservation seen by all stations </li></ul></ul><ul><li>after reservation slots, message transmissions ordered by known priority </li></ul>
  35. 35. Summary of MAC Protocols <ul><li>what do you do with a shared media? </li></ul><ul><li>channel partitioning , by time, frequency, or code </li></ul><ul><ul><li>time division, frequency division, code division, </li></ul></ul><ul><li>random access (dynamic) </li></ul><ul><ul><li>ALOHA, S-ALOHA, CSMA, CSMA/CD </li></ul></ul><ul><ul><li>carrier sensing: easy in some technologies (wire), hard in others (wireless) </li></ul></ul><ul><ul><li>CSMA/CD used in Ethernet </li></ul></ul><ul><li>taking turns </li></ul><ul><ul><li>polling from a central site, token passing </li></ul></ul>
  36. 36. LAN technologies <ul><li>Data link layer so far: </li></ul><ul><li>services, error detection/correction, multiple access </li></ul><ul><li>Next: LAN technologies </li></ul><ul><li>addressing </li></ul><ul><li>Ethernet </li></ul><ul><li>hubs, switches </li></ul><ul><li>PPP </li></ul>
  37. 37. Link Layer <ul><li>5.1 Introduction and services </li></ul><ul><li>5.2 Error detection and correction </li></ul><ul><li>5.3Multiple access protocols </li></ul><ul><li>5.4 Link-Layer Addressing </li></ul><ul><li>5.5 Ethernet </li></ul><ul><li>5.6 Hubs and switches </li></ul><ul><li>5.7 PPP </li></ul><ul><li>5.8 Link Virtualization: ATM </li></ul>
  38. 38. LAN Addresses and ARP <ul><li>32-bit IP address: </li></ul><ul><li>network-layer address </li></ul><ul><li>used to get datagram to destination network (recall IP network definition) </li></ul><ul><li>LAN address: </li></ul><ul><li>it is variously called physical address, Ethernet address, or MAC (media access control) address </li></ul><ul><li>used to get datagram from one adapter to another physically-connected adapter (same network) </li></ul><ul><li>six-bytes long (for most LANs), giving 2 48 possible LAN addresses </li></ul><ul><li>these six-byte addresses are typically expressed in hexadecimal notation: e.g., 49-BD-D2-C7-56-2A </li></ul><ul><li>adapter's LAN address is permanent -- when an adapter is manufactured, a LAN address is burned into the adapter's ROM. </li></ul>
  39. 39. LAN Addresses and ARP (cont.) Each adapter on LAN has unique LAN address Broadcast address = FF-FF-FF-FF-FF-FF = adapter 1A-2F-BB-76-09-AD 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 71-65-F7-2B-08-53 LAN (wired or wireless)
  40. 40. LAN Addresses and ARP (cont.) <ul><li>MAC address allocation administered by IEEE </li></ul><ul><li>manufacturer buys portion of MAC address space (to assure uniqueness) </li></ul><ul><li>analogy: </li></ul><ul><ul><li>MAC address: like social security number </li></ul></ul><ul><ul><li>IP address: like postal address </li></ul></ul><ul><li>MAC flat address --> portability </li></ul><ul><ul><li>can move LAN card from one LAN to another </li></ul></ul><ul><li>IP hierarchical address NOT portable </li></ul><ul><ul><li>depends on network to which one attaches </li></ul></ul><ul><li>LAN broadcast address is a string of 48 consecutive 1s: FF-FF-FF-FF-FF-FF </li></ul>
  41. 41. Recall earlier routing discussion <ul><li>starting at A, given IP datagram addressed to B: </li></ul><ul><li>look up net. address of B, find B on same net. as A </li></ul><ul><li>link layer send datagram to B inside link-layer frame </li></ul>B’s MAC addr A’s MAC addr A’s IP addr B’s IP addr IP payload datagram frame frame dest, source address datagram source, dest address A B E
  42. 42. ARP: Address Resolution Protocol <ul><li>each IP node (host, router) on LAN has ARP module and table </li></ul><ul><li>ARP table: IP/MAC address mappings for some LAN nodes </li></ul><ul><li>< IP address1; MAC address1; TTL1> </li></ul><ul><li>< IP address2; MAC address2; TTL2> </li></ul><ul><li>TTL (time to live): time after which address mapping will be forgotten (typically 20 min) </li></ul>Question: how to determine MAC address of B given B’s IP address?
  43. 43. ARP Protocol <ul><li>A wants to send datagram to B, and A knows B’s IP address. </li></ul><ul><li>sppose B’s MAC address is not in A’s ARP table. </li></ul><ul><li>A passes an ARP query packet to the adapter along with an indication that the adapter should send the packet to the LAN broadcast address (FF-FF-FF-FF-FF-FF) </li></ul><ul><li>broadcasts ARP query pkt, containing B's IP address </li></ul><ul><ul><li>all machines on LAN receive ARP query </li></ul></ul><ul><li>B receives ARP packet, replies to A with its (B's) physical layer address </li></ul><ul><ul><li>frame sent to A’s MAC address (unicast) </li></ul></ul><ul><li>A caches (saves) IP-to-physical address pairs until information becomes old (times out) </li></ul><ul><ul><li>soft state: information that times out (goes away) unless refreshed </li></ul></ul><ul><li>ARP is plug-and-play </li></ul><ul><ul><li>nodes create their ARP tables without intervention from net administrator </li></ul></ul>
  44. 44. Routing to another LAN <ul><li>walkthrough: send datagram from A to B via R </li></ul><ul><li>assume A know’s B IP address </li></ul><ul><li>A creates IP packet with source A, destination B </li></ul><ul><li>in routing table at source host, find router </li></ul><ul><li>A uses ARP to get R’s LAN address for </li></ul>A R B
  45. 45. <ul><li>in ARP table at source, find LAN address E6-E9-00-17-BB-4B </li></ul><ul><li>A creates Ethernet frame with R's physical address as dest, Ethernet frame contains A-to-B IP datagram </li></ul><ul><li>A’s data link layer sends Ethernet frame to R </li></ul><ul><li>R’s data link layer receives Ethernet frame from A </li></ul><ul><li>R removes IP datagram from Ethernet frame, sees it is destined to B </li></ul><ul><li>R uses ARP to get B’s physical address </li></ul><ul><ul><li>two ARP tables in router R, one for each IP network (LAN) </li></ul></ul><ul><li>R creates frame containing A-to-B IP datagram </li></ul><ul><li>R’s data link layer sends Ethernet frame to B </li></ul>A R B
  46. 46. DHCP: Dynamic Host Configuration Protocol <ul><li>Goal: allow host to dynamically obtain its IP address from network server when it joins network </li></ul><ul><ul><li>can renew its lease on address in use </li></ul></ul><ul><ul><li>allows reuse of addresses </li></ul></ul><ul><ul><li>support for mobile users who want to join network (more shortly) dynamically get address: “plug-and-play” </li></ul></ul><ul><li>DHCP overview: 4-step process </li></ul><ul><ul><li>DHCP sever discovery: client broadcasts to locate available servers </li></ul></ul><ul><ul><li>DHCP server offer(s): server to client in response to DHCP discover with offer of configuration parameters. client receives one or more DHCP offer messages from one or more servers </li></ul></ul><ul><ul><li>DHCP request: client message to servers either (a) requesting offered parameters from one server and implicitly declining offers from all others, (b) confirming correctness of previously allocated address after, e.g., system reboot, or (c) extending the lease on a particular network address. </li></ul></ul><ul><ul><li>DHCPACK: server to client with configuration parameters, including committed network address </li></ul></ul>
  47. 47. DHCP client-server scenario DHCP server arriving DHCP client needs address in this network A B E
  48. 48. DHCP client-server scenario DHCP server: arriving client time DHCP offer src:, 67 dest:, 68 yiaddrr: transaction ID: 654 Lifetime: 3600 secs DHCP request src:, 68 dest::, 67 yiaddrr: transaction ID: 655 Lifetime: 3600 secs DHCP ACK src:, 67 dest:, 68 yiaddrr: transaction ID: 655 Lifetime: 3600 secs time DHCP discover src :, 68 dest.:,67 yiaddr: transaction ID: 654
  49. 49. Link Layer <ul><li>5.1 Introduction and services </li></ul><ul><li>5.2 Error detection and correction </li></ul><ul><li>5.3Multiple access protocols </li></ul><ul><li>5.4 Link-Layer Addressing </li></ul><ul><li>5.5 Ethernet </li></ul><ul><li>5.6 Hubs and switches </li></ul><ul><li>5.7 PPP </li></ul><ul><li>5.8 Link Virtualization: ATM </li></ul>
  50. 50. Ethernet <ul><li>dominant LAN technology, first widely deployed high-speed LAN technology </li></ul><ul><li>token ring, FDDI, and ATM are more complex and expensive than Ethernet </li></ul><ul><li>kept up with speed race: 10 – 10Gbps </li></ul><ul><li>since it has been so popular, Ethernet hardware has become a commodity and is remarkably cheap ($20 for 100Mbs!) </li></ul><ul><li>the low cost is also due to the fact that Ethernet's multiple access protocol, CSMA/CD, is completely decentralized, which has contributed to a simple design </li></ul>Metcalfe’s Etheret sketch
  51. 51. Star topology <ul><li>Bus topology popular through mid 90s </li></ul><ul><li>Now star topology prevails </li></ul><ul><li>Connection choices: hub or switch (more later) </li></ul>
  52. 52. Ethernet Frame Structure <ul><li>sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame </li></ul><ul><li>preamble (8 bytes): </li></ul><ul><ul><li>7 bytes with pattern 10101010 followed by one byte with pattern 10101011 </li></ul></ul><ul><ul><li>used to synchronize receiver, sender clock rates </li></ul></ul><ul><li>data field (46 to 1500 bytes) </li></ul><ul><ul><li>this field carries IP datagram </li></ul></ul><ul><ul><li>the maximum transfer unit (MTU) of Ethernet is 1500 bytes </li></ul></ul><ul><ul><li>the minimum size of the data field is 46 bytes. if the IP datagram is less than 46 bytes, the data field has to be &quot;stuffed&quot; to fill it out to 46 bytes. the network layer uses the length field in the IP datagram header to remove the stuffing </li></ul></ul>
  53. 53. Ethernet Frame Structure (more) <ul><li>destination address (6 bytes): frame is received by all adapters on a LAN and dropped if address does not match </li></ul><ul><li>source address (6 bytes) </li></ul><ul><li>type (2 bytes): </li></ul><ul><ul><li>indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk) </li></ul></ul><ul><ul><li>ARP protocol also has its own type number </li></ul></ul><ul><li>cyclic redundancy check (CRC) (4 bytes) : checked at receiver, if error is detected, the frame is simply dropped </li></ul>
  54. 54. Ethernet: Unreliable, connectionless service <ul><li>Connectionless: </li></ul><ul><ul><li>no handshaking between sending and receiving adapter. </li></ul></ul><ul><li>Unreliable: </li></ul><ul><ul><li>receiving adapter doesn’t send acks or nacks to sending adapter </li></ul></ul><ul><ul><li>stream of datagrams passed to network layer can have gaps </li></ul></ul><ul><ul><li>gaps will be filled if app is using TCP </li></ul></ul><ul><ul><li>otherwise, app will see the gaps </li></ul></ul>
  55. 55. Ethernet: services and transmission <ul><li>provide connectionless and unreliable service to the network layer </li></ul><ul><li>baseband transmission </li></ul><ul><li>Manchester encoding </li></ul><ul><ul><li>used in 10BaseT, 10Base2 </li></ul></ul><ul><ul><li>each bit has a transition </li></ul></ul><ul><ul><li>allows clocks in sending and receiving nodes to synchronize to each other </li></ul></ul><ul><ul><ul><li>no need for a centralized, global clock among nodes! </li></ul></ul></ul>
  56. 56. Ethernet uses CSMA/CD <ul><li>no slots </li></ul><ul><li>adapter doesn’t transmit if it senses that some other adapter is transmitting, that is, carrier sense </li></ul><ul><li>transmitting adapter aborts when it senses that another adapter is transmitting, that is, collision detection </li></ul><ul><li>before attempting a retransmission, adapter waits a random time, that is, random access </li></ul>
  57. 57. Ethernet’s CSMA/CD <ul><li>adapter obtains a network-layer PDU, prepares an Ethernet frame , and puts the frame in an adapter buffer. </li></ul><ul><li>if the adapter senses that the channel is idle, it starts to transmit the frame. If the channel is busy, it waits until it senses no signal energy (plus 96 bit times) and then starts to transmit the frame. </li></ul><ul><li>while transmitting, the adapter monitors for the presence of signal energy coming from other adapters. If the adapter transmits the entire frame without detecting signal energy from other adapters, the adapter is done with the frame. </li></ul><ul><li>if the adapter detects signal energy from other adapters, it stops transmitting its frame and instead transmits a 48-bit jam signal . </li></ul><ul><li>after aborting (that is, transmitting the jam signal), the adapter enters an exponential backoff phase . The adapter then waits K • 512 bit times and then returns to step 2. </li></ul>
  58. 58. Ethernet’s CSMA/CD (more) <ul><li>jam signal: </li></ul><ul><ul><li>make sure all other transmitters are aware of collision </li></ul></ul><ul><ul><li>48-bit random bit pattern </li></ul></ul><ul><li>exponential backoff: </li></ul><ul><ul><li>Goal: adapt retransmission attempts to estimated current load </li></ul></ul><ul><ul><li>after experiencing the n th collision in a row, the adapter chooses a value for K at random from {0,1,2, . . ., 2 m - 1} where m = min( n ,10). the adapter then waits K • 512 bit times </li></ul></ul><ul><ul><ul><li>first collision: choose K from {0,1}; delay is K * 512 bit transmission times </li></ul></ul></ul><ul><ul><ul><li>after second collision: choose K from {0,1,2,3} </li></ul></ul></ul><ul><ul><ul><li>after ten or more collisions, choose K from {0,1,2,3,4, …,1023} </li></ul></ul></ul><ul><ul><li>if many adapters are involved in the collision, it makes sense to choose K from a larger, more dispersed set of values </li></ul></ul><ul><ul><li>heavy load: random wait will be longer </li></ul></ul><ul><li>bit time: 0.1 microsec for 10 Mbps Ethernet </li></ul><ul><ul><li>for K=1023, wait time is about 50 msec </li></ul></ul>
  59. 59. CSMA/CD efficiency <ul><li>T prop = max prop between 2 nodes in LAN </li></ul><ul><li>t trans = time to transmit max-size frame </li></ul>See/interact with Java applet on AWL Web site: highly recommended ! <ul><li>efficiency goes to 1 as t prop goes to 0 </li></ul><ul><li>goes to 1 as t trans goes to infinity </li></ul><ul><li>much better than ALOHA, but still decentralized, simple, and cheap </li></ul>
  60. 60. Ethernet Technologies: 10Base2 <ul><li>10 : 10Mbps; 2 : under 200 meters max cable length </li></ul><ul><li>thin coaxial cable in a bus topology </li></ul><ul><li>repeaters used to connect up to multiple segments </li></ul><ul><li>repeater repeats bits it hears on one interface to its other interfaces: physical layer device only! </li></ul><ul><li>without a repeater, the maximum length is 185 meters, the maximum number of nodes is 30 </li></ul>10Base2 Ethernet
  61. 61. 10BaseT and 100BaseT <ul><li>10/100 Mbps rate; latter called “ fast Ethernet ” </li></ul><ul><li>T stands for twisted pair </li></ul><ul><li>hub to which nodes are connected by twisted pair, thus “ star topology ” </li></ul><ul><li>4B5B encoding : used in 100BaseT. data byte is first broken into two nibbles. if the byte is 0E, the first nibble is 0 and the second nibble is E. next each nibble is remapped according to the following table: </li></ul><ul><li>0000-- 11110 0001-- 01001 0010-- 10100 0011-- 10101 0100— 01010 </li></ul><ul><li>0101-- 01011 0110-- 01110 0111-- 01111 1000-- 10010 1001— 10011 </li></ul><ul><li>1010-- 10110 1011-- 10111 1100-- 11010 1101-- 11011 1110— 11100 </li></ul><ul><li>1111-- 11101 </li></ul>star topology for 10BaseT and 100BaseT
  62. 62. 10BaseT and 100BaseT (cont.) <ul><li>max distance from node to hub is 100 meters </li></ul><ul><li>hubs are essentially physical-layer repeaters: </li></ul><ul><ul><li>bits coming in one link go out all other links </li></ul></ul><ul><ul><li>no frame buffering </li></ul></ul><ul><ul><li>no CSMA/CD at hub: adapters detect collisions </li></ul></ul><ul><li>provides net management functionality </li></ul><ul><ul><li>hub can disconnect “jabbering adapter” </li></ul></ul><ul><ul><li>hub can gather monitoring information, statistics for display to LAN administrators </li></ul></ul>
  63. 63. Gigabit Ethernet <ul><li>Uses the standard Ethernet frame format , and is backward compatible with 10BaseT and 100BaseT technologies. This allows for easy integration of Gigabit Ethernet with the existing installed base of Ethernet equipment. </li></ul><ul><li>Allows for point-to-point links as well as shared broadcast channels . Point-to-point links use switches (see Section 5.6) whereas broadcast channels use hubs. In Gigabit Ethernet jargon, hubs are called &quot;buffered distributors&quot; </li></ul><ul><li>Uses CSMA/CD for shared broadcast channels . In order to have acceptable efficiency, the maximum distance between nodes must be severely restricted. </li></ul><ul><li>Allows for full-duplex operation at 1 Gbps in both directions for point-to-point channels. </li></ul><ul><li>10 Gbps now ! </li></ul>
  64. 64. Link Layer <ul><li>5.1 Introduction and services </li></ul><ul><li>5.2 Error detection and correction </li></ul><ul><li>5.3Multiple access protocols </li></ul><ul><li>5.4 Link-Layer Addressing </li></ul><ul><li>5.5 Ethernet </li></ul><ul><li>5.6 Interconnections: Hubs and switches </li></ul><ul><li>5.7 PPP </li></ul><ul><li>5.8 Link Virtualization: ATM </li></ul>
  65. 65. Token Ring: IEEE802.5 standard <ul><li>4 Mbps, 16 Mbps </li></ul><ul><li>max token holding time: 10 ms, which limits frame length </li></ul><ul><li>SD (starting delimiter), ED (ending delimiter) mark start, end of packet </li></ul><ul><li>AC (access control): </li></ul><ul><ul><li>token bit: value 0 means token can be seized, value 1 means data follows FC </li></ul></ul><ul><ul><li>priority bits: priority of packet </li></ul></ul><ul><ul><li>reservation bits: station can write these bits to prevent stations with lower priority packet from seizing token after token becomes free </li></ul></ul>ED
  66. 66. Token Ring: IEEE802.5 standard (cont.) <ul><li>FC: frame control used for monitoring and maintenance </li></ul><ul><li>source, destination address: 48 bit physical address, as in Ethernet </li></ul><ul><li>data: packet from network layer </li></ul><ul><li>checksum: CRC </li></ul><ul><li>FS (frame status): set by dest., read by sender </li></ul><ul><ul><li>set to indicate destination up, frame copied OK from ring </li></ul></ul><ul><ul><li>DLC-level ACKing </li></ul></ul>ED
  67. 67. Hubs <ul><li>physical layer devices: essentially repeaters operating at bit levels: repeat received bits on one interface to all other interfaces </li></ul><ul><li>hubs can be arranged in a hierarchy (or multi-tier design), with backbone hub at its top </li></ul><ul><li>each connected LAN referred to as LAN segment </li></ul><ul><li>hubs do not isolate collision domains: node may collide with any node residing at any segment in LAN </li></ul>three departmental Ethernets interconnected with a hub
  68. 68. Hubs (cont.) <ul><li>hub advantages: </li></ul><ul><ul><li>simple, inexpensive device </li></ul></ul><ul><ul><li>multi-tier provides graceful degradation: portions of the LAN continue to operate if one hub malfunctions </li></ul></ul><ul><ul><li>extends maximum distance between node pairs (100m per Hub) </li></ul></ul><ul><li>hub limitations: </li></ul><ul><ul><li>single collision domain results in no increase in max throughput </li></ul></ul><ul><ul><ul><li>multi-tier throughput same as single segment throughput </li></ul></ul></ul><ul><ul><li>individual LAN restrictions pose limits on number of nodes in same collision domain and on total allowed geographical coverage </li></ul></ul><ul><ul><li>cannot connect different Ethernet types (e.g., 10BaseT and 100baseT) </li></ul></ul>
  69. 69. Link-layer switches <ul><li>link layer device </li></ul><ul><ul><li>stores and forwards Ethernet frames </li></ul></ul><ul><ul><li>examines frame header and selectively forwards frame based on MAC dest address </li></ul></ul><ul><ul><li>when frame is to be forwarded on segment, uses CSMA/CD to access segment </li></ul></ul><ul><li>transparent: hosts are unaware of presence of switches </li></ul><ul><li>plug-and-play, self-learning </li></ul><ul><ul><li>switches do not need to be configured </li></ul></ul>three departmental LANs interconnected with a switch
  70. 70. Switch forwarding and filtering <ul><li>filtering: ability to determine whether a frame should be forwarded to some interface or should be just dropped </li></ul><ul><li>forwarding: ability to determine the interface to which a frame should be directed </li></ul><ul><li>How do determine onto which LAN segment to forward frame? </li></ul><ul><li>Looks like a routing problem... </li></ul>hub hub hub switch 1 2 3
  71. 71. Self learning <ul><li>A switch has a switch table </li></ul><ul><li>entry in switch table: </li></ul><ul><ul><li>(MAC address, Interface, Time stamp) </li></ul></ul><ul><ul><li>stale entries in table dropped (TTL can be 60 min) </li></ul></ul><ul><li>self-learning: </li></ul><ul><ul><li>switch learns which hosts can be reached through which interfaces </li></ul></ul><ul><ul><li>when frame received, switch “learns” location of sender: incoming LAN segment </li></ul></ul><ul><ul><li>records sender/location pair in switch table </li></ul></ul>
  72. 72. Filtering/Forwarding <ul><li>When switch receives a frame: </li></ul><ul><li>index switch table using MAC dest address </li></ul><ul><li>if entry found for destination then { </li></ul><ul><li>if dest on segment from which frame arrived then drop the frame </li></ul><ul><li>else forward the frame on interface indicated </li></ul><ul><li>} </li></ul><ul><li>else flood </li></ul>forward on all but the interface on which the frame arrived
  73. 73. Switch example (1) <ul><li>Suppose C sends a frame to D </li></ul><ul><li>switch receives frame from from C </li></ul><ul><ul><li>switch notes that C is on interface 1 </li></ul></ul><ul><ul><li>because D is not in table, switch forwards frame into interfaces 2 and 3 </li></ul></ul><ul><li>frame is received by D </li></ul>hub hub hub switch A B C D E F G H 1 2 3 I address interface A B E G C 1 1 2 3 1
  74. 74. Switch example (2) <ul><li>Suppose D replies back with frame to C. </li></ul><ul><li>switch receives frame from from D </li></ul><ul><ul><li>switch notes that D is on interface 2 </li></ul></ul><ul><ul><li>because C is in the table, switch selectively forwards frame only to interface 1 </li></ul></ul><ul><li>frame received by C </li></ul><ul><li>switches are plug-and-play devices </li></ul>address interface A B E G C D 1 1 2 3 1 2 hub hub hub switch A B C D E F G H I 1 2 3
  75. 75. Switches: traffic isolation <ul><li>filtering: </li></ul><ul><ul><li>same-LAN-segment frames not forwarded onto other LAN segments </li></ul></ul><ul><ul><li>segments become separate collision domains </li></ul></ul><ul><li>forwarding: </li></ul><ul><ul><li>know the LAN segment on which to forward frame </li></ul></ul><ul><li>switch advantages: </li></ul><ul><ul><li>isolates collision domains resulting in higher total max throughput, and does not limit the number of nodes nor geographical coverage </li></ul></ul><ul><ul><li>can connect different type Ethernet since it is a store and forward device </li></ul></ul>hub hub hub switch collision domain collision domain collision domain
  76. 76. Switches: dedicated access <ul><li>switch with many interfaces </li></ul><ul><li>hosts have direct connection to switch </li></ul><ul><li>no collisions; full duplex </li></ul><ul><li>cut-through switching: frame is forwarded from input to output port before the entire packet has arrived if the buffer becomes empty </li></ul><ul><ul><li>slight reduction in latency </li></ul></ul><ul><li>combinations of shared/dedicated, 10/100/1000 Mbps interfaces </li></ul><ul><li>Switching: A-to-A’ and B-to-B’ simultaneously, no collisions </li></ul>switch A A’ B B’ C C’
  77. 77. Institutional network switch
  78. 78. Switches vs. Routers <ul><li>both store-and-forward devices </li></ul><ul><ul><li>routers: network layer devices (examine network layer headers) </li></ul></ul><ul><ul><li>switches are link layer devices </li></ul></ul><ul><li>routers maintain routing tables, implement routing algorithms </li></ul><ul><li>switches maintain switch tables, implement filtering, learning algorithms </li></ul>
  79. 79. Routers vs. Bridges: pros and cons <ul><li>Switches: </li></ul><ul><li>(+) switches are plug and play </li></ul><ul><li>(+) switches operation is simpler, has relatively high packet filtering and forwarding rates </li></ul><ul><li>(-) topologies are restricted with switches: a spanning tree must be built to avoid cycles since bridges do not offer protection against broadcast storms </li></ul><ul><li>(-) spanning tree restriction also concentrates the traffic on the spanning tree links </li></ul><ul><li>Routers: </li></ul><ul><li>(+) arbitrary topologies can be supported, cycling is limited by TTL counters (and good routing protocols) </li></ul><ul><li>(+) provide firewall protection against layer 2 broadcast storms </li></ul><ul><li>(-) require IP address configuration (not plug and play) </li></ul><ul><li>(-) require larger per-packet processing time </li></ul><ul><li>switches do well in small (few hundred hosts) while routers used in large networks (thousands of hosts) </li></ul>
  80. 80. Summary comparison yes no yes cut through no yes no optimal routing yes no yes plug & play yes yes no traffic isolation switches routers hubs
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.