5: DataLink Layer5-1 Link Layer 5.1 Introduction and services 5.2 Error detection and correction ...

73
5: DataLink Layer 5-1 Link Layer 5.1 Introduction and services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-layer Addressing 5.5 Ethernet 5.6 Link-layer switches 5.9 A day in the life of a web request

Transcript of 5: DataLink Layer5-1 Link Layer 5.1 Introduction and services 5.2 Error detection and correction ...

Page 1: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-1

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-2

Link Layer IntroductionSome terminology hosts and routers are nodes communication channels

that connect adjacent nodes along communication path are linkso wired links wireless linkso Point-to-point links multi-

access (or broadcast) links layer-2 packet is a frame

encapsulates datagram

data-link layer has responsibility of transferring datagram from one node to adjacent node over a link

5 DataLink Layer 5-3

Link layer context

datagram transferred by different link protocols over different linkso eg Ethernet on first link frame relay on

intermediate links 80211 on last link

each link protocol provides different serviceso eg may or may not provide rdt over link

Introduction 1-4

source

application

transportnetwork

linkphysical

HtHn M

segment Ht

datagram

destination

application

transportnetwork

linkphysical

HtHnHl M

HtHn M

Ht M

M

networklink

physical

linkphysical

HtHnHl M

HtHn M

HtHn M

HtHnHl M

router

switch

Encapsulationmessage M

Ht M

Hn

frame

5 DataLink Layer 5-5

Link Layer Services framing

encapsulate datagram into frame adding header trailer

link access o channel access if shared mediumo ldquoMACrdquo addresses used in frame headers to identify

source dest bull different from IP address

reliable delivery between adjacent nodeso we learned how to do this already (chapter 3)o seldom used on low bit-error link (fiber some twisted

pair)o wireless links high error ratesbull Q why both link-level and end-end reliability

5 DataLink Layer 5-6

Link Layer Services (more)

flow control o pacing between adjacent sending and receiving

nodes

error detection o errors caused by signal attenuation noise o receiver detects presence of errors

bull signals sender for retransmission or drops frame

error correction o receiver identifies and corrects bit error(s) without

resorting to retransmission

5 DataLink Layer 5-7

Where is the link layer implemented

in each and every host link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)o Ethernet card PCMCI card

80211 cardo implements link physical

layer

attaches into hostrsquos system buses

combination of hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

5 DataLink Layer 5-8

Adaptors Communicating

sending sideo encapsulates datagram

in frameo adds error checking bits

rdt flow control etc

receiving sideo looks for errors rdt flow

control etco extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

5 DataLink Layer 5-9

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-10

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

5 DataLink Layer 5-11

Internet checksum (review)

Sender treat segment contents

as sequence of 16-bit integers

checksum addition (1rsquos complement sum) of segment contents

sender puts checksum value into UDP checksum field

Receiver compute checksum of

received segment check if computed

checksum equals checksum field valueo NO - error detectedo YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

5 DataLink Layer 5-12

Checksumming Cyclic Redundancy Check view data bits D as a binary number (actually a

polynomial with binary coefficients) choose r+1 bit pattern (generator) G goal choose r CRC bits R such that

o ltDRgt exactly divisible by G (modulo 2) o receiver knows G divides ltDRgt by G If non-zero

remainder error detectedo can detect all burst errors less than r+1 bits

widely used in practice (Ethernet 80211 WiFi ATM)

Cyclic Redundancy Check Modulo 2 arithmetic

o addition = subtraction = XOR Each bit string represents a polynomial Example 10011011 corresponds to

A polynomial G(x) of degree r is known to both sender and receiver

Sender appends r bits (called CRC code) to the message so that the resulting polynomial can be divided evenly by G(x)

Receiver checks if the received frame (message together with CRC) is still divisible by G(x)

If not there are transmission errors in the frame

7 4 3( ) 1D x x x x x

Common polynomials for G(x)

CRC

CRC-8

CRC-10

CRC-12

CRC-16

CRC-CCITT

CRC-32

C(x)

x8+x2+x1+1

x10+x9+x5+x4+x1+1

x12+x11+x3+x2+x1+1

x16+x15+x2+1

x16+x12+x5+1

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 2: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-2

Link Layer IntroductionSome terminology hosts and routers are nodes communication channels

that connect adjacent nodes along communication path are linkso wired links wireless linkso Point-to-point links multi-

access (or broadcast) links layer-2 packet is a frame

encapsulates datagram

data-link layer has responsibility of transferring datagram from one node to adjacent node over a link

5 DataLink Layer 5-3

Link layer context

datagram transferred by different link protocols over different linkso eg Ethernet on first link frame relay on

intermediate links 80211 on last link

each link protocol provides different serviceso eg may or may not provide rdt over link

Introduction 1-4

source

application

transportnetwork

linkphysical

HtHn M

segment Ht

datagram

destination

application

transportnetwork

linkphysical

HtHnHl M

HtHn M

Ht M

M

networklink

physical

linkphysical

HtHnHl M

HtHn M

HtHn M

HtHnHl M

router

switch

Encapsulationmessage M

Ht M

Hn

frame

5 DataLink Layer 5-5

Link Layer Services framing

encapsulate datagram into frame adding header trailer

link access o channel access if shared mediumo ldquoMACrdquo addresses used in frame headers to identify

source dest bull different from IP address

reliable delivery between adjacent nodeso we learned how to do this already (chapter 3)o seldom used on low bit-error link (fiber some twisted

pair)o wireless links high error ratesbull Q why both link-level and end-end reliability

5 DataLink Layer 5-6

Link Layer Services (more)

