Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 11: Link Layer Slides derived from those available on the site of the book “Computer Networking”, by Kurose and Ross, PEARSON.

Similar presentations


Presentation on theme: "Lecture 11: Link Layer Slides derived from those available on the site of the book “Computer Networking”, by Kurose and Ross, PEARSON."— Presentation transcript:

1 Lecture 11: Link Layer Slides derived from those available on the site of the book “Computer Networking”, by Kurose and Ross, PEARSON

2 A Layered Architecture
application: network application protocol (messages) transport: process to process data transfer (segments) network: host to host data transfer (datagrams) link: across individual links data transfer (frames) physical: over the “wire” data transfer (bits) application transport network link physical

3 Terminology nodes: hosts, switches, routers
global ISP nodes: hosts, switches, routers link: communication channel that connects adjacent nodes wired links wireless links frame: link-layer “packet”

4 Link-layer Overview global ISP Data transfer from one node to a physically adjacent node Different protocols over different links e.g., Ethernet, WiFi, frame relay Different services for each protocol e.g., over-the-link reliable data delivery

5 Transportation Analogy
Trip from Princeton to Lausanne taxi: Princeton to JFK plane: JFK to Geneva train: Geneva to Lausanne Tourist = datagram Transport segment = link Transportation mode = link layer protocol Travel agent = routing algorithm

6 Hardware & Software Implementation
Hardware: network adaptor (NIC) encapsulation, decapsulation link access, error detection Software: CPU addressing NIC interaction application transport network link physical cpu memory host bus (e.g., PCI) controller physical transmission network adapter

7 Outline Link-layer services Link-layer forwarding++
A to Z: retrieving a web page

8 Outline Link-layer services Link-layer forwarding++
A to Z: retrieving a web page

9 Link Layer Services Error detection Reliable data delivery Link access
detect bit errors caused by signal attenuation, noise drop frames with bit errors Reliable data delivery error detection + correction/retransmission used for links with high-error rate (wireless) Link access how to share the same link with other nodes Flow control pacing between adjacent sending and receiving nodes

10 Error Detection & Correction
otherwise EDC= Error Detection and Correction bits (redundancy) D = Data protected by error checking, may include header fields Error detection not 100% reliable! protocol may miss some errors, but rarely larger EDC field yields better detection and correction

11 Error Detection & Correction (2)
Single bit parity detect single bit errors Two-dimensional bit parity detect and correct single bit errors Cyclic Redundancy Check (CRC) more powerful error-detection than parity checking widely used in practice: Ethernet, WiFi

12 (shared air, acoustical)
Media Access Control (MAC) Point-to-point links state-of-the-art Ethernet Broadcast links (shared medium) old-fashioned Ethernet, WiFi shared wire (e.g., cabled Ethernet) shared RF (e.g., WiFi) shared RF (satellite) humans at a cocktail party (shared air, acoustical)

13 MAC Protocols Given The problem An ideal multiple access protocol
single shared broadcast link of rate R The problem interference = two or more simultaneous transmissions collision = node receives two or more signals at the same time An ideal multiple access protocol when only one node wants to transmit, it can send at rate R when N nodes want to transmit, each can send at average rate R/N simple, fully decentralized

14 MAC Protocols Classification
Channel partitioning channel divided into smaller “pieces” (time slots, frequency bands) allocate one piece to each node for exclusive use Random access channel not divided, allow collisions detect and recover from collisions Taking turns nodes take turns

15 Efficient at high load. Inefficient at low load.
Channel Partitioning TDMA: time divided in equal frames and slots 1 3 4 6-slot frame FDMA: frequency spectrum divided into frequency bands frequency bands time FDM cable Efficient at high load. Inefficient at low load.

16 Efficient at low load. Inefficient at high load.
Random Access 1 2 3 node 1 node 2 node 3 C S E if single node - transmit at full rate R bps if N nodes - transmit at well bellow ideal R/N bps each (collisions, empty slots) Efficient at low load. Inefficient at high load.

17 CSMA - Carrier Sense Multiple Access
Sense the channel before transmitting if channel sensed idle, transmit if channel sensed busy, defer transmission

18 spatial layout of nodes
CSMA Collisions spatial layout of nodes Collisions can still occur due to propagation delay Collision probability depends on propagation delay

19 CSMA/CD - Collision Detection
Sense the channel before transmitting if channel sensed idle, transmit if channel sensed busy, defer transmission If a collision is detected abort transmission defer transmission

20 spatial layout of nodes
CSMA/CD - Collision Detection spatial layout of nodes

