<<

55:054, fall, 2008

Chapter 5 Chapter 5: The Data Link Layer Link Layer and LANs Our goals:  understand principles behind data link layer services:  error detection, correction  sharing a broadcast channel: multiple access  link layer addressing  Computer Networking: reliable data transfer, flow control: done! A Top Down Approach  instantiation and implementation of various link th 4 edition. layer technologies Jim Kurose, Keith Ross Addison-Wesley, July 2007.

All material copyright 1996-2007 J.F Kurose and K.W. Ross, All Rights Reserved

5: DataLink Layer 5-1 5: DataLink Layer 5-2

Link Layer Link Layer: Introduction Some terminology:  5.1 Introduction and  5.6 Link-layer switches  hosts and routers are nodes services  5.7 PPP  communication channels that  5.2 Error detection connect adjacent nodes along  5.8 Link virtualization: communication path are links and correction ATM, MPLS  wired links  5. 3Multiple access  wilireless liklinks protocols  LANs  5.4 Link-layer  layer-2 packet is a frame, Addressing encapsulates datagram  5.5 data-link layer has responsibility of transferring datagram from one node to adjacent node over a link 5: DataLink Layer 5-3 5: DataLink Layer 5-4

J. Kuhl 1 55:054, fall, 2008

Link layer: context Link Layer Services  datagram transferred by transportation analogy   framing, link access: different link protocols trip from Princeton to Lausanne over different links:  encapsulate datagram into frame, adding header, trailer  limo: Princeton to JFK  channel access if shared medium  e.g., Ethernet on first link,  plane: JFK to Geneva frame relay on  “MAC” addresses used in frame headers to identify intermediate links, 802.11  train: Geneva to Lausanne source, dest on last llkink  tourist = datagram • differen t from IP a ddress !  each link protocol  transport segment =  reliable delivery between adjacent nodes provides different communication link  we learned how to do this already (chapter 3)! services  transportation mode =  seldom used on low bit-error link (fiber, some twisted pair)  e.g., may or may not link layer protocol provide rdt over link  wireless links: high error rates  travel agent = routing • Q: why both link-level and end-end reliability? algorithm

5: DataLink Layer 5-5 5: DataLink Layer 5-6

Link Layer Services (more) Where is the link layer implemented?

 in each and every host  flow control:  link layer implemented in  pacing between adjacent sending and receiving nodes “adaptor” (aka network host schematic  error detection: interface card NIC) application transport  errors caused by signal attenuation, noise.  Ethernet card, PCMCI network cpu memory link  receiver detects presence of errors: card, 802.11 card • signals sender for retransmission or drops frame  implements link, physical host bus layer controller (e.g., PCI)  error correction: link physical  attaches into host’s physical  receiver identifies and corrects bit error(s) without transmission resorting to retransmission system buses  half-duplex and full-duplex  combination of network adapter card  with half duplex, nodes at both ends of link can transmit, hardware, software, but not at same time firmware 5: DataLink Layer 5-7 5: DataLink Layer 5-8

J. Kuhl 2 55:054, fall, 2008

Adaptors Communicating Link Layer

 5.1 Introduction and  5.6 Link-layer switches datagram datagram services  5.7 PPP controller controller  5.2 Error detection  5.8 Link Virtualization: and correction sending host receiving host ATM. MPLS datagram  5. 3Multiple access frame protocols  5.4 Link-layer  sending side:  receiving side Addressing  encapsulates datagram in  looks for errors, rdt, flow  frame control, etc 5.5 Ethernet  adds error checking bits,  extracts datagram, passes rdt, flow control, etc. to upper layer at receiving side 5: DataLink Layer 5-9 5: DataLink Layer 5-10

Error Detection Parity Checking

EDC= Error Detection and Correction bits (redundancy) Two Dimensional Bit Parity: D = Data protected by error checking, may include header fields Single Bit Parity: Detect single bit errors Detect and correct single bit errors • Error detection not 100% reliable! • protocol may miss some errors, but rarely • larger EDC field yields better detection and correction

otherwise

0 0

5: DataLink Layer 5-11 5: DataLink Layer 5-12

J. Kuhl 3 55:054, fall, 2008

Internet checksum (review) Checksumming: Cyclic Redundancy Check

Goal: detect “errors” (e.g., flipped bits) in transmitted  view data bits, D, as a binary number packet (note: used at only)  choose r+1 bit pattern (generator), G  goal: choose r CRC bits, R, such that Receiver:  exactly divisible by G (modulo 2) Sender:  receiver knows G, divides by G. If non-zero remainder:  compute checksum of  treat segment contents error detected! received segment as sequence of 16-bit  can detect all burst errors less than r+1 bits  check if computed checksum integers  widely used in practice (802.11 WiFi, ATM) equals checksum field value:  checksum: addition (1’s complement sum) of  NO - error detected segment contents  YES - no error detected.  sender puts checksum But maybe errors value into UDP checksum nonetheless? field