flow control o pacing between adjacent sending and receiving

nodes

error detection o errors caused by signal attenuation noise o receiver detects presence of errors

bull signals sender for retransmission or drops frame

error correction o receiver identifies and corrects bit error(s) without

resorting to retransmission

5 DataLink Layer 5-7

Where is the link layer implemented

in each and every host link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)o Ethernet card PCMCI card

80211 cardo implements link physical

layer

attaches into hostrsquos system buses

combination of hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

5 DataLink Layer 5-8

Adaptors Communicating

sending sideo encapsulates datagram

in frameo adds error checking bits

rdt flow control etc

receiving sideo looks for errors rdt flow

control etco extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

5 DataLink Layer 5-9

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-10

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

5 DataLink Layer 5-11

Internet checksum (review)

Sender treat segment contents

as sequence of 16-bit integers

checksum addition (1rsquos complement sum) of segment contents

sender puts checksum value into UDP checksum field

Receiver compute checksum of

received segment check if computed

checksum equals checksum field valueo NO - error detectedo YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

5 DataLink Layer 5-12

Checksumming Cyclic Redundancy Check view data bits D as a binary number (actually a

polynomial with binary coefficients) choose r+1 bit pattern (generator) G goal choose r CRC bits R such that

o ltDRgt exactly divisible by G (modulo 2) o receiver knows G divides ltDRgt by G If non-zero

remainder error detectedo can detect all burst errors less than r+1 bits

widely used in practice (Ethernet 80211 WiFi ATM)

Cyclic Redundancy Check Modulo 2 arithmetic

o addition = subtraction = XOR Each bit string represents a polynomial Example 10011011 corresponds to

A polynomial G(x) of degree r is known to both sender and receiver

Sender appends r bits (called CRC code) to the message so that the resulting polynomial can be divided evenly by G(x)

Receiver checks if the received frame (message together with CRC) is still divisible by G(x)

If not there are transmission errors in the frame

7 4 3( ) 1D x x x x x

Common polynomials for G(x)

CRC

CRC-8

CRC-10

CRC-12

CRC-16

CRC-CCITT

CRC-32

C(x)

x8+x2+x1+1

x10+x9+x5+x4+x1+1

x12+x11+x3+x2+x1+1

x16+x15+x2+1

x16+x12+x5+1

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 3: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-3

Link layer context

datagram transferred by different link protocols over different linkso eg Ethernet on first link frame relay on

intermediate links 80211 on last link

each link protocol provides different serviceso eg may or may not provide rdt over link

Introduction 1-4

source

application

transportnetwork

linkphysical

HtHn M

segment Ht

datagram

destination

application

transportnetwork

linkphysical

HtHnHl M

HtHn M

Ht M

M

networklink

physical

linkphysical

HtHnHl M

HtHn M

HtHn M

HtHnHl M

router

switch

Encapsulationmessage M

Ht M

Hn

frame

5 DataLink Layer 5-5

Link Layer Services framing

encapsulate datagram into frame adding header trailer

link access o channel access if shared mediumo ldquoMACrdquo addresses used in frame headers to identify

source dest bull different from IP address

reliable delivery between adjacent nodeso we learned how to do this already (chapter 3)o seldom used on low bit-error link (fiber some twisted

pair)o wireless links high error ratesbull Q why both link-level and end-end reliability

5 DataLink Layer 5-6

Link Layer Services (more)

flow control o pacing between adjacent sending and receiving

nodes

error detection o errors caused by signal attenuation noise o receiver detects presence of errors

bull signals sender for retransmission or drops frame

error correction o receiver identifies and corrects bit error(s) without

resorting to retransmission

5 DataLink Layer 5-7

Where is the link layer implemented

in each and every host link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)o Ethernet card PCMCI card

80211 cardo implements link physical

layer

attaches into hostrsquos system buses

combination of hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

5 DataLink Layer 5-8

Adaptors Communicating

sending sideo encapsulates datagram

in frameo adds error checking bits

rdt flow control etc

receiving sideo looks for errors rdt flow

control etco extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

5 DataLink Layer 5-9

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-10

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

5 DataLink Layer 5-11

Internet checksum (review)

Sender treat segment contents

as sequence of 16-bit integers

checksum addition (1rsquos complement sum) of segment contents

sender puts checksum value into UDP checksum field

Receiver compute checksum of

received segment check if computed

checksum equals checksum field valueo NO - error detectedo YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

5 DataLink Layer 5-12

Checksumming Cyclic Redundancy Check view data bits D as a binary number (actually a

polynomial with binary coefficients) choose r+1 bit pattern (generator) G goal choose r CRC bits R such that

o ltDRgt exactly divisible by G (modulo 2) o receiver knows G divides ltDRgt by G If non-zero

remainder error detectedo can detect all burst errors less than r+1 bits

widely used in practice (Ethernet 80211 WiFi ATM)

Cyclic Redundancy Check Modulo 2 arithmetic

o addition = subtraction = XOR Each bit string represents a polynomial Example 10011011 corresponds to

A polynomial G(x) of degree r is known to both sender and receiver

Sender appends r bits (called CRC code) to the message so that the resulting polynomial can be divided evenly by G(x)

Receiver checks if the received frame (message together with CRC) is still divisible by G(x)

If not there are transmission errors in the frame

7 4 3( ) 1D x x x x x

Common polynomials for G(x)

CRC

CRC-8

CRC-10

CRC-12

CRC-16

CRC-CCITT

CRC-32

C(x)

x8+x2+x1+1

x10+x9+x5+x4+x1+1

x12+x11+x3+x2+x1+1

