26
Dr. Nail Akar, EE536 Lectures 1 Data Link (or Link) Layer Our goals: r understand principles behind data link layer services: m error detection, correction m sharing a broadcast channel: multiple access m link layer addressing m reliable data transfer, flow control: m instantiation and implementation of various link layer technologies Overview: r link layer services r error detection, correction r multiple access protocols and LANs r link layer addressing, ARP r specific link layer technologies: m Ethernet m hubs, bridges, switches m IEEE 802.11 LANs m PPP m ATM

Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures1

Data Link (or Link) Layer

Our goals: r understand principles

behind data link layer services:m error detection, correctionm sharing a broadcast

channel: multiple accessm link layer addressingm reliable data transfer,

flow control: m instantiation and

implementation of various link layer technologies

Overview:r link layer services

r error detection, correction

r multiple access protocols and LANs

r link layer addressing, ARP

r specific link layer technologies:m Ethernet

m hubs, bridges, switches

m IEEE 802.11 LANs

m PPP

m ATM

Page 2: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures2

Link Layer

Analogy: transportation networks

Page 3: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures3

Link Layer

r two physically connected devices:m host-router, router-router, host-host

r unit of data: frame

applicationtransportnetwork

linkphysical

networklink

physical

MMMM

Ht

HtHnHtHnHl MHtHnHl

framephys. link

data linkprotocol

adapter card

Page 4: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures4

Link Layer Services

r Framing, link access:m encapsulate datagram into frame, adding header, trailerm implement channel access if shared medium, m ‘physical addresses’ used in frame headers to identify

source, dest • different from IP address!

r Reliable delivery between two physically connected devices:m seldom used on low bit error link (fiber, some twisted

pair)m wireless links: high error rates

• Q: why both link-level and end-end reliability?

Page 5: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures5

Link Layer Services

r Flow Control:

m pacing between sender and receivers

r Error Detection:

m errors caused by signal attenuation, noise.

m receiver detects presence of errors: • signals sender for retransmission or drops frame

r Error Correction:

m receiver identifies and corrects bit error(s) without resorting to retransmission

Page 6: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures6

Link Layer: Implementation

r implemented in “adapter” m e.g., Ethernet card

m typically includes: RAM, DSP chips, host bus interface, and link interface

applicationtransportnetwork

linkphysical

networklink

physical

MMMM

Ht

HtHn

HtHnHl MHtHnHl

framephys. link

data linkprotocol

adapter card

Page 7: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures7

Error DetectionEDC= 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

Page 8: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures8

Multiple Access Links and Protocols

Three types of “links”:r point-to-point (single wire, e.g. PPP, SLIP)

r broadcast (shared wire or medium; e.g, Ethernet, Wavelan, etc.)

r switched (e.g., switched Ethernet, ATM etc)

Page 9: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures9

Multiple Access (MAC) Protocols

r single shared communication channel

r two or more simultaneous transmissions by nodes: interference m only one node can send successfully at a time

r multiple access protocol:m distributed algorithm that determines how stations share channel, i.e.,

determine when station can transmit

m communication about channel sharing must use channel itself!

m what to look for in multiple access protocols:

• synchronous or asynchronous

• information needed about other stations

• robustness (e.g., to channel errors)

• performance

Page 10: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures10

MAC Protocols

Three broad classes:

r Channel Partitioningm divide channel into smaller “pieces” (time slots,

frequency)

m allocate piece to node for exclusive use

r Random Access

m allow collisions

m “recover” from collisions

r “Taking turns”m tightly coordinate shared access to avoid collisions

Page 11: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures11

CSMA: Carrier Sense Multiple Access

CSMA: listen before transmit:

r If channel sensed idle: transmit entire pkt

r If channel sensed busy, defer transmission

m Persistent CSMA: retry immediately with probability p when channel becomes idle (may cause instability)

m Non-persistent CSMA: retry after random interval

r Human analogy: don’t interrupt others!

Page 12: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures12

“Taking Turns” MAC protocols

Channel partitioning MAC protocols:

m share channel efficiently at high load

m inefficient at low load: delay in channel access, 1/N bandwidth allocated even if only 1 active node!

Random access MAC protocols

m efficient at low load: single node can fully utilize channel

m high load: collision overhead

“Taking turns” protocols

look for best of both worlds!

Page 13: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures13

“Taking Turns” MAC protocols

Polling:

r master node “invites” slave nodes to transmit in turn

r Request to Send, Clear to Send msgs

r concerns:m polling overhead

m latency

m single point of failure (master)

Token passing:

r control token passed from one node to next sequentially.

r token message

r concerns:m token overhead

m latency

m single point of failure (token)

Page 14: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures14

Reservation-based protocolsDistributed Polling:

r time divided into slots