5: DataLink Layer 5-13 5: DataLink Layer 5-14

CRC Example Link Layer Want: D.2r XOR R = nG  5.1 Introduction and  5.6 Link-layer switches services equivalently:  5.7 PPP  5.2 Error detection D.2r = nG XOR R  5.8 Link Virtualization: and correction ATM, MPLS eqqyuivalently:  5. 3Multiple access . r if we divide D 2 by protocols G, want remainder R  5.4 Link-layer Addressing  5.5 Ethernet D.2r R = remainder[ ] G

5: DataLink Layer 5-15 5: DataLink Layer 5-16

J. Kuhl 4 55:054, fall, 2008

Multiple Access Links and Protocols Multiple Access protocols Two types of “links”:  single shared broadcast channel  point-to-point   PPP for dial-up access two or more simultaneous transmissions by nodes:  point-to-point link between Ethernet switch and host interference  broadcast (shared wire or medium)  collision if node receives two or more signals at the same time  old-fashioned Ethernet multiple access protocol  upstream HFC  distributed algorithm that determines how nodes  802.11 wireless LAN share channel, i.e., determine when node can transmit  communication about channel sharing must use channel itself!  no out-of-band channel for coordination

humans at a shared wire (e.g., shared RF shared RF cocktail party cabled Ethernet) (e.g., 802.11 WiFi) (satellite) (shared air, acoustical) 5: DataLink Layer 5-17 5: DataLink Layer 5-18

Ideal Multiple Access Protocol MAC Protocols: a taxonomy Three broad classes: Broadcast channel of rate R bps  Channel Partitioning 1. when one node wants to transmit, it can send at  divide channel into smaller “pieces” (time slots, rate R. frequency, code) 2. when M nodes want to transmit, each can send at  allocate piece to node for exclusive use average rate R/M  Random Access 3. fully decentralized:  channel not divided, allow collisions   no special node to coordinate transmissions “recover” from collisions  no synchronization of clocks, slots  “Taking turns” 4. simple  nodes take turns, but nodes with more to send can take longer turns

5: DataLink Layer 5-19 5: DataLink Layer 5-20

J. Kuhl 5 55:054, fall, 2008

Channel Partitioning MAC protocols: TDMA Channel Partitioning MAC protocols: FDMA

TDMA: time division multiple access FDMA: frequency division multiple access  access to channel in "rounds"  channel spectrum divided into frequency bands  each station gets fixed length slot (length = pkt  each station assigned fixed frequency band trans time) in each round  unused transmission time in frequency bands go idle  unused slots go idle  example: 6-station LAN, 1, 3, 4 have pkt, frequency  example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 bands 2,5,6 idle idle

6-slot frame 1 3 4 1 3 4

FDM cable frequency bands

5: DataLink Layer 5-21 5: DataLink Layer 5-22

Random Access Protocols Slotted ALOHA

 When node has packet to send Assumptions: Operation:  transmit at full channel data rate R.  all frames same size  when node obtains fresh  no a priori coordination among nodes  time divided into equal frame, transmits in next slot  two or more transmitting nodes ➜ “collision”, size slots (time to transmit 1 frame)  if no collision: node can  random access MAC protocol specifies:  nodes start to transmit send new frame in next  how to detect collisions only slot beginning slot  how to recover from collisions (e.g., via delayed  nodes are synchronized  if collision: node retransmissions) retransmits frame in  Examples of random access MAC protocols:  if 2 or more nodes transmit in slot, all each subsequent slot  slotted ALOHA nodes detect collision with prob. p until  ALOHA success  CSMA, CSMA/CD, CSMA/CA

5: DataLink Layer 5-23 5: DataLink Layer 5-24

J. Kuhl 6 55:054, fall, 2008

Slotted ALOHA Slotted Aloha efficiency

Efficiency : long-run  max efficiency: find fraction of successful slots p* that maximizes (many nodes, all with many Np(1-p)N-1 frames to send)  for many nodes, take limit of Np*(1-p*)N-1  suppose: N nodes with as N ggyoes to infinity, Cons PsPros many frames to send, gives:   single active node can collisions, wasting slots each transmits in slot Max efficiency = 1/e = .37 continuously transmit  idle slots with probability p at full rate of channel  nodes may be able to  prob that given node At best: channel detect collision in less  highly decentralized: has success in a slot = used for useful than time to transmit only slots in nodes p(1-p)N-1 transmissions 37% packet need to be in sync  prob that any node has of time! !  clock synchronization  simple a success = Np(1-p)N-1 5: DataLink Layer 5-25 5: DataLink Layer 5-26