x16+x15+x2+1

x16+x12+x5+1

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 4: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

Introduction 1-4

source

application

transportnetwork

linkphysical

HtHn M

segment Ht

datagram

destination

application

transportnetwork

linkphysical

HtHnHl M

HtHn M

Ht M

M

networklink

physical

linkphysical

HtHnHl M

HtHn M

HtHn M

HtHnHl M

router

switch

Encapsulationmessage M

Ht M

Hn

frame

5 DataLink Layer 5-5

Link Layer Services framing

encapsulate datagram into frame adding header trailer

link access o channel access if shared mediumo ldquoMACrdquo addresses used in frame headers to identify

source dest bull different from IP address

reliable delivery between adjacent nodeso we learned how to do this already (chapter 3)o seldom used on low bit-error link (fiber some twisted

pair)o wireless links high error ratesbull Q why both link-level and end-end reliability

5 DataLink Layer 5-6

Link Layer Services (more)

flow control o pacing between adjacent sending and receiving

nodes

error detection o errors caused by signal attenuation noise o receiver detects presence of errors

bull signals sender for retransmission or drops frame

error correction o receiver identifies and corrects bit error(s) without

resorting to retransmission

5 DataLink Layer 5-7

Where is the link layer implemented

in each and every host link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)o Ethernet card PCMCI card

80211 cardo implements link physical

layer

attaches into hostrsquos system buses

combination of hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

5 DataLink Layer 5-8

Adaptors Communicating

sending sideo encapsulates datagram

in frameo adds error checking bits

rdt flow control etc

receiving sideo looks for errors rdt flow

control etco extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

5 DataLink Layer 5-9

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-10

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

5 DataLink Layer 5-11

Internet checksum (review)

Sender treat segment contents

as sequence of 16-bit integers

checksum addition (1rsquos complement sum) of segment contents

sender puts checksum value into UDP checksum field

Receiver compute checksum of

received segment check if computed

checksum equals checksum field valueo NO - error detectedo YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

5 DataLink Layer 5-12

Checksumming Cyclic Redundancy Check view data bits D as a binary number (actually a

polynomial with binary coefficients) choose r+1 bit pattern (generator) G goal choose r CRC bits R such that

o ltDRgt exactly divisible by G (modulo 2) o receiver knows G divides ltDRgt by G If non-zero

remainder error detectedo can detect all burst errors less than r+1 bits

widely used in practice (Ethernet 80211 WiFi ATM)

Cyclic Redundancy Check Modulo 2 arithmetic

o addition = subtraction = XOR Each bit string represents a polynomial Example 10011011 corresponds to

A polynomial G(x) of degree r is known to both sender and receiver

Sender appends r bits (called CRC code) to the message so that the resulting polynomial can be divided evenly by G(x)

Receiver checks if the received frame (message together with CRC) is still divisible by G(x)

If not there are transmission errors in the frame

7 4 3( ) 1D x x x x x

Common polynomials for G(x)

CRC

CRC-8

CRC-10

CRC-12

CRC-16

CRC-CCITT

CRC-32

C(x)

x8+x2+x1+1

x10+x9+x5+x4+x1+1

x12+x11+x3+x2+x1+1

x16+x15+x2+1

x16+x12+x5+1

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 5: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-5

Link Layer Services framing

encapsulate datagram into frame adding header trailer

link access o channel access if shared mediumo ldquoMACrdquo addresses used in frame headers to identify

source dest bull different from IP address

reliable delivery between adjacent nodeso we learned how to do this already (chapter 3)o seldom used on low bit-error link (fiber some twisted

pair)o wireless links high error ratesbull Q why both link-level and end-end reliability

5 DataLink Layer 5-6

Link Layer Services (more)

flow control o pacing between adjacent sending and receiving

nodes

error detection o errors caused by signal attenuation noise o receiver detects presence of errors

bull signals sender for retransmission or drops frame

error correction o receiver identifies and corrects bit error(s) without

resorting to retransmission

5 DataLink Layer 5-7

Where is the link layer implemented

in each and every host link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)o Ethernet card PCMCI card

80211 cardo implements link physical

layer

attaches into hostrsquos system buses

combination of hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

5 DataLink Layer 5-8

Adaptors Communicating

sending sideo encapsulates datagram

in frameo adds error checking bits

rdt flow control etc

receiving sideo looks for errors rdt flow

control etco extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

5 DataLink Layer 5-9

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-10

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

5 DataLink Layer 5-11

Internet checksum (review)

Sender treat segment contents

as sequence of 16-bit integers

checksum addition (1rsquos complement sum) of segment contents

sender puts checksum value into UDP checksum field

Receiver compute checksum of

received segment check if computed

checksum equals checksum field valueo NO - error detectedo YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

5 DataLink Layer 5-12

Checksumming Cyclic Redundancy Check view data bits D as a binary number (actually a

polynomial with binary coefficients) choose r+1 bit pattern (generator) G goal choose r CRC bits R such that

o ltDRgt exactly divisible by G (modulo 2) o receiver knows G divides ltDRgt by G If non-zero

remainder error detectedo can detect all burst errors less than r+1 bits

widely used in practice (Ethernet 80211 WiFi ATM)

Cyclic Redundancy Check Modulo 2 arithmetic

o addition = subtraction = XOR Each bit string represents a polynomial Example 10011011 corresponds to

A polynomial G(x) of degree r is known to both sender and receiver

Sender appends r bits (called CRC code) to the message so that the resulting polynomial can be divided evenly by G(x)

Receiver checks if the received frame (message together with CRC) is still divisible by G(x)