21 CSMA/CD Algorithm 1. NIC receives datagram from network layer, creates frame 2. If NIC senses channel idle, starts frame transmission. If NIC senses channel busy, waits until channel idle, then transmits. 3. If NIC transmits entire frame without detecting another transmission, NIC is done with frame! 4. If NIC detects another transmission while transmitting, aborts and sends jam signal 5. After aborting, NIC enters exponential backoff: more collisions -> longer wait interval

22 Taking Turns (1) Polling: master “invites” slave to transmit
Main concerns polling overhead single point of failure (master) data poll master data slaves

23 Taking Turns (2) Token passing: control token passed from one node to the next sequentially Main concerns token overhead single point of failure (token) T (nothing to send) T data

24 MAC Protocols Channel partitioning Random access Taking turns
efficient at high load inefficient at low load Random access efficient at low load inefficient at high load (due to collisions) Taking turns look for best of both worlds single point of failure

25 Outline Link-layer services Link-layer forwarding++
A to Z: retrieving a web page

26 MAC Addresses Used to move frames between link-layer nodes
one address per NIC Format: 48 bit address, flat usually shown in hexadecimal format 1A-2F-BB AD 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 71-65-F7-2B-08-53 LAN

27 Address Resolution Protocol (ARP)
Question: - How to determine interface’s MAC address, knowing its IP address? 1A-2F-BB AD 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 71-65-F7-2B-08-53 LAN Answer: - Source broadcasts request for destination’s MAC address - Stores response in local ARP table < IP address; MAC address; TTL>

28 Ethernet The dominant wired LAN technology
First widely used LAN technology Simpler, cheaper than token LANs and ATM Kept up with speed race: 10 Mbps – 100 Gbps

29 Ethernet Services Connectionless Unreliable MAC protocol
no handshaking between sending and receiving NICs Unreliable receiving NIC does not send ACKs or NACKs to sending NIC recover dropped frames only if sender uses higher layer “rdt” (TCP) MAC protocol CSMA/CD with exponential backoff

30 Ethernet Frame Structure
Sending adapter encapsulates datagram in Ethernet frame preamble: 7 x followed by 1 x synchronize sender, receiver clock rates addresses: 48 bit source, source/destination MAC address receive frame only if destination matches or broadcast type: indicates higher layer protocol mostly IP, others possible CRC: cyclic redundancy check at receiver dest. address source data (payload) CRC preamble type

31 Ethernet Physical Topology
bus: popular in the mid 90s all nodes in same collision domain (frames can collide) star: prevails today active switch in the middle - each “spoke” in a separate collision domain (no collisions) switch bus star

32 Link-layer Switch Forwards frames within LAN Self-learning
determines output port based on destination MAC address similar to router forwarding process Self-learning forwarding table populated automatically no need for manual configuration or routing protocol

33 switch forwarding table
Self-learning Source: A Dest: A’ A A’ B B’ C C’ 1 2 3 4 5 6 A A’ - frame destination A’, location unknown: flood - frame destination A, location known: selectively send on just one link A A’ A A’ A A’ A A’ A A’ A’ A MAC addr interface TTL A 1 60 switch forwarding table (initially empty) A’ 4 60

34 Self-learning (2) When a frame is received at the switch:
1. Record pair (source MAC address; incoming link) 2. Index forwarding table using destination MAC address 3. If entry found: - if destination on link from which frame arrived drop frame - else forward frame on link indicated by entry (else) If entry not found: - flood: forward on all links except the arriving interface

35 Self-learning: Interconnected Switches
B S1 C Scenario: A wants to send frame to H - Question: how does S1 know to forward via S4 and S3? - Answer: self learning, exactly the same way

36 Switches vs. Routers Both are store-and-forward
application transport network link physical Both are store-and-forward routers: network-layer devices (examine network-layer headers) switches: link-layer devices (examine link-layer headers) Both have forwarding tables routers: using routing switches: using self-learning datagram frame link physical frame switch network link physical datagram frame application transport network link physical

37 Forwarding to Another LAN
Scenario: - A sends a datagram to B via router R - A knows IP address of B (how?) - A knows IP address of R (how?) - A knows MAC address of R (how?) R 1A-23-F9-CD-06-9B E6-E BB-4B CC-49-DE-D0-AB-7D C-E8-FF-55 A 49-BD-D2-C7-56-2A 88-B2-2F-54-1A-0F B

38 Forwarding to Another LAN
- create IP datagram with source IP-A, destination IP-B - create link-layer frame with source MAC-A, destination MAC-R, frame contains A-to-B IP datagram MAC src: C-E8-FF-55 MAC dest: E6-E BB-4B IP Eth Phy IP src: IP dest: R 1A-23-F9-CD-06-9B E6-E BB-4B CC-49-DE-D0-AB-7D C-E8-FF-55 A 49-BD-D2-C7-56-2A 88-B2-2F-54-1A-0F B