r begins with N short reservation slots m reservation slot time equal to channel end-end

propagation delay

m station with message to send posts reservation

m reservation seen by all stations

r after reservation slots, message transmissions ordered by

known priority

Page 15: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures15

LANs

r Multiple systems attached to a shared medium

r High total bandwidth

r Low delay

r Low error rate

r Broadcast capability

r Limited geography (several kilometers)

r Limited number of stations (hundreds)

r Peer relationship among attached stations as opposed to a group of slaves with a master

r Being confined to private property and not subject to PTT regulation

Page 16: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures16

LAN technologies

Data link layer so far:m services, error detection/correction, multiple access

Next: LAN technologiesm IEEE 802 LANs (Ethernet)

m hubs, bridges, switches

m 802.11

m PPP

m ATM

Page 17: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures17

IEEE 802 LANs

r IEEE has a committee known as 802 whose purpose is to standardize LANs; LAN protocols cover the bottom two layers of the OSI reference model.

r The committee has chosen to subdivide the data link layer into two sublayersm MAC (Medium Access Control): channel management algorithms

• Token passing (802.5 and 802.4)• Binary backoff after collision (802.3)• Priorities (802.5 and 802.4)• Framing and error detection

m LLC (Logical Link Control): defines the fields that allow multiple higher-layer protocols to share the use of the data link

• LLC type 1: best effort service• LLC type 2: reliable connection-oriented protocol on top of the basic

datagram

Page 18: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures18

IEEE 802 Committees

r 802.1: deals with issues common across all 802 LANs, including addressing, management, and bridges

r 802.2: Defines LLC.r 802.3: Deals with CSMA/CD LAN which is derived from

Ethernet, which was invented by Xerox, and developed by Digital, Intel and Xerox.m Bob Metcalfe invented Ethernet in 1973 while at Xerox and then

founded 3COM in 1979.

r 802.4: Token bus LANr 802.5: Token Ring LANr Others not related to IEEE

m ATM Forum, LAN emulation, MPOA m FDDI: 100 Mbps token ring, standardized by ANSI

Page 19: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures19

LAN Addresses and ARP

32-bit IP address: r network-layer address

r used to get datagram to destination network (recall IP network definition)

LAN (or MAC or physical) address: r used to get datagram from one interface to another

physically-connected interface (same network)

r 48 bit MAC address (for most LANs) burned in the adapter ROM

r Globally unique

Page 20: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures20

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Page 21: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures21

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r Analogy:

(a) MAC address: like Social Security Number(b) IP address: like postal address

r MAC flat address => portability m can move LAN card from one LAN to another

r IP hierarchical address NOT portablem depends on network to which one attaches

Page 22: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures22

Routing Discussion

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

A

BE

Starting at A, given IP datagramaddressed to B:

r look up net. address of B, find B on same net. as A

r link layer send datagram to B inside

link-layer frame

B’s MACaddr

A’s MACaddr

A’s IPaddr

B’s IPaddr IP payload

datagramframe

frame source,dest address

datagram source,dest address

Page 23: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures23

ARP: Address Resolution Protocol

r Each IP node (Host, Router) on LAN has ARP module, table

r ARP Table: IP/MAC address mappings for some LAN nodes

< IP address; MAC address; TTL>

< ………………………….. >

m TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min)

Question: how to determineMAC address of Bgiven B’s IP address?

Page 24: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures24

ARP protocol

r A knows B's IP address, wants to learn physical address of B

r A broadcasts ARP query pkt, containing B's IP address

m all machines on LAN receive ARP query

r B receives ARP packet, replies to A with its (B's) physical layer address

r A caches (saves) IP-to-physical address pairs until information becomes old (times out)

m soft state: information that times out (goes away) unless refreshed

Page 25: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures25

Routing to another LANwalkthrough: routing from A to B via R

r In routing table at source Host, find router 111.111.111.110

r In ARP table at source, find MAC address E6-E9-00-17-BB-4B, etc

A

RB

Page 26: Data Link (or Link) Layerkilyos.ee.bilkent.edu.tr/~akar/teaching_info/ee536/datalink.pdf · Dr. Nail Akar, EE536 Lectures 6 Link Layer: Implementation rimplemented in “adapter”

Dr. Nail Akar, EE536 Lectures26

r A creates IP packet with source A, destination B

r A uses ARP to get R’s physical layer address for 111.111.111.110

r A creates Ethernet frame with R's physical address as dest, Ethernet frame contains A-to-B IP datagram

r A’s data link layer sends Ethernet frame

r R’s data link layer receives Ethernet frame

r R removes IP datagram from Ethernet frame, sees its destined to B

r R uses ARP to get B’s physical layer address

r R creates frame containing A-to-B IP datagram sends to B

A

RB