If not there are transmission errors in the frame

7 4 3( ) 1D x x x x x

Common polynomials for G(x)

CRC

CRC-8

CRC-10

CRC-12

CRC-16

CRC-CCITT

CRC-32

C(x)

x8+x2+x1+1

x10+x9+x5+x4+x1+1

x12+x11+x3+x2+x1+1

x16+x15+x2+1

x16+x12+x5+1

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 6: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-6

Link Layer Services (more)

flow control o pacing between adjacent sending and receiving

nodes

error detection o errors caused by signal attenuation noise o receiver detects presence of errors

bull signals sender for retransmission or drops frame

error correction o receiver identifies and corrects bit error(s) without

resorting to retransmission

5 DataLink Layer 5-7

Where is the link layer implemented

in each and every host link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)o Ethernet card PCMCI card

80211 cardo implements link physical

layer

attaches into hostrsquos system buses

combination of hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

5 DataLink Layer 5-8

Adaptors Communicating

sending sideo encapsulates datagram

in frameo adds error checking bits

rdt flow control etc

receiving sideo looks for errors rdt flow

control etco extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

5 DataLink Layer 5-9

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-10

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

5 DataLink Layer 5-11

Internet checksum (review)

Sender treat segment contents

as sequence of 16-bit integers

checksum addition (1rsquos complement sum) of segment contents

sender puts checksum value into UDP checksum field

Receiver compute checksum of

received segment check if computed

checksum equals checksum field valueo NO - error detectedo YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

5 DataLink Layer 5-12

Checksumming Cyclic Redundancy Check view data bits D as a binary number (actually a

polynomial with binary coefficients) choose r+1 bit pattern (generator) G goal choose r CRC bits R such that

o ltDRgt exactly divisible by G (modulo 2) o receiver knows G divides ltDRgt by G If non-zero

remainder error detectedo can detect all burst errors less than r+1 bits

widely used in practice (Ethernet 80211 WiFi ATM)

Cyclic Redundancy Check Modulo 2 arithmetic

o addition = subtraction = XOR Each bit string represents a polynomial Example 10011011 corresponds to

A polynomial G(x) of degree r is known to both sender and receiver

Sender appends r bits (called CRC code) to the message so that the resulting polynomial can be divided evenly by G(x)

Receiver checks if the received frame (message together with CRC) is still divisible by G(x)

If not there are transmission errors in the frame

7 4 3( ) 1D x x x x x

Common polynomials for G(x)

CRC

CRC-8

CRC-10

CRC-12

CRC-16

CRC-CCITT

CRC-32

C(x)

x8+x2+x1+1

x10+x9+x5+x4+x1+1

x12+x11+x3+x2+x1+1

x16+x15+x2+1

x16+x12+x5+1

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 7: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-7

Where is the link layer implemented

in each and every host link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)o Ethernet card PCMCI card

80211 cardo implements link physical

layer

attaches into hostrsquos system buses

combination of hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

5 DataLink Layer 5-8

Adaptors Communicating

sending sideo encapsulates datagram

in frameo adds error checking bits

rdt flow control etc

receiving sideo looks for errors rdt flow

control etco extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

5 DataLink Layer 5-9

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-10

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

5 DataLink Layer 5-11

Internet checksum (review)

Sender treat segment contents

as sequence of 16-bit integers

checksum addition (1rsquos complement sum) of segment contents

sender puts checksum value into UDP checksum field

Receiver compute checksum of

received segment check if computed

checksum equals checksum field valueo NO - error detectedo YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

5 DataLink Layer 5-12

Checksumming Cyclic Redundancy Check view data bits D as a binary number (actually a

polynomial with binary coefficients) choose r+1 bit pattern (generator) G goal choose r CRC bits R such that

o ltDRgt exactly divisible by G (modulo 2) o receiver knows G divides ltDRgt by G If non-zero

remainder error detectedo can detect all burst errors less than r+1 bits

widely used in practice (Ethernet 80211 WiFi ATM)

Cyclic Redundancy Check Modulo 2 arithmetic

o addition = subtraction = XOR Each bit string represents a polynomial Example 10011011 corresponds to

A polynomial G(x) of degree r is known to both sender and receiver

Sender appends r bits (called CRC code) to the message so that the resulting polynomial can be divided evenly by G(x)

Receiver checks if the received frame (message together with CRC) is still divisible by G(x)

If not there are transmission errors in the frame

7 4 3( ) 1D x x x x x

Common polynomials for G(x)

CRC

CRC-8

CRC-10

CRC-12

CRC-16

CRC-CCITT

CRC-32

C(x)

x8+x2+x1+1

x10+x9+x5+x4+x1+1

x12+x11+x3+x2+x1+1

x16+x15+x2+1

x16+x12+x5+1

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 8: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-8

Adaptors Communicating

sending sideo encapsulates datagram

in frameo adds error checking bits

rdt flow control etc

receiving sideo looks for errors rdt flow

control etco extracts datagram passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

5 DataLink Layer 5-9

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-10

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

5 DataLink Layer 5-11

Internet checksum (review)

Sender treat segment contents

as sequence of 16-bit integers

checksum addition (1rsquos complement sum) of segment contents

sender puts checksum value into UDP checksum field

Receiver compute checksum of

received segment check if computed

checksum equals checksum field valueo NO - error detectedo YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

5 DataLink Layer 5-12

Checksumming Cyclic Redundancy Check view data bits D as a binary number (actually a

polynomial with binary coefficients) choose r+1 bit pattern (generator) G goal choose r CRC bits R such that

o ltDRgt exactly divisible by G (modulo 2) o receiver knows G divides ltDRgt by G If non-zero