39 Forwarding to Another LAN
- send frame from A to R - receive frame at R, extract datagram, pass it up to IP layer MAC src: C-E8-FF-55 MAC dest: E6-E BB-4B IP src: IP dest: IP src: IP dest: IP Eth Phy IP Eth Phy R 1A-23-F9-CD-06-9B E6-E BB-4B CC-49-DE-D0-AB-7D C-E8-FF-55 A 49-BD-D2-C7-56-2A 88-B2-2F-54-1A-0F B

40 Forwarding to Another LAN
- forward datagram with source IP-A, destination IP-B - create link-layer frame with source MAC-R, destination MAC-B, frame contains A-to-B IP datagram MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP src: IP dest: IP Eth Phy R 1A-23-F9-CD-06-9B E6-E BB-4B CC-49-DE-D0-AB-7D C-E8-FF-55 A 49-BD-D2-C7-56-2A 88-B2-2F-54-1A-0F B

41 Forwarding to Another LAN
- send frame from R to B IP src: IP dest: MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP Eth Phy IP Eth Phy R 1A-23-F9-CD-06-9B E6-E BB-4B CC-49-DE-D0-AB-7D C-E8-FF-55 A 49-BD-D2-C7-56-2A 88-B2-2F-54-1A-0F B

42 Forwarding to Another LAN
- send frame from R to B - receive frame at B, extract datagram, pass it up to IP layer MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP src: IP dest: IP Eth Phy B A R 49-BD-D2-C7-56-2A C-E8-FF-55 1A-23-F9-CD-06-9B E6-E BB-4B CC-49-DE-D0-AB-7D 88-B2-2F-54-1A-0F

43 Outline Link-layer services Link-layer forwarding++
A to Z: retrieving a web page

44 Synthesis - A day in the life of a web request
application transport network link physical scenario: - attach laptop to campus network - request/receive page goal: - review the protocols involved at all layers

45 A day in the life… scenario
browser DNS server Comcast network /13 school network /24 web page web server Google’s network /19

46 … connecting to the Internet (1)
DHCP UDP IP Eth Phy DHCP DHCP Laptop uses DHCP to get: - IP address, subnet mask - IP address of first-hop router - IP address of DNS server router (runs DHCP) DHCP DHCP discovery message - encapsulated in UDP - encapsulated in IP - encapsulated in Ethernet DHCP DHCP UDP IP Eth Phy DHCP Ethernet frame broadcast on LAN - destination MAC: 0xffffffffffff - received by DHCP server (running on the router)

47 … connecting to the Internet (2)
DHCP DHCP UDP IP Eth Phy router (runs DHCP) - DHCP server and laptop exchange -offer -request -acknowledgement DHCP UDP IP Eth Phy DHCP DHCP DHCP Laptop has IP address, knows IP address of the first-hop router and a DNS server

48 Laptop knows MAC address of the first-hop router
… L2 learning DNS UDP IP Eth Phy DNS - Laptop uses DNS to get the IP address for router (runs DHCP) ARP ARP query - DNS query -encapsulated in UDP -encapsulated in IP -encapsulated in.. ooops! - Laptop needs to get the MAC address of the first-hop router Eth Phy ARP ARP reply - ARP request broadcasted on LAN, received at first-hop router - Router sends ARP response back Laptop knows MAC address of the first-hop router

49 Laptop knows IP address of www.google.com
… L3 learning DNS UDP IP Eth Phy DNS DNS server DNS UDP IP Eth Phy DNS router (runs DHCP) DNS DNS DNS DNS Comcast network /13 - DNS query (IP datagram) forwarded to first-hop router via switch - DNS query (IP datagram) forwarded to Comcast network, DNS server - DNS server sends DNS response back to laptop Laptop knows IP address of

50 TCP connection established
… TCP connection setup HTTP HTTP TCP IP Eth Phy router (runs DHCP) SYN SYNACK SYN - Web browser process opens TCP socket TCP IP Eth Phy - Sends SYN segment SYN SYNACK - Web server responds with SYNACK segment SYNACK web server TCP connection established

51 Web page is finally displayed!
… HTTP request/reply HTTP HTTP HTTP TCP IP Eth Phy router (runs DHCP) HTTP HTTP - Web browser sends HTTP request to web server HTTP TCP IP Eth Phy HTTP - Web server sends HTTP reply to web client (the web page) HTTP web server Web page is finally displayed!


Download ppt "Lecture 11: Link Layer Slides derived from those available on the site of the book “Computer Networking”, by Kurose and Ross, PEARSON."

Similar presentations


Ads by Google