Pure (unslotted) ALOHA Pure Aloha efficiency

 unslotted Aloha: simpler, no synchronization P(success by given node) = P(node transmits) . .  when frame first arrives P(no other node transmits in [p0-1,p0]  transmit immediately P(no other node transmits in [p0-1,p0]  collision probability increases: = p . (1-p)N-1 . (1-p)N-1

 frame sent at t0 collides with other frames sent in [t0-1,t0+1] = p . (1-p)2(N-1)

… choosing optimum p and then letting n -> infty ...

= 1/(2e) = .18

even worse than slotted Aloha!

5: DataLink Layer 5-27 5: DataLink Layer 5-28

J. Kuhl 7 55:054, fall, 2008

CSMA (Carrier Sense Multiple Access) CSMA collisions spatial layout of nodes

collisions can still occur: CSMA: listen before transmit: propagation delay means If channel sensed idle: transmit entire frame two nodes may not hear each other’s transmission  If channel sensed busy, defer transmission collision: entire packet transmission time wasted  human analogy: don’t interrupt others! note: role of distance & propagation delay in determining collision probability

5: DataLink Layer 5-29 5: DataLink Layer 5-30

CSMA/CD (Collision Detection) CSMA/CD collision detection

CSMA/CD: carrier sensing, deferral as in CSMA  collisions detected within short time  colliding transmissions aborted, reducing channel wastage  collision detection:  easy in wired LANs: measure signal strengths, compare transmitted, received signals  difficult in wireless LANs: received signal strength overwhelmed by local transmission strength  human analogy: the polite conversationalist

5: DataLink Layer 5-31 5: DataLink Layer 5-32

J. Kuhl 8 55:054, fall, 2008

“Taking Turns” MAC protocols “Taking Turns” MAC protocols

channel partitioning MAC protocols: Polling:   share channel efficiently and fairly at high load master node “invites” slave nodes  inefficient at low load: delay in channel access, data to transmit in turn poll 1/N bandwidth allocated even if only 1 active node!  typically used with master “dumb” slave devices data Random access MAC protocols  concerns:  efficient at low load: single node can fully  polling overhead utilize channel  latency slaves  high load: collision overhead  single point of “taking turns” protocols failure (master) look for best of both worlds!

5: DataLink Layer 5-33 5: DataLink Layer 5-34

“Taking Turns” MAC protocols Summary of MAC protocols

Token passing: T  channel partitioning, by time, frequency or code  control token passed  Time Division, Frequency Division from one node to next  sequentially. random access (dynamic),  ALOHA, S-ALOHA, CSMA, CSMA/CD  token message (nothing  carrier sensing: easy in some technologies (wire), hard in to send)  concerns: others (wireless) T  token overhead  CSMA/CD used in Ethernet  latency  CSMA/CA used in 802.11  single point of failure  taking turns (token)  polling from central site, token passing  , FDDI, IBM Token Ring

data

5: DataLink Layer 5-35 5: DataLink Layer 5-36

J. Kuhl 9 55:054, fall, 2008

LAN technologies Link Layer Data link layer so far:  5.1 Introduction and  5.6 Link-layer switches  services, error detection/correction, multiple services  5.7 PPP access  5.2 Error detection  5.8 Link Virtualization: Next: LAN technologies and correction ATM, MPLS  addressing  5. 3Multiple access  Ethernet protocols  switches  5.4 Link-Layer  PPP Addressing  5.5 Ethernet

5: DataLink Layer 5-37 5: DataLink Layer 5-38

MAC Addresses and ARP LAN Addresses and ARP

Each adapter on LAN has unique LAN address 32-bit IP address:  network-layer address 1A-2F-BB-76-09-AD Broadcast address =  used to get datagram to destination IP subnet FF-FF-FF-FF-FF-FF MAC (or LAN or physical or Ethernet) address: LAN (wired or = adapter  function: get frame from one interface to another wireless) 71-65-F7-2B-08-53 physically-connected interface (same network) 58-23-D7-FA-20-B0  48 bit MAC address (for most LANs) •burned in NIC ROM, also sometimes software settable 0C-C4-11-6F-E3-98

5: DataLink Layer 5-39 5: DataLink Layer 5-40

J. Kuhl 10 55:054, fall, 2008

LAN Address (more) ARP: Address Resolution Protocol

 MAC address allocation administered by IEEE Question: how to determine  Each IP node (host, MAC address of B router) on LAN has  manufacturer buys portion of MAC address space knowing B’s IP address? ARP table (to assure uniqueness)  ARP table: IP/MAC  analogy: 137.196.7.78 address mapping s for (a ) MAC a ddress: like Soc ia l Secur ity Num ber 1A-2F-BB-76-09-AD some LAN nodes 137.196.7.23 (b) IP address: like postal address 137.196.7.14 < IP address; MAC address; TTL>  MAC flat address ➜ portability  TTL (Time To Live): time LAN after which address  can move LAN card from one LAN to another 71-65-F7-2B-08-53 mapping will be forgotten 58-23-D7-FA-20-B0  IP hierarchical address NOT portable (typically 20 min)  address depends on IP subnet to which node is attached 0C-C4-11-6F-E3-98 137.196.7.88

5: DataLink Layer 5-41 5: DataLink Layer 5-42

ARP protocol: Same LAN (network) DHCP: Dynamic Host Configuration Protocol  A wants to send datagram to B, and B’s MAC address  A caches (saves) IP-to- Goal: allow host to dynamically obtain its IP address not in A’s ARP table. MAC address pair in its from network server when joining network  A broadcasts ARP query ARP table until information packet, containing B's IP becomes old (times out)  support for mobile users joining network address  soft state: information  host holds address only while connected and “on”  dest MAC address = FF- that times out (goes (allowing address reuse) FF-FF-FF-FF-FF away) unless refreshed  renew address already in use  all machines on LAN  ARP is “plug-and-play”:  DHCP overview: receive ARP query  nodes create their ARP  B receives ARP packet, tables without  1. host broadcasts “DHCP discover” msg replies to A with its (B's) intervention from net  2. DHCP server responds with “DHCP offer” msg MAC address administrator  frame sent to A’s MAC  3. host requests IP address: “DHCP request” msg address (unicast)  4. DHCP server sends address: “DHCP ack” msg

5: DataLink Layer 5-43 5: DataLink Layer 5-44

J. Kuhl 11 55:054, fall, 2008

DHCP client-server scenario

DHCP client-server scenario arriving DHCP server: 223.1.2.5 DHCP discover client src : 0.0.0.0, 68 dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID: 654 223.1.2.1 A 223.1.1.1 DHCP server DHCP offer src: 223.1.2.5, 67 dest: 255.255.255.255, 68 223.1.1.2 yiaddrr: 223.1.2.4 223.1.1.4 223.1.2.9 transaction ID: 654 Lifetime: 3600 secs B DHCP request 223.1.2.2 arriving DHCP 223.1.1.3 223.1.3.27 E src: 0.0.0.0, 68 client needs dest:: 255.255.255.255, 67 address in this yiaddrr: 223.1.2.4 223.1.3.1 223.1.3.2 transaction ID: 655 (223.1.2/24) network time Lifetime: 3600 secs

DHCP ACK src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs

5: DataLink Layer 5-45 5: DataLink Layer 5-46

Addressing: routing to another LAN  A creates IP datagram with source A, destination B  A uses ARP to get R’s MAC address for 111.111.111.110 walkthrough: send datagram from A to B via R  A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram assume A knows B’s IP address This is a really important  A’s NIC sends frame example – make sure you 74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F  R’s NIC receives frame understand!

A E6-E9-00-17-BB-4B  R removes IP datagram from , sees its 222.222.222.221 1A-23-F9-CD-06-9B 111.111.111.111 destined to B  R uses ARP to get B’s MAC address 222.222.222.220 222.222.222.222  R creates frame containing A-to-B IP datagram sends to B 111.111.111.110 B 88-B2-2F-54-1A-0F 111.111.111.112 R 74-29-9C-E8-FF-55 49-BD-D2-C7-56-2A A E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D 222.222.222.221 1A-23-F9-CD-06-9B 111.111.111.111  two ARP tables in router R, one for each IP 222.222.222.220 222.222.222.222 network (LAN) 111.111.111.110 B 111.111.111.112 R 49-BD-D2-C7-56-2A

CC-49-DE-D0-AB-7D 5: DataLink Layer 5-47 5: DataLink Layer 5-48

J. Kuhl 12 55:054, fall, 2008

Link Layer Ethernet “dominant” wired LAN technology:  5.1 Introduction and  5.6 Link-layer switches  cheap $20 for NIC services  5.7 PPP  first widely used LAN technology  5.2 Error detection  5.8 Link Virtualization:  simpler, cheaper than token LANs and ATM and correction ATM and MPLS  kepppt up with sp eed race: 10 Mbp s – 10 Gbps  5. 3Multiple access protocols  5.4 Link-Layer Addressing Metcalfe’s Ethernet  5.5 Ethernet sketch

5: DataLink Layer 5-49 5: DataLink Layer 5-50

Star topology Ethernet Frame Structure  bus topology popular through mid 90s  all nodes in same collision domain (can collide with each Sending adapter encapsulates IP datagram (or other other) network layer protocol packet) in Ethernet frame  today: star topology prevails  active switch in center  each “spoke” runs a (separate) Ethernet protocol (nodes do not collide with each other) Preamble:  7 bytes with pattern 10101010 followed by one byte with pattern 10101011  used to synchronize receiver, sender clock rates

switch

bus: coaxial cable star 5: DataLink Layer 5-51 5: DataLink Layer 5-52

J. Kuhl 13 55:054, fall, 2008

Ethernet Frame Structure (more) Ethernet: Unreliable, connectionless

 Addresses: 6 bytes  if adapter receives frame with matching destination  connectionless: No handshaking between sending and address, or with broadcast address (eg ARP packet), it receiving NICs passes data in frame to network layer protocol  unreliable: receiving NIC doesn’t send acks or nacks  otherwise, adapter discards frame to sending NIC  Type: indicates higher layer protocol (mostly IP  stream of datagrams passed to network layer can have gaps but others possible, e.g., Novell IPX, AppleTalk) (missing datagrams)  CRC: checked at receiver, if error is detected,  gaps will be filled if app is using TCP frame is dropped  otherwise, app will see gaps  Ethernet’s MAC protocol: unslotted CSMA/CD

5: DataLink Layer 5-53 5: DataLink Layer 5-54

Ethernet CSMA/CD algorithm Ethernet’s CSMA/CD (more)

1. NIC receives datagram 4. If NIC detects another Jam Signal: make sure all Exponential Backoff: from network layer, transmission while other transmitters are  Goal: adapt retransmission creates frame transmitting, aborts and aware of collision; 48 bits attempts to estimated 2. If NIC senses channel idle, sends jam signal Bit time: .1 microsec for 10 current load Mbps Ethernet ;  starts frame transmission 5. After aborting, NIC heavy load: random wait for K=1023, wait time is will be longer If NIC senses channel enters exponential about 50 msec  first collision: choose K from busy, waits until channel backoff: after mth {0,1}; delay is K· 512 bit idle, then transmits collision, NIC chooses K at transmission times random from  after second collision: choose 3. If NIC transmits entire See/interact with Java m K from {0,1,2,3}… frame without detecting {0,1,2,…,2 -1}. NIC waits applet on AWL Web site: another transmission, NIC K·512 bit times, returns to highly recommended !  after ten collisions, choose K from {0,1,2,3,4,…,1023} is done with frame ! Step 2

5: DataLink Layer 5-55 5: DataLink Layer 5-56

J. Kuhl 14 55:054, fall, 2008

CSMA/CD efficiency 802.3 Ethernet Standards: Link & Physical Layers  many different Ethernet standards  Tprop = max prop delay between 2 nodes in LAN  common MAC protocol and frame format  ttrans = time to transmit max-size frame  different speeds: 2 Mbps, 10 Mbps, 100 Mbps, 1Gbps, 10G bps 1  different physical layer media: fiber, cable efficiency  1 5t prop /ttrans

MAC protocol  efficiency goes to 1 application and frame format  as tprop goes to 0 transport network 100BASE-TX 100BASE-T2 100BASE-FX  as ttrans goes to infinity link 100BASE-T4 100BASE-SX 100BASE-BX  better performance than ALOHA: and simple, physical cheap, decentralized! copper (twister fiber physical layer

5: DataLink Layer 5-57 pair) physical layer 5: DataLink Layer 5-58

Manchester encoding Link Layer

 5.1 Introduction and  5.6 Link-layer switches services  5.7 PPP  5.2 Error detection  5.8 Link Virtualization: and correction ATM, MPLS  5. 3 Multiple access protocols  used in 10BaseT  5.4 Link-layer  each bit has a transition Addressing  allows clocks in sending and receiving nodes to  5.5 Ethernet synchronize to each other  no need for a centralized, global clock among nodes!  Hey, this is physical-layer stuff! 5: DataLink Layer 5-59 5: DataLink Layer 5-60

J. Kuhl 15 55:054, fall, 2008

Hubs Switch … physical-layer (“dumb”) repeaters:   bits coming in one link go out all other links at link-layer device: smarter than hubs, take same rate active role  all nodes connected to hub can collide with one  store, forward Ethernet frames another  examine incoming frame’s MAC address,  no frame buffering selectively forward frame to one-or-more outgoing llkinks wh en frame is to be forwarded on  no CSMA/CD at hub: host NICs detect collisions segment, uses CSMA/CD to access segment  transparent twisted pair  hosts are unaware of presence of switches

hub  plug-and-play, self-learning  switches do not need to be configured

5: DataLink Layer 5-61 5: DataLink Layer 5-62

Switch: allows multiple simultaneous Switch Table transmissions A A  Q: how does switch know that  hosts have dedicated, C’ B A’ reachable via interface 4, C’ B direct connection to switch B’ reachable via interface 5?  switches buffer packets 1 2 1 2 3  A: each switch has a switch 3  Ethernet protocol used on 6 6 each incoming link, but no 5 4 table, each entry: 5 4 collisions; full duplex  (MAC address of host, interface C to reach host, time stamp) C  each link is its own collision domain  looks like a routing table! B’ A’ B’ A’  switching: A-to-A’ and B-  Q: how are entries created, to-B’ simultaneously, switch with six interfaces maintained in switch table? switch with six interfaces without collisions (1,2,3,4,5,6) (1,2,3,4,5,6)  something like a routing  not possible with dumb hub protocol?

5: DataLink Layer 5-63 5: DataLink Layer 5-64

J. Kuhl 16 55:054, fall, 2008

Source: A Switch: frame filtering/forwarding Switch: self-learning Dest: A’ A A A’ When frame received:  switch learns which hosts can be reached through C’ B 1. record link associated with sending host which interfaces 2. index switch table using MAC dest address 1 2  when frame received, 6 3 switch “learns” location of 3. if entry found for destination 4 sender: incom ing LAN 5 then { segment C if dest on segment from which frame arrived  records sender/location then drop the frame pair in switch table B’ A’ else forward the frame on interface indicated MAC addr interface TTL } A 1 60 Switch table else flood (initially empty) forward on all but the interface on which the frame arrived

5: DataLink Layer 5-65 5: DataLink Layer 5-66

Source: A Interconnecting switches Self-learning, Dest: A’

forwarding: A A’ A  switches can be connected together example C’ B S4

 frame destination S1 1 2 S3 unknown: flood A6 A’ 3 A S2 F 4 I  5 B C D dtitidestination A H E G location known: C selective send A’ A B’ A’  Q: sending from A to F - how does S1 know to MAC addr interface TTL forward frame destined to F via S4 and S3? A 1 60 Switch table  A: self learning! (works exactly the same as in (initially empty) A’ 4 60 single-switch case!)

5: DataLink Layer 5-67 5: DataLink Layer 5-68

J. Kuhl 17 55:054, fall, 2008

Self-learning multi-switch example Institutional network Suppose C sends frame to I, I responds to C

mail server 1 S4 to external network S1 2 web server S3 router A S2 F I B C D H E G IP subnet

 Q: show switch tables and packet forwarding in S1, S2, S3, S4

5: DataLink Layer 5-69 5: DataLink Layer 5-70

Switches vs. Routers Summary comparison  both store-and-forward devices  routers: network layer devices (examine network layer headers) hubs routers switches  switches are link layer devices  routers maintain routing tables, implement routing traffic no yes yes alggmorithms isolation  switches maintain switch tables, implement plug & play yes no yes filtering, learning algorithms optimal no yes no routing cut yes no yes through

5: DataLink Layer 5-71 5: DataLink Layer 5-72

J. Kuhl 18 55:054, fall, 2008

Link Layer Point to Point Data Link Control

 one sender, one receiver, one link: easier than  5.1 Introduction and  5.6 Hubs and switches broadcast link: services  5.7 PPP  no Media Access Control  5.2 Error detection  5.8 Link Virtualization:  no need for explicit MAC addressing and correction ATM  5. 3Multiple access  e.g ., dialup link, ISDN line protocols  popular point-to-point DLC protocols:  5.4 Link-Layer  PPP (point-to-point protocol) Addressing  HDLC: High level data link control (Data link  5.5 Ethernet used to be considered “high layer” in protocol stack!

5: DataLink Layer 5-73 5: DataLink Layer 5-74

PPP Design Requirements [RFC 1557] PPP non-requirements

 packet framing: encapsulation of network-layer  datagram in data link frame no error correction/recovery  no flow control  carry network layer data of any network layer protocol (not just IP) at same time  out of order delivery OK  ability to demultiplex upwards  no need to support multipoint links (e.g., polling)  bit transparency: must carry any bit pattern in the data field  error detection (no correction) Error recovery, flow control, data re-ordering  connection liveness: detect, signal link failure to all relegated to higher layers! network layer  network layer address negotiation: endpoint can learn/configure each other’s network address

5: DataLink Layer 5-75 5: DataLink Layer 5-76

J. Kuhl 19 55:054, fall, 2008

PPP Data Frame PPP Data Frame

 Flag: delimiter (framing)  info: upper layer data being carried  Address: does nothing (only one option)  check: cyclic redundancy check for error  Control: does nothing; in the future possible detection multiple control fields  PtProtocol : upper layer prot ocol to whi ch frame delivered (eg, PPP-LCP, IP, IPCP, etc)

5: DataLink Layer 5-77 5: DataLink Layer 5-78

Byte Stuffing Byte Stuffing  “data transparency” requirement: data field must be allowed to include flag pattern <01111110> flag byte  Q: is received <01111110> data or flag? pattern in data to send

 Sender: adds (“stuffs”) extra < 01111110> byte after each < 01111110> data byte  Receiver:  two 01111110 bytes in a row: discard first byte, continue data reception flag byte pattern plus  single 01111110: flag byte stuffed byte in transmitted data

5: DataLink Layer 5-79 5: DataLink Layer 5-80

J. Kuhl 20 55:054, fall, 2008

PPP Data Control Protocol Link Layer

Before exchanging network- layer data, data link peers  5.1 Introduction and  5.6 Hubs and switches must services  5.7 PPP  configure PPP link (max.  5.2 Error detection  5.8 Link Virtualization: frame length, and correction ATM and MPLS authentication)  5. 3Multiple access  learn/configure network protocols layer information  5.4 Link-Layer Addressing  for IP: carry IP Control Protocol (IPCP) msgs  5.5 Ethernet (protocol field: 8021) to configure/learn IP address 5: DataLink Layer 5-81 5: DataLink Layer 5-82

Virtualization of networks The Internet: virtualizing networks

1974: multiple unconnected … differing in: Virtualization of resources: powerful abstraction in nets  addressing conventions systems engineering:  ARPAnet  packet formats  computing examples: virtual memory, virtual  data-over-cable networks  error recovery devices  packet satellite network (Aloha)  routing  Virtual machines: e.g ., java  packet radio network  IBM VM os from 1960’s/70’s  layering of abstractions: don’t sweat the details of the lower layer, only deal with lower layers abstractly

ARPAnet satellite net "A Protocol for Packet Network Intercommunication", V. Cerf, R. Kahn, IEEE Transactions on Communications, 5: DataLink Layer 5-83 5: DataLink Layer 5-84 May, 1974, pp. 637-648.

J. Kuhl 21 55:054, fall, 2008

The Internet: virtualizing networks Cerf & Kahn’s Internetwork Architecture Internetwork layer (IP): Gateway:  addressing: internetwork  “embed internetwork packets in What is virtualized? appears as single, uniform local packet format or extract entity, despite underlying local them”  two layers of addressing: internetwork and local network heterogeneity  route (at internetwork level) to network  network of networks next gateway  new layer (IP) makes everything homogeneous at internetwork layer  underlying local network technology  cable gateway  satellite  56K telephone modem  today: ATM, MPLS

ARPAnet satellite net … “invisible” at internetwork layer. Looks like a link layer technology to IP! 5: DataLink Layer 5-85 5: DataLink Layer 5-86

ATM and MPLS Asynchronous Transfer Mode: ATM

 1990’s/00 standard for high-speed (155Mbps to  ATM, MPLS separate networks in their own 622 Mbps and higher) Broadband Integrated right Service Digital Network architecture  different service models, addressing, routing  Goal: integrated, end-end transport of carry voice, from Internet video, data  viewed by Internet as logical link connecting  meeting timing/QoS requirements of voice, video IP routers (versus Internet best-effort model)  “next generation” telephony: technical roots in  just like dialup link is really part of separate telephone world network (telephone network)  packet-switching (fixed length packets, called  ATM, MPLS: of technical interest in their “cells”) using virtual circuits own right

5: DataLink Layer 5-87 5: DataLink Layer 5-88

J. Kuhl 22 55:054, fall, 2008

ATM architecture ATM: network or link layer? Vision: end-to-end AAL AAL transport: “ATM from IP ATM ATM ATM ATM desktop to desktop” network  ATM is a network ATM physical physical physical physical technology network

end system swihitch switc h end system Reality: used to connect IP backbone routers  adaptation layer: only at edge of ATM network  “IP over ATM”  data segmentation/reassembly  ATM as switched  roughly analagous to Internet transport layer link layer,  ATM layer: “network” layer connecting IP  cell switching, routing routers  physical layer 5: DataLink Layer 5-89 5: DataLink Layer 5-90

ATM Adaptation Layer (AAL) ATM Adaptation Layer (AAL) [more]

Different versions of AAL layers, depending on ATM  ATM Adaptation Layer (AAL): “adapts” upper service class: layers (IP or native ATM applications) to ATM  AAL1: for CBR (Constant Bit Rate) services, e.g. circuit emulation layer below  AAL2: for VBR (Variable Bit Rate) services, e.g., MPEG video  AAL present only in end systems, not in switches  AAL5: for data (eg, IP datagrams)  AAL layer segment (header/trailer fields, data) fragmented across multiple ATM cells User data  analogy: TCP segment in many IP packets

AAL PDU AAL AAL

ATM ATM ATM ATM ATM cell physical physical physical physical end system switch switch end system 5: DataLink Layer 5-91 5: DataLink Layer 5-92

J. Kuhl 23 55:054, fall, 2008

ATM Layer ATM Layer: Virtual Circuits Service: transport cells across ATM network   analogous to IP network layer VC transport: cells carried on VC from source to dest  call setup, teardown for each call before data can flow  very different services than IP network layer  each packet carries VC identifier (not destination ID) Guarantees ? Network Service Congestion  every switch on source-dest path maintain “state” for each Architecture Model Bandwidth Loss Order Timing feedback passing connection  link,,(,ff)myswitch resources (bandwidth, buffers) may be allocated to Internet best effort none no no no no (inferred VC: to get circuit-like perf. via loss)  Permanent VCs (PVCs) ATM CBR constant yes yes yes no rate congestion  long lasting connections ATM VBR guaranteed yes yes yes no  typically: “permanent” route between to IP routers rate congestion ATM ABR guaranteed no yes no yes  Switched VCs (SVC): minimum  dynamically set up on per-call basis ATM UBR none no yes no no

5: DataLink Layer 5-93 5: DataLink Layer 5-94

ATM VCs ATM Layer: ATM cell

 5-byte ATM cell header  Advantages of ATM VC approach:  48-byte payload  QoS performance guarantee for connection mapped to VC (bandwidth, delay, delay jitter)  Why?: small payload -> short cell-creation delay for digitized voice  Drawbacks of ATM VC approach:  halfwayy(p) between 32 and 64 (compromise!)  Inefficient support of datagram traffic  one PVC between each source/dest pair) does not scale (N*2 connections needed) Cell header  SVC introduces call setup latency, processing overhead for short lived connections Cell format

5: DataLink Layer 5-95 5: DataLink Layer 5-96

J. Kuhl 24 55:054, fall, 2008

ATM cell header ATM Physical Layer (more)

 VCI: virtual channel ID Two pieces (sublayers) of physical layer:  will change from link to link thru net  Transmission Convergence Sublayer (TCS): adapts  PT: Payload type (e.g. RM cell versus data cell) ATM layer above to PMD sublayer below  CLP: Cell Loss Priority bit  Physical Medium Dependent: depends on physical  CLP = 1 impli es low pri orit y cell , can be medium being used discarded if congestion  HEC: Header Error Checksum TCS Functions:  cyclic redundancy check  Header checksum generation: 8 bits CRC  Cell delineation  With “unstructured” PMD sublayer, transmission of idle cells when no data cells to send

5: DataLink Layer 5-97 5: DataLink Layer 5-98

IP-Over-ATM ATM Physical Layer IP over ATM Classic IP only  replace “network” Physical Medium Dependent (PMD) sublayer  3 “networks” (e.g., (e.g., LAN segment) LAN segments) with ATM network  SONET/SDH: transmission frame structure (like a   ATM addresses, IP container carrying bits); MAC (802.3) and IP addresses addresses  bit synchronization; ATM  bandwidth partitions (TDM); network  several speeds: OC3 = 155.52 Mbps; OC12 = 622.08 Mbps; OC48 = 2.45 Gbps, OC192 = 9.6 Gbps  TI/T3: transmission frame structure (old telephone hierarchy): 1.5 Mbps/ 45 Mbps  unstructured: just cells (busy/idle) Ethernet Ethernet LANs LANs 5: DataLink Layer 5-99 5: DataLink Layer 5-100

J. Kuhl 25 55:054, fall, 2008

IP-Over-ATM Datagram Journey in IP-over-ATM Network app  app transport at Source Host:  IP layer maps between IP, ATM dest address (using ARP) transport IP IP IP AAL AAL  passes datagram to AAL5 Eth Eth ATM ATM  AAL5 encapsulates data, segments cells, passes to ATM layer phy phy phy phy ATM  ATM network: moves cell along VC to destination ppyhy ATM  at Destination Host: phy  AAL5 reassembles cells into original datagram  if CRC OK, datagram is passed to IP

5: DataLink Layer 5-101 5: DataLink Layer 5-102

IP-Over-ATM Multiprotocol label switching (MPLS)

 initial goal: speed up IP forwarding by using fixed Issues: ATM length label (instead of IP address) to do  IP datagrams into network forwarding ATM AAL5 PDUs  borrowing ideas from (VC) approach  from IP addresses  but IP dataggmram still keep s IP address! to ATM addresses  just like IP PPP or Ethernet addresses to MPLS header IP header remainder of link-layer frame header 802.3 MAC Ethernet LANs addresses!

label Exp S TTL

20 3 1 5 5: DataLink Layer 5-103 5: DataLink Layer 5-104

J. Kuhl 26 55:054, fall, 2008

MPLS capable routers MPLS forwarding tables

in out out  a.k.a. label-switched router label label dest interface  forwards packets to outgoing interface based 10 A 0 in out out only on label value (don’t inspect IP address) 12 D 0 label label dest interface 8 A 1 10 6 A 1  MPLS forwarding table distinct from IP forwarding 12 9 D 0 tables R6  signaling protocol needed to set up forwarding 0 0 D  RSVP-TE 1 1 R4 R3  forwarding possible along paths that IP alone would R5 not allow (e.g., source-specific routing) !! 0 0 A  use MPLS for traffic engineering R2 in outR1 out label label dest interface in out out  must co-exist with IP-only routers label label dest interface 6 - A 0 8 6 A 0 5: DataLink Layer 5-105 5: DataLink Layer 5-106

Chapter 5: Summary Chapter 5: let’s take a breath

 principles behind data link layer services:  journey down protocol stack complete  error detection, correction (except PHY)  sharing a broadcast channel: multiple access   link layer addressing solid understanding of networking principles,  instantiation and implementation of various link practice layer tthliechnologies  ….. could stop here …. bbtut ltlots of in teres ting  Ethernet topics!  switched LANS  wireless  PPP  multimedia  virtualized networks as a link layer: ATM, MPLS  security  network management

5: DataLink Layer 5-107 5: DataLink Layer 5-108

J. Kuhl 27