remainder error detectedo can detect all burst errors less than r+1 bits

widely used in practice (Ethernet 80211 WiFi ATM)

Cyclic Redundancy Check Modulo 2 arithmetic

o addition = subtraction = XOR Each bit string represents a polynomial Example 10011011 corresponds to

A polynomial G(x) of degree r is known to both sender and receiver

Sender appends r bits (called CRC code) to the message so that the resulting polynomial can be divided evenly by G(x)

Receiver checks if the received frame (message together with CRC) is still divisible by G(x)

If not there are transmission errors in the frame

7 4 3( ) 1D x x x x x

Common polynomials for G(x)

CRC

CRC-8

CRC-10

CRC-12

CRC-16

CRC-CCITT

CRC-32

C(x)

x8+x2+x1+1

x10+x9+x5+x4+x1+1

x12+x11+x3+x2+x1+1

x16+x15+x2+1

x16+x12+x5+1

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 9: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-9

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-10

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

5 DataLink Layer 5-11

Internet checksum (review)

Sender treat segment contents

as sequence of 16-bit integers

checksum addition (1rsquos complement sum) of segment contents

sender puts checksum value into UDP checksum field

Receiver compute checksum of

received segment check if computed

checksum equals checksum field valueo NO - error detectedo YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

5 DataLink Layer 5-12

Checksumming Cyclic Redundancy Check view data bits D as a binary number (actually a

polynomial with binary coefficients) choose r+1 bit pattern (generator) G goal choose r CRC bits R such that

o ltDRgt exactly divisible by G (modulo 2) o receiver knows G divides ltDRgt by G If non-zero

remainder error detectedo can detect all burst errors less than r+1 bits

widely used in practice (Ethernet 80211 WiFi ATM)

Cyclic Redundancy Check Modulo 2 arithmetic

o addition = subtraction = XOR Each bit string represents a polynomial Example 10011011 corresponds to

A polynomial G(x) of degree r is known to both sender and receiver

Sender appends r bits (called CRC code) to the message so that the resulting polynomial can be divided evenly by G(x)

Receiver checks if the received frame (message together with CRC) is still divisible by G(x)

If not there are transmission errors in the frame

7 4 3( ) 1D x x x x x

Common polynomials for G(x)

CRC

CRC-8

CRC-10

CRC-12

CRC-16

CRC-CCITT

CRC-32

C(x)

x8+x2+x1+1

x10+x9+x5+x4+x1+1

x12+x11+x3+x2+x1+1

x16+x15+x2+1

x16+x12+x5+1

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 10: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-10

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

5 DataLink Layer 5-11

Internet checksum (review)

Sender treat segment contents

as sequence of 16-bit integers

checksum addition (1rsquos complement sum) of segment contents

sender puts checksum value into UDP checksum field

Receiver compute checksum of

received segment check if computed

checksum equals checksum field valueo NO - error detectedo YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

5 DataLink Layer 5-12

Checksumming Cyclic Redundancy Check view data bits D as a binary number (actually a

polynomial with binary coefficients) choose r+1 bit pattern (generator) G goal choose r CRC bits R such that

o ltDRgt exactly divisible by G (modulo 2) o receiver knows G divides ltDRgt by G If non-zero

remainder error detectedo can detect all burst errors less than r+1 bits

widely used in practice (Ethernet 80211 WiFi ATM)

Cyclic Redundancy Check Modulo 2 arithmetic

o addition = subtraction = XOR Each bit string represents a polynomial Example 10011011 corresponds to

A polynomial G(x) of degree r is known to both sender and receiver

Sender appends r bits (called CRC code) to the message so that the resulting polynomial can be divided evenly by G(x)

Receiver checks if the received frame (message together with CRC) is still divisible by G(x)

If not there are transmission errors in the frame

7 4 3( ) 1D x x x x x

Common polynomials for G(x)

CRC

CRC-8

CRC-10

CRC-12

CRC-16

CRC-CCITT

CRC-32

C(x)

x8+x2+x1+1

x10+x9+x5+x4+x1+1

x12+x11+x3+x2+x1+1

x16+x15+x2+1

x16+x12+x5+1

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 11: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-11

Internet checksum (review)

Sender treat segment contents

as sequence of 16-bit integers

checksum addition (1rsquos complement sum) of segment contents

sender puts checksum value into UDP checksum field

Receiver compute checksum of

received segment check if computed

checksum equals checksum field valueo NO - error detectedo YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

5 DataLink Layer 5-12

Checksumming Cyclic Redundancy Check view data bits D as a binary number (actually a

polynomial with binary coefficients) choose r+1 bit pattern (generator) G goal choose r CRC bits R such that

o ltDRgt exactly divisible by G (modulo 2) o receiver knows G divides ltDRgt by G If non-zero

remainder error detectedo can detect all burst errors less than r+1 bits

widely used in practice (Ethernet 80211 WiFi ATM)

Cyclic Redundancy Check Modulo 2 arithmetic

o addition = subtraction = XOR Each bit string represents a polynomial Example 10011011 corresponds to

A polynomial G(x) of degree r is known to both sender and receiver

Sender appends r bits (called CRC code) to the message so that the resulting polynomial can be divided evenly by G(x)

Receiver checks if the received frame (message together with CRC) is still divisible by G(x)

If not there are transmission errors in the frame

7 4 3( ) 1D x x x x x

Common polynomials for G(x)

CRC

CRC-8

CRC-10

CRC-12

CRC-16

CRC-CCITT

CRC-32

C(x)

x8+x2+x1+1

x10+x9+x5+x4+x1+1

x12+x11+x3+x2+x1+1

x16+x15+x2+1

x16+x12+x5+1

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 12: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-12

Checksumming Cyclic Redundancy Check view data bits D as a binary number (actually a

polynomial with binary coefficients) choose r+1 bit pattern (generator) G goal choose r CRC bits R such that

o ltDRgt exactly divisible by G (modulo 2) o receiver knows G divides ltDRgt by G If non-zero

remainder error detectedo can detect all burst errors less than r+1 bits

widely used in practice (Ethernet 80211 WiFi ATM)

Cyclic Redundancy Check Modulo 2 arithmetic

o addition = subtraction = XOR Each bit string represents a polynomial Example 10011011 corresponds to

A polynomial G(x) of degree r is known to both sender and receiver

Sender appends r bits (called CRC code) to the message so that the resulting polynomial can be divided evenly by G(x)

Receiver checks if the received frame (message together with CRC) is still divisible by G(x)

If not there are transmission errors in the frame

7 4 3( ) 1D x x x x x

Common polynomials for G(x)

CRC

CRC-8

CRC-10

CRC-12

CRC-16

CRC-CCITT

CRC-32

C(x)

x8+x2+x1+1

x10+x9+x5+x4+x1+1

x12+x11+x3+x2+x1+1

x16+x15+x2+1

x16+x12+x5+1

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 13: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

Cyclic Redundancy Check Modulo 2 arithmetic

o addition = subtraction = XOR Each bit string represents a polynomial Example 10011011 corresponds to

A polynomial G(x) of degree r is known to both sender and receiver

Sender appends r bits (called CRC code) to the message so that the resulting polynomial can be divided evenly by G(x)

Receiver checks if the received frame (message together with CRC) is still divisible by G(x)

If not there are transmission errors in the frame

7 4 3( ) 1D x x x x x

Common polynomials for G(x)

CRC

CRC-8

CRC-10

CRC-12

CRC-16

CRC-CCITT

CRC-32

C(x)

x8+x2+x1+1

x10+x9+x5+x4+x1+1

x12+x11+x3+x2+x1+1

x16+x15+x2+1

x16+x12+x5+1

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 14: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

Common polynomials for G(x)

CRC

CRC-8

CRC-10

CRC-12

CRC-16

CRC-CCITT

CRC-32

C(x)

x8+x2+x1+1

x10+x9+x5+x4+x1+1

x12+x11+x3+x2+x1+1

x16+x15+x2+1

x16+x12+x5+1

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 15: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-15

CRC Example

31001 represents 1x

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 16: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-16

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 17: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-17

Multiple Access Links and Protocols

Two types of ldquolinksrdquo point-to-point

o PPP for dial-up accesso point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)o old-fashioned Etherneto upstream HFC (cable network)o 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 18: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

Introduction 1-18

Cable Network Architecture Overview

home

cable headend

cable distributionnetwork (simplified)

Typically 500 to 5000 homes

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 19: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-19

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes

interference o collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes

share channel ie determine when node can transmit

communication about channel sharing must use channel itself o no out-of-band channel for coordination

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 20: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-20

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1 when one node wants to transmit it can send

at the full rate say R2 when M nodes want to transmit each can

send at average rate RM3 fully decentralized

o no special node to coordinate transmissionso no synchronization of clocks slots

4 simple

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 21: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-21

MAC Protocols a taxonomy

Three broad classes Channel Partitioning

o divide channel into smaller ldquopiecesrdquo (time slots frequency code)

o allocate piece to node for exclusive use

Random Accesso channel not divided allow collisionso ldquorecoverrdquo from collisions

ldquoTaking turnsrdquoo nodes take turns but nodes with more to send can

take longer turns

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 22: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-22

Channel Partitioning MAC protocols TDMA

TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =

pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots

256 idle

1 3 4 1 3 4

6-slotframe

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 23: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-23

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go

idle example 6-station LAN 134 have pkt

frequency bands 256 idle fr

equ

ency

bands time

FDM cable

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 24: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-24

Random Access Protocols

When node has packet to sendo transmit at full channel data rate Ro no a priori coordination among nodes

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies

o when a node can send a frameo how to detect collisionso how to recover from collisions (eg via delayed

retransmissions)

Examples of random access MAC protocolso ALOHAo CSMA CSMACD CSMACA

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 25: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-25

ALOHA

When a node has a frame to send send immediately

Set a timer for a random amount of time If an ACK arrives before the timer expires

fine otherwise resend the frame

(Works like stop-and-wait with random timeout interval)

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 26: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-26

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmit

If channel sensed idle transmit entire frame

If channel sensed busy defer transmission

human analogy donrsquot interrupt others

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 27: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-27

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted

spatial layout of nodes

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 28: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-28

CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA

o collisions detected within short timeo colliding transmissions aborted reducing

channel wastage collision detection

o easy in wired LANs measure signal strengths compare transmitted amp received signals

o difficult in wireless LANs received signal strength overwhelmed by local transmission strength

human analogy the polite conversationalist

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 29: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-29

CSMACD collision detection

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 30: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-30

ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols

o share channel efficiently and fairly at high load

o inefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node

Random access MAC protocolso efficient at low load single node can fully

utilize channelo high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 31: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-31

ldquoTaking Turnsrdquo MAC protocolsPolling master node

ldquoinvitesrdquo slave nodes to transmit in turn

typically used with ldquodumbrdquo slave devices

concernso polling overhead o latencyo single point of

failure (master)

master

slaves

poll

data

data

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 32: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-32

ldquoTaking Turnsrdquo MAC protocolsToken passing control token

passed from one node to next sequentially

token message concerns

o token overhead o latencyo single point of failure

(token)

T

data

(nothingto send)

T

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 33: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-33

Summary of MAC protocols

channel partitioning by time frequency or codeo Time Division Frequency Division

random access (dynamic) o ALOHA CSMA CSMACDo carrier sensing easy in some technologies (wire)

hard in others (wireless)o CSMACD used in Etherneto CSMACA used in 80211

taking turnso polling from central site token passingo Bluetooth FDDI IBM Token Ring

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 34: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-34

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 35: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-35

MAC Addresses and ARP

32-bit IP address o network-layer addresso used to get datagram to destination IP subnet

MAC (or LAN or physical or Ethernet) address o function get frame from one interface to

another physically-connected interface (in same network)

o 48 bit MAC addressbull burned in NIC ROM

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 36: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-36

LAN Addresses and ARPEach 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 orwireless)

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 37: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-37

LAN Address (more)

MAC address allocation administered by IEEE manufacturer buys portion of MAC address

space (to assure uniqueness) analogy (a) MAC address like Social Security Number (b) IP address like postal address MAC flat address portability

o can move LAN card from one LAN to another

IP hierarchical address NOT portableo address depends on IP subnet to which node is

attached

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 38: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-38

ARP Address Resolution Protocol

Each IP node (host router) on LAN has ARP table

ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgto TTL (Time To Live)

time after which address mapping will be forgotten (typically 20 min)

Q given a nodersquos IP address how to determine its MAC address

1A-2F-BB-76-09-AD

0C-C4-11-6F-E3-98

71-65-F7-2B-08-53

LAN

137196723

137196778

137196714

137196788

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 39: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-39

ARP protocol Same LAN (network) A wants to send datagram

to B and Brsquos MAC address not in Arsquos ARP table

A broadcasts ARP query packet containing Bs IP address o dest MAC address = FF-

FF-FF-FF-FF-FFo all machines on LAN

receive ARP query B receives ARP packet

replies to A with its (Bs) MAC addresso frame sent to Arsquos MAC

address (unicast)

A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out)

ARP is ldquoplug-and-playrdquoo nodes create their

ARP tables without intervention from net administrator

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 40: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-40

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

two ARP tables in router R one for each IP network (LAN)

LAN LAN

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 41: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-41

A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagram Arsquos NIC sends frame Rrsquos NIC receives frame R removes IP datagram from Ethernet frame sees its

destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220

111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 42: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-42

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 43: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-43

Ethernet

ldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 44: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-44

Star topology bus topology popular through mid 90s

o all nodes in same collision domain (can collide with each other)

today star topology prevailso active switch in centero each ldquospokerdquo runs a (separate) Ethernet protocol

(nodes do not collide with each other)

switch

bus coaxial cable star

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 45: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-45

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver amp sender clock

rates

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 46: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-46

Ethernet Frame Structure (more) Addresses 6 bytes

o if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

o otherwise adapter discards frame

Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)

CRC checked at receiver if error is detected frame is dropped

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 47: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-47

Ethernet Unreliable connectionless connectionless No handshaking between sending

and receiving NICs Unreliable (best effort) receiving NIC doesnrsquot

send acks or nacks to sending NICo stream of datagrams passed to network layer can have

gaps (missing datagrams)o gaps will be filled if app is using TCPo otherwise app will see gaps

Ethernetrsquos MAC protocol CSMACD

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 48: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-48

Ethernet CSMACD 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 collision while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff

after m-th collision NIC waits K slots of time and then returns to Step 2 where K is a random value in 0 1 2 hellip 2m-1

(1 slot = 512 bit-times)

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 49: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-49

Ethernetrsquos CSMACD (more)

Jam Signal make sure all other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff Goal adapt retransmission

attempts to estimated current loado heavy load random

wait will be longer first collision choose K

from 01 delay is K 512 bit transmission times

after second collision choose K from 0123hellip

after ten collisions choose K from 01234hellip1023

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 50: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-50

8023 Ethernet Standards Link amp Physical Layers

many different Ethernet standardso common MAC protocol and frame formato different speeds 2 Mbps 10 Mbps 100

Mbps 1Gbps 10G bpso different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 51: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-51

Manchester encoding

used in 10BaseT each bit has a transition allows clocks in sending and receiving nodes to

synchronize to each othero no need for a centralized global clock among nodes

Hey this is physical-layer stuff

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 52: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-52

Link Layer

51 Introduction and services

52 Error detection and correction

53 Multiple access protocols

54 Link-layer Addressing

55 Ethernet

56 Link-layer switches LANs

59 A day in the life of a web request

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 53: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-53

Hubsphysical-layer (ldquodumbrdquo) repeaters

o bits coming in one link go out all other links at same rate

o all nodes connected to hub can collide with one another

o no frame bufferingo no CSMACD at hub host NICs detect collisions

twisted pair

hub

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 54: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-54

Switch link-layer device smarter than hubs take active

roleo store forward Ethernet frameso examine incoming framersquos MAC address selectively

forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

transparento hosts are unaware of presence of switches

plug-and-play self-learningo switches do not need to be configured

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 55: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-55

Switch allows multiple simultaneous transmissions

hosts have dedicated direct connection to switch

switches buffer packets Ethernet protocol used on

each incoming link but no collisions full duplexo each link is its own collision

domain switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions o not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 56: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-56

Switch Table

Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

A each switch has a switch table each entryo (MAC address of host interface

to reach host time stamp)

looks like a routing table Q how are entries created

maintained in switch table o something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 23

45

6

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 57: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-57

Switch self-learning

switch learns which hosts can be reached through which interfaceso when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

o records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 58: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-58

Switch frame filteringforwardingWhen frame received

1 record (in switch table) link associated with sending host2 index switch table using MAC dest address3 if entry found for destination

then if dest on segment from which frame arrived

then drop the frame else forward the frame on interface indicated else flood

forward on all but the interface on which the frame arrived

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 59: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-59

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 23

45

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTL

Switch table (initially empty)

A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo

frame destination unknownflood

Arsquo A

destination A location known

Arsquo 4 60

selective send

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 60: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-60

Interconnecting switches

switches can be connected together

A

B

Q sending from A to I - how does S1 know to forward frame destined to F via S4 and S3

A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

H

I

G

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 61: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-61

Self-learning multi-switch exampleSuppose A sends frame to I I responds to A

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

A

B

S1

C D

E

FS2

S4

S3

H

I

G

1

2 3

34

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 62: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-62

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 63: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-63

Switches vs Routers both store-and-forward devices

o routers network layer devices (examine network layer headers)o switches are link layer devices

routers maintain routing tables implement routing algorithms

switches maintain switch tables implement filtering learning algorithms

Switch

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 64: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-64

Link Layer

51 Introduction and services

52 Error detection and correction

53Multiple access protocols

54 Link-Layer Addressing

55 Ethernet

56 Link-layer switches 59 A day in the life of

a web request

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 65: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-65

Synthesis a day in the life of a web request

journey down protocol stack completeo application transport network link

putting-it-all-together synthesiso goal identify review understand protocols

(at all layers) involved in seemingly simple scenario requesting www page

o scenario student attaches laptop to campus network requestsreceives wwwgooglecom

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 66: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-66

A day in the life scenario

Comcast network 68800013

Googlersquos network 64233160019 64233169105

web server

DNS server

school network 68802024

browser

web page

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 67: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-67

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server

Ethernet demuxrsquoed to IP demuxrsquoed UDP demuxrsquoed to DHCP

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 68: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-68

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

router(runs DHCP)

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

DHCP client receives DHCP ACK reply

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 69: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-69

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created encapsulated in UDP encapsulated in IP encasulated in Eth In order to send frame to router need MAC address of router interface ARP

ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 70: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-70

A day in the lifehellip using DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF andor BGP routing protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to

client with IP address of wwwgooglecom

Comcast network 68800013

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 71: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-71

A day in the lifehellip TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established

64233169105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 72: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-72

A day in the lifehellip HTTP requestreply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to wwwgooglecom

IP datgram containing HTTP reply routed back to client

64233169105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally () displayed

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath
Page 73: 5: DataLink Layer5-1 Link Layer  5.1 Introduction and services  5.2 Error detection and correction  5.3Multiple access protocols  5.4 Link-layer Addressing.

5 DataLink Layer 5-73

Chapter 5 letrsquos take a breath journey down protocol stack complete

(except PHY) solid understanding of networking

principles practice hellip could stop here hellip but lots of

interesting topicso Internetworking (CSE 678 TCPIP socket

programming)o Wireless (ECE xxx)o Multimedia (CSE 679)o Security (CSE 651)

  • Link Layer
  • Link Layer Introduction
  • Link layer context
  • Encapsulation
  • Link Layer Services
  • Link Layer Services (more)
  • Where is the link layer implemented
  • Adaptors Communicating
  • Slide 9
  • Parity Checking
  • Internet checksum (review)
  • Checksumming Cyclic Redundancy Check
  • Cyclic Redundancy Check
  • Slide 14
  • CRC Example
  • Slide 16
  • Multiple Access Links and Protocols
  • Cable Network Architecture Overview
  • Multiple Access protocols
  • Ideal Multiple Access Protocol
  • MAC Protocols a taxonomy
  • Channel Partitioning MAC protocols TDMA
  • Channel Partitioning MAC protocols FDMA
  • Random Access Protocols
  • ALOHA
  • CSMA (Carrier Sense Multiple Access)
  • CSMA collisions
  • CSMACD (Collision Detection)
  • CSMACD collision detection
  • ldquoTaking Turnsrdquo MAC protocols
  • Slide 31
  • Slide 32
  • Summary of MAC protocols
  • Slide 34
  • MAC Addresses and ARP
  • LAN Addresses and ARP
  • LAN Address (more)
  • ARP Address Resolution Protocol
  • ARP protocol Same LAN (network)
  • Addressing routing to another LAN
  • Slide 41
  • Slide 42
  • Ethernet
  • Star topology
  • Ethernet Frame Structure
  • Ethernet Frame Structure (more)
  • Ethernet Unreliable connectionless
  • Ethernet CSMACD algorithm
  • Ethernetrsquos CSMACD (more)
  • 8023 Ethernet Standards Link amp Physical Layers
  • Manchester encoding
  • Slide 52
  • Hubs
  • Switch
  • Switch allows multiple simultaneous transmissions
  • Switch Table
  • Switch self-learning
  • Switch frame filteringforwarding
  • Self-learning forwarding example
  • Interconnecting switches
  • Self-learning multi-switch example
  • Institutional network
  • Switches vs Routers
  • Slide 64
  • Synthesis a day in the life of a web request
  • A day in the life scenario
  • A day in the lifehellip connecting to the Internet
  • Slide 68
  • A day in the lifehellip ARP (before DNS before HTTP)
  • A day in the lifehellip using DNS
  • A day in the lifehellip TCP connection carrying HTTP
  • A day in the lifehellip HTTP requestreply
  • Chapter 5 letrsquos take a breath