chapter 5 li k llink layer - ntut.edu.tw

88
Chapter 5 Li k L Link Layer Computer Networking: A Top Do App oach Do wn Appr oach 6 th edition Jim Kurose, Keith Ross Addison Wesley All material copyright 1996-2012 Addison-Wesley March 2012 J.F Kurose and K.W. Ross, All Rights Reserved Link Layer 5-1

Upload: others

Post on 18-Apr-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 5 Li k LLink Layer - ntut.edu.tw

Chapter 5Li k LLink Layer

Computer Networking A Top Do App oach Down Approach 6th edition Jim Kurose Keith RossAddison WesleyAll material copyright 1996-2012 Addison-WesleyMarch 2012

JF Kurose and KW Ross All Rights Reserved

Link Layer 5-1

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-2

Link layer introductionyterminologygy hosts and routers nodes communication channels that

dj d l global ISP

connect adjacent nodes along communication path links wired linkswired links wireless links LANs

layer-2 packet frameencapsulates datagram

data-link layer has responsibility of transferring datagram from one node

h ll d d l k

Link Layer 5-3

to physically adjacent node over a link

Link layer contextLink layer context

datagram transferred by transportation analogy datagram transferred by different link protocols over different links

transportation analogy trip from Princeton to Lausanne

limo Princeton to JFK eg Ethernet on first link

frame relay on intermediate links 80211

plane JFK to Geneva train Geneva to Lausanne

tourist = datagramintermediate links 80211 on last link

each link protocol provides diff i

tourist datagram transport segment =

communication linkdifferent services eg may or may not

provide rdt over link

transportation mode = link layer protocol

travel agent = routing provide rdt over link travel agent = routing algorithm

Link Layer 5-4

Link layer servicesLink layer services framing link access framing link access encapsulate datagram into frame adding header trailer channel access if shared mediumldquo rdquo ldquoMACrdquo addresses used in frame headers to identify source dest

bull different from IP addressdifferent from IP address reliable delivery between adjacent nodes we learned how to do this already (chapter 3)y ( p ) seldom used on low bit-error link (fiber some twisted

pair) wireless links high error rateswireless links high error rates

bull Q why both link-level and end-end reliability

Link Layer 5-5

Link layer services (more)

fl t l

Link layer services (more)

flow control pacing between adjacent sending and receiving nodes

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

bull signals sender for retransmission or drops frame

error correction d f d b ( ) h receiver identifies and corrects bit error(s) without resorting to

retransmission

half-duplex and full-duplexf p f p with half duplex nodes at both ends of link can transmit but not

at same time

Link Layer 5-6

Where is the link layer implementede e s t e aye p e e te in each and every host

l k l l d link layer implemented in ldquoadaptorrdquo (aka network interface card NIC) or on a f )chip Ethernet card 80211

card Ethernet chipsetcpu memory

applicationtransportnetwork

linkcard Ethernet chipset implements link physical

layer controller

host bus (e g PCI)

link

y attaches into hostrsquos system

busesbi i f h d

physicaltransmission

(eg PCI)link

physical

combination of hardware software firmware network adapter

card

Link Layer 5-7

Adaptors communicatingAdaptors communicating

controller controller

datagram datagram

controller

sending host receiving hostdatagram

frame

sending side encapsulates datagram in

frame

receiving side looks for errors rdt

flow control etcframe adds error checking bits

rdt flow control etc

flow control etc extracts datagram passes

to upper layer at

Link Layer 5-8

pp yreceiving side

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-9

Error detectionError detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Link Layer 5-10

Parity checkingParity checking

single bit parity two-dimensional bit paritysingle bit parity detect single bit

errors

two dimensional bit parity detect and correct single bit errors

0 0

Link Layer 5-11

Cyclic redundancy checkCyclic redundancy check more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G

l h CRC bi R h h goal choose r CRC bits R such that ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder y

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

widely used in practice (Ethernet 802 11 WiFi ATM) widely used in practice (Ethernet 80211 WiFi ATM)

Link Layer 5-12

CRC exampleCRC example

wantwantD2r XOR R = nG

equivalentlyq yD2r = nG XOR R

equivalentlyq yif we divide D2r by G want remainder R to satisfyto satisfy

R i d [ ]D2r

RR = remainder[ ]G

R

Link Layer 5-13

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-14

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 2: Chapter 5 Li k LLink Layer - ntut.edu.tw

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-2

Link layer introductionyterminologygy hosts and routers nodes communication channels that

dj d l global ISP

connect adjacent nodes along communication path links wired linkswired links wireless links LANs

layer-2 packet frameencapsulates datagram

data-link layer has responsibility of transferring datagram from one node

h ll d d l k

Link Layer 5-3

to physically adjacent node over a link

Link layer contextLink layer context

datagram transferred by transportation analogy datagram transferred by different link protocols over different links

transportation analogy trip from Princeton to Lausanne

limo Princeton to JFK eg Ethernet on first link

frame relay on intermediate links 80211

plane JFK to Geneva train Geneva to Lausanne

tourist = datagramintermediate links 80211 on last link

each link protocol provides diff i

tourist datagram transport segment =

communication linkdifferent services eg may or may not

provide rdt over link

transportation mode = link layer protocol

travel agent = routing provide rdt over link travel agent = routing algorithm

Link Layer 5-4

Link layer servicesLink layer services framing link access framing link access encapsulate datagram into frame adding header trailer channel access if shared mediumldquo rdquo ldquoMACrdquo addresses used in frame headers to identify source dest

bull different from IP addressdifferent from IP address reliable delivery between adjacent nodes we learned how to do this already (chapter 3)y ( p ) seldom used on low bit-error link (fiber some twisted

pair) wireless links high error rateswireless links high error rates

bull Q why both link-level and end-end reliability

Link Layer 5-5

Link layer services (more)

fl t l

Link layer services (more)

flow control pacing between adjacent sending and receiving nodes

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

bull signals sender for retransmission or drops frame

error correction d f d b ( ) h receiver identifies and corrects bit error(s) without resorting to

retransmission

half-duplex and full-duplexf p f p with half duplex nodes at both ends of link can transmit but not

at same time

Link Layer 5-6

Where is the link layer implementede e s t e aye p e e te in each and every host

l k l l d link layer implemented in ldquoadaptorrdquo (aka network interface card NIC) or on a f )chip Ethernet card 80211

card Ethernet chipsetcpu memory

applicationtransportnetwork

linkcard Ethernet chipset implements link physical

layer controller

host bus (e g PCI)

link

y attaches into hostrsquos system

busesbi i f h d

physicaltransmission

(eg PCI)link

physical

combination of hardware software firmware network adapter

card

Link Layer 5-7

Adaptors communicatingAdaptors communicating

controller controller

datagram datagram

controller

sending host receiving hostdatagram

frame

sending side encapsulates datagram in

frame

receiving side looks for errors rdt

flow control etcframe adds error checking bits

rdt flow control etc

flow control etc extracts datagram passes

to upper layer at

Link Layer 5-8

pp yreceiving side

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-9

Error detectionError detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Link Layer 5-10

Parity checkingParity checking

single bit parity two-dimensional bit paritysingle bit parity detect single bit

errors

two dimensional bit parity detect and correct single bit errors

0 0

Link Layer 5-11

Cyclic redundancy checkCyclic redundancy check more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G

l h CRC bi R h h goal choose r CRC bits R such that ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder y

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

widely used in practice (Ethernet 802 11 WiFi ATM) widely used in practice (Ethernet 80211 WiFi ATM)

Link Layer 5-12

CRC exampleCRC example

wantwantD2r XOR R = nG

equivalentlyq yD2r = nG XOR R

equivalentlyq yif we divide D2r by G want remainder R to satisfyto satisfy

R i d [ ]D2r

RR = remainder[ ]G

R

Link Layer 5-13

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-14

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 3: Chapter 5 Li k LLink Layer - ntut.edu.tw

Link layer introductionyterminologygy hosts and routers nodes communication channels that

dj d l global ISP

connect adjacent nodes along communication path links wired linkswired links wireless links LANs

layer-2 packet frameencapsulates datagram

data-link layer has responsibility of transferring datagram from one node

h ll d d l k

Link Layer 5-3

to physically adjacent node over a link

Link layer contextLink layer context

datagram transferred by transportation analogy datagram transferred by different link protocols over different links

transportation analogy trip from Princeton to Lausanne

limo Princeton to JFK eg Ethernet on first link

frame relay on intermediate links 80211

plane JFK to Geneva train Geneva to Lausanne

tourist = datagramintermediate links 80211 on last link

each link protocol provides diff i

tourist datagram transport segment =

communication linkdifferent services eg may or may not

provide rdt over link

transportation mode = link layer protocol

travel agent = routing provide rdt over link travel agent = routing algorithm

Link Layer 5-4

Link layer servicesLink layer services framing link access framing link access encapsulate datagram into frame adding header trailer channel access if shared mediumldquo rdquo ldquoMACrdquo addresses used in frame headers to identify source dest

bull different from IP addressdifferent from IP address reliable delivery between adjacent nodes we learned how to do this already (chapter 3)y ( p ) seldom used on low bit-error link (fiber some twisted

pair) wireless links high error rateswireless links high error rates

bull Q why both link-level and end-end reliability

Link Layer 5-5

Link layer services (more)

fl t l

Link layer services (more)

flow control pacing between adjacent sending and receiving nodes

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

bull signals sender for retransmission or drops frame

error correction d f d b ( ) h receiver identifies and corrects bit error(s) without resorting to

retransmission

half-duplex and full-duplexf p f p with half duplex nodes at both ends of link can transmit but not

at same time

Link Layer 5-6

Where is the link layer implementede e s t e aye p e e te in each and every host

l k l l d link layer implemented in ldquoadaptorrdquo (aka network interface card NIC) or on a f )chip Ethernet card 80211

card Ethernet chipsetcpu memory

applicationtransportnetwork

linkcard Ethernet chipset implements link physical

layer controller

host bus (e g PCI)

link

y attaches into hostrsquos system

busesbi i f h d

physicaltransmission

(eg PCI)link

physical

combination of hardware software firmware network adapter

card

Link Layer 5-7

Adaptors communicatingAdaptors communicating

controller controller

datagram datagram

controller

sending host receiving hostdatagram

frame

sending side encapsulates datagram in

frame

receiving side looks for errors rdt

flow control etcframe adds error checking bits

rdt flow control etc

flow control etc extracts datagram passes

to upper layer at

Link Layer 5-8

pp yreceiving side

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-9

Error detectionError detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Link Layer 5-10

Parity checkingParity checking

single bit parity two-dimensional bit paritysingle bit parity detect single bit

errors

two dimensional bit parity detect and correct single bit errors

0 0

Link Layer 5-11

Cyclic redundancy checkCyclic redundancy check more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G

l h CRC bi R h h goal choose r CRC bits R such that ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder y

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

widely used in practice (Ethernet 802 11 WiFi ATM) widely used in practice (Ethernet 80211 WiFi ATM)

Link Layer 5-12

CRC exampleCRC example

wantwantD2r XOR R = nG

equivalentlyq yD2r = nG XOR R

equivalentlyq yif we divide D2r by G want remainder R to satisfyto satisfy

R i d [ ]D2r

RR = remainder[ ]G

R

Link Layer 5-13

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-14

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 4: Chapter 5 Li k LLink Layer - ntut.edu.tw

Link layer contextLink layer context

datagram transferred by transportation analogy datagram transferred by different link protocols over different links

transportation analogy trip from Princeton to Lausanne

limo Princeton to JFK eg Ethernet on first link

frame relay on intermediate links 80211

plane JFK to Geneva train Geneva to Lausanne

tourist = datagramintermediate links 80211 on last link

each link protocol provides diff i

tourist datagram transport segment =

communication linkdifferent services eg may or may not

provide rdt over link

transportation mode = link layer protocol

travel agent = routing provide rdt over link travel agent = routing algorithm

Link Layer 5-4

Link layer servicesLink layer services framing link access framing link access encapsulate datagram into frame adding header trailer channel access if shared mediumldquo rdquo ldquoMACrdquo addresses used in frame headers to identify source dest

bull different from IP addressdifferent from IP address reliable delivery between adjacent nodes we learned how to do this already (chapter 3)y ( p ) seldom used on low bit-error link (fiber some twisted

pair) wireless links high error rateswireless links high error rates

bull Q why both link-level and end-end reliability

Link Layer 5-5

Link layer services (more)

fl t l

Link layer services (more)

flow control pacing between adjacent sending and receiving nodes

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

bull signals sender for retransmission or drops frame

error correction d f d b ( ) h receiver identifies and corrects bit error(s) without resorting to

retransmission

half-duplex and full-duplexf p f p with half duplex nodes at both ends of link can transmit but not

at same time

Link Layer 5-6

Where is the link layer implementede e s t e aye p e e te in each and every host

l k l l d link layer implemented in ldquoadaptorrdquo (aka network interface card NIC) or on a f )chip Ethernet card 80211

card Ethernet chipsetcpu memory

applicationtransportnetwork

linkcard Ethernet chipset implements link physical

layer controller

host bus (e g PCI)

link

y attaches into hostrsquos system

busesbi i f h d

physicaltransmission

(eg PCI)link

physical

combination of hardware software firmware network adapter

card

Link Layer 5-7

Adaptors communicatingAdaptors communicating

controller controller

datagram datagram

controller

sending host receiving hostdatagram

frame

sending side encapsulates datagram in

frame

receiving side looks for errors rdt

flow control etcframe adds error checking bits

rdt flow control etc

flow control etc extracts datagram passes

to upper layer at

Link Layer 5-8

pp yreceiving side

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-9

Error detectionError detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Link Layer 5-10

Parity checkingParity checking

single bit parity two-dimensional bit paritysingle bit parity detect single bit

errors

two dimensional bit parity detect and correct single bit errors

0 0

Link Layer 5-11

Cyclic redundancy checkCyclic redundancy check more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G

l h CRC bi R h h goal choose r CRC bits R such that ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder y

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

widely used in practice (Ethernet 802 11 WiFi ATM) widely used in practice (Ethernet 80211 WiFi ATM)

Link Layer 5-12

CRC exampleCRC example

wantwantD2r XOR R = nG

equivalentlyq yD2r = nG XOR R

equivalentlyq yif we divide D2r by G want remainder R to satisfyto satisfy

R i d [ ]D2r

RR = remainder[ ]G

R

Link Layer 5-13

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-14

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 5: Chapter 5 Li k LLink Layer - ntut.edu.tw

Link layer servicesLink layer services framing link access framing link access encapsulate datagram into frame adding header trailer channel access if shared mediumldquo rdquo ldquoMACrdquo addresses used in frame headers to identify source dest

bull different from IP addressdifferent from IP address reliable delivery between adjacent nodes we learned how to do this already (chapter 3)y ( p ) seldom used on low bit-error link (fiber some twisted

pair) wireless links high error rateswireless links high error rates

bull Q why both link-level and end-end reliability

Link Layer 5-5

Link layer services (more)

fl t l

Link layer services (more)

flow control pacing between adjacent sending and receiving nodes

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

bull signals sender for retransmission or drops frame

error correction d f d b ( ) h receiver identifies and corrects bit error(s) without resorting to

retransmission

half-duplex and full-duplexf p f p with half duplex nodes at both ends of link can transmit but not

at same time

Link Layer 5-6

Where is the link layer implementede e s t e aye p e e te in each and every host

l k l l d link layer implemented in ldquoadaptorrdquo (aka network interface card NIC) or on a f )chip Ethernet card 80211

card Ethernet chipsetcpu memory

applicationtransportnetwork

linkcard Ethernet chipset implements link physical

layer controller

host bus (e g PCI)

link

y attaches into hostrsquos system

busesbi i f h d

physicaltransmission

(eg PCI)link

physical

combination of hardware software firmware network adapter

card

Link Layer 5-7

Adaptors communicatingAdaptors communicating

controller controller

datagram datagram

controller

sending host receiving hostdatagram

frame

sending side encapsulates datagram in

frame

receiving side looks for errors rdt

flow control etcframe adds error checking bits

rdt flow control etc

flow control etc extracts datagram passes

to upper layer at

Link Layer 5-8

pp yreceiving side

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-9

Error detectionError detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Link Layer 5-10

Parity checkingParity checking

single bit parity two-dimensional bit paritysingle bit parity detect single bit

errors

two dimensional bit parity detect and correct single bit errors

0 0

Link Layer 5-11

Cyclic redundancy checkCyclic redundancy check more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G

l h CRC bi R h h goal choose r CRC bits R such that ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder y

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

widely used in practice (Ethernet 802 11 WiFi ATM) widely used in practice (Ethernet 80211 WiFi ATM)

Link Layer 5-12

CRC exampleCRC example

wantwantD2r XOR R = nG

equivalentlyq yD2r = nG XOR R

equivalentlyq yif we divide D2r by G want remainder R to satisfyto satisfy

R i d [ ]D2r

RR = remainder[ ]G

R

Link Layer 5-13

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-14

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 6: Chapter 5 Li k LLink Layer - ntut.edu.tw

Link layer services (more)

fl t l

Link layer services (more)

flow control pacing between adjacent sending and receiving nodes

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

bull signals sender for retransmission or drops frame

error correction d f d b ( ) h receiver identifies and corrects bit error(s) without resorting to

retransmission

half-duplex and full-duplexf p f p with half duplex nodes at both ends of link can transmit but not

at same time

Link Layer 5-6

Where is the link layer implementede e s t e aye p e e te in each and every host

l k l l d link layer implemented in ldquoadaptorrdquo (aka network interface card NIC) or on a f )chip Ethernet card 80211

card Ethernet chipsetcpu memory

applicationtransportnetwork

linkcard Ethernet chipset implements link physical

layer controller

host bus (e g PCI)

link

y attaches into hostrsquos system

busesbi i f h d

physicaltransmission

(eg PCI)link

physical

combination of hardware software firmware network adapter

card

Link Layer 5-7

Adaptors communicatingAdaptors communicating

controller controller

datagram datagram

controller

sending host receiving hostdatagram

frame

sending side encapsulates datagram in

frame

receiving side looks for errors rdt

flow control etcframe adds error checking bits

rdt flow control etc

flow control etc extracts datagram passes

to upper layer at

Link Layer 5-8

pp yreceiving side

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-9

Error detectionError detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Link Layer 5-10

Parity checkingParity checking

single bit parity two-dimensional bit paritysingle bit parity detect single bit

errors

two dimensional bit parity detect and correct single bit errors

0 0

Link Layer 5-11

Cyclic redundancy checkCyclic redundancy check more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G

l h CRC bi R h h goal choose r CRC bits R such that ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder y

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

widely used in practice (Ethernet 802 11 WiFi ATM) widely used in practice (Ethernet 80211 WiFi ATM)

Link Layer 5-12

CRC exampleCRC example

wantwantD2r XOR R = nG

equivalentlyq yD2r = nG XOR R

equivalentlyq yif we divide D2r by G want remainder R to satisfyto satisfy

R i d [ ]D2r

RR = remainder[ ]G

R

Link Layer 5-13

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-14

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 7: Chapter 5 Li k LLink Layer - ntut.edu.tw

Where is the link layer implementede e s t e aye p e e te in each and every host

l k l l d link layer implemented in ldquoadaptorrdquo (aka network interface card NIC) or on a f )chip Ethernet card 80211

card Ethernet chipsetcpu memory

applicationtransportnetwork

linkcard Ethernet chipset implements link physical

layer controller

host bus (e g PCI)

link

y attaches into hostrsquos system

busesbi i f h d

physicaltransmission

(eg PCI)link

physical

combination of hardware software firmware network adapter

card

Link Layer 5-7

Adaptors communicatingAdaptors communicating

controller controller

datagram datagram

controller

sending host receiving hostdatagram

frame

sending side encapsulates datagram in

frame

receiving side looks for errors rdt

flow control etcframe adds error checking bits

rdt flow control etc

flow control etc extracts datagram passes

to upper layer at

Link Layer 5-8

pp yreceiving side

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-9

Error detectionError detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Link Layer 5-10

Parity checkingParity checking

single bit parity two-dimensional bit paritysingle bit parity detect single bit

errors

two dimensional bit parity detect and correct single bit errors

0 0

Link Layer 5-11

Cyclic redundancy checkCyclic redundancy check more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G

l h CRC bi R h h goal choose r CRC bits R such that ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder y

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

widely used in practice (Ethernet 802 11 WiFi ATM) widely used in practice (Ethernet 80211 WiFi ATM)

Link Layer 5-12

CRC exampleCRC example

wantwantD2r XOR R = nG

equivalentlyq yD2r = nG XOR R

equivalentlyq yif we divide D2r by G want remainder R to satisfyto satisfy

R i d [ ]D2r

RR = remainder[ ]G

R

Link Layer 5-13

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-14

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 8: Chapter 5 Li k LLink Layer - ntut.edu.tw

Adaptors communicatingAdaptors communicating

controller controller

datagram datagram

controller

sending host receiving hostdatagram

frame

sending side encapsulates datagram in

frame

receiving side looks for errors rdt

flow control etcframe adds error checking bits

rdt flow control etc

flow control etc extracts datagram passes

to upper layer at

Link Layer 5-8

pp yreceiving side

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-9

Error detectionError detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Link Layer 5-10

Parity checkingParity checking

single bit parity two-dimensional bit paritysingle bit parity detect single bit

errors

two dimensional bit parity detect and correct single bit errors

0 0

Link Layer 5-11

Cyclic redundancy checkCyclic redundancy check more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G

l h CRC bi R h h goal choose r CRC bits R such that ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder y

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

widely used in practice (Ethernet 802 11 WiFi ATM) widely used in practice (Ethernet 80211 WiFi ATM)

Link Layer 5-12

CRC exampleCRC example

wantwantD2r XOR R = nG

equivalentlyq yD2r = nG XOR R

equivalentlyq yif we divide D2r by G want remainder R to satisfyto satisfy

R i d [ ]D2r

RR = remainder[ ]G

R

Link Layer 5-13

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-14

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 9: Chapter 5 Li k LLink Layer - ntut.edu.tw

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-9

Error detectionError detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Link Layer 5-10

Parity checkingParity checking

single bit parity two-dimensional bit paritysingle bit parity detect single bit

errors

two dimensional bit parity detect and correct single bit errors

0 0

Link Layer 5-11

Cyclic redundancy checkCyclic redundancy check more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G

l h CRC bi R h h goal choose r CRC bits R such that ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder y

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

widely used in practice (Ethernet 802 11 WiFi ATM) widely used in practice (Ethernet 80211 WiFi ATM)

Link Layer 5-12

CRC exampleCRC example

wantwantD2r XOR R = nG

equivalentlyq yD2r = nG XOR R

equivalentlyq yif we divide D2r by G want remainder R to satisfyto satisfy

R i d [ ]D2r

RR = remainder[ ]G

R

Link Layer 5-13

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-14

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 10: Chapter 5 Li k LLink Layer - ntut.edu.tw

Error detectionError detectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Link Layer 5-10

Parity checkingParity checking

single bit parity two-dimensional bit paritysingle bit parity detect single bit

errors

two dimensional bit parity detect and correct single bit errors

0 0

Link Layer 5-11

Cyclic redundancy checkCyclic redundancy check more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G

l h CRC bi R h h goal choose r CRC bits R such that ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder y

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

widely used in practice (Ethernet 802 11 WiFi ATM) widely used in practice (Ethernet 80211 WiFi ATM)

Link Layer 5-12

CRC exampleCRC example

wantwantD2r XOR R = nG

equivalentlyq yD2r = nG XOR R

equivalentlyq yif we divide D2r by G want remainder R to satisfyto satisfy

R i d [ ]D2r

RR = remainder[ ]G

R

Link Layer 5-13

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-14

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 11: Chapter 5 Li k LLink Layer - ntut.edu.tw

Parity checkingParity checking

single bit parity two-dimensional bit paritysingle bit parity detect single bit

errors

two dimensional bit parity detect and correct single bit errors

0 0

Link Layer 5-11

Cyclic redundancy checkCyclic redundancy check more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G

l h CRC bi R h h goal choose r CRC bits R such that ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder y

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

widely used in practice (Ethernet 802 11 WiFi ATM) widely used in practice (Ethernet 80211 WiFi ATM)

Link Layer 5-12

CRC exampleCRC example

wantwantD2r XOR R = nG

equivalentlyq yD2r = nG XOR R

equivalentlyq yif we divide D2r by G want remainder R to satisfyto satisfy

R i d [ ]D2r

RR = remainder[ ]G

R

Link Layer 5-13

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-14

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 12: Chapter 5 Li k LLink Layer - ntut.edu.tw

Cyclic redundancy checkCyclic redundancy check more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G

l h CRC bi R h h goal choose r CRC bits R such that ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder y

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

widely used in practice (Ethernet 802 11 WiFi ATM) widely used in practice (Ethernet 80211 WiFi ATM)

Link Layer 5-12

CRC exampleCRC example

wantwantD2r XOR R = nG

equivalentlyq yD2r = nG XOR R

equivalentlyq yif we divide D2r by G want remainder R to satisfyto satisfy

R i d [ ]D2r

RR = remainder[ ]G

R

Link Layer 5-13

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-14

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 13: Chapter 5 Li k LLink Layer - ntut.edu.tw

CRC exampleCRC example

wantwantD2r XOR R = nG

equivalentlyq yD2r = nG XOR R

equivalentlyq yif we divide D2r by G want remainder R to satisfyto satisfy

R i d [ ]D2r

RR = remainder[ ]G

R

Link Layer 5-13

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-14

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 14: Chapter 5 Li k LLink Layer - ntut.edu.tw

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-14

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 15: Chapter 5 Li k LLink Layer - ntut.edu.tw

Multiple access links protocolsp ptwo types of ldquolinksrdquo

i t t i t point-to-point PPP for dial-up access point-to-point link between Ethernet switch hostp p

broadcast (shared wire or medium) old-fashioned Ethernet upstream HFC 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF(e g 802 11 WiFi)

shared RF(satellite)

humans at acocktail party

Link Layer 5-15

cabled Ethernet) (eg 80211 WiFi) (satellite) cocktail party (shared air acoustical)

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 16: Chapter 5 Li k LLink Layer - ntut.edu.tw

Multiple access protocolsMultiple access protocols single shared broadcast channel g two or more simultaneous transmissions by nodes

interference lli i if d i i l h collision if node receives two or more signals at the same

time

multiple access protocol distributed algorithm that determines how nodes share st bute a go t t at ete es ow o es s a e

channel ie determine when node can transmit communication about channel sharing must use channel itself

f b d h l f d no out-of-band channel for coordination

Link Layer 5-16

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 17: Chapter 5 Li k LLink Layer - ntut.edu.tw

An ideal multiple access protocolAn ideal multiple access protocol

i b d h l f R bgiven broadcast channel of rate R bpsdesirable rate

1 h d d R1 when one node wants to transmit it can send at rate R2 when M nodes want to transmit each can send at average

rate RMrate RM3 fully decentralized

bull no special node to coordinate transmissionso spec a o e to coo ate t a s ss o sbull no synchronization of clocks slots

4 simplep

Link Layer 5-17

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 18: Chapter 5 Li k LLink Layer - ntut.edu.tw

MAC protocols taxonomyMAC protocols taxonomy

three broad classes channel partitioning

divide channel into smaller ldquopiecesrdquo (time slots frequency code) allocate piece to node for exclusive use

random accessh l di id d ll lli i channel not divided allow collisions

ldquorecoverrdquo from collisions

ldquotaking turnsrdquo taking turns nodes take turns but nodes with more to send can take longer

turns

Link Layer 5-18

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 19: Chapter 5 Li k LLink Layer - ntut.edu.tw

Channel partitioning MAC protocols TDMAChannel partitioning MAC protocols TDMA

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

trans time) in each round unused slots go idle

l 6 i LAN 1 3 4 h k l example 6-station LAN 134 have pkt slots 256 idle

6-slotframe

6-slotframe

1 3 4 1 3 4

Link Layer 5-19

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 20: Chapter 5 Li k LLink Layer - ntut.edu.tw

Channel partitioning MAC protocols FDMA

FDMA frequency division multiple access

Channel partitioning MAC protocols FDMA

q y p 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 idle

y ba

nds

frequ

ency

FDM cable

Link Layer 5-20

f

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 21: Chapter 5 Li k LLink Layer - ntut.edu.tw

Random access protocolsRandom access protocols when node has packet to send when node has packet to send transmit at full channel data rate R no a priori coordination among nodesp g

two or more transmitting nodes ldquocollisionrdquo random access MAC protocol specifies how to detect collisions how to recover from collisions (eg via delayed

retransmissions)retransmissions) examples of random access MAC protocols slotted ALOHA ALOHA CSMA CSMACD CSMACA

Link Layer 5-21

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 22: Chapter 5 Li k LLink Layer - ntut.edu.tw

Slotted ALOHASlotted ALOHA

assumptions operationassumptions all frames same size time divided into equal size

operation when node obtains fresh

frame transmits in next slot time divided into equal size slots (time to transmit 1 frame)

d

frame transmits in next slot if no collision node can send

new frame in next slot nodes start to transmit

only slot beginning nodes are synchronized

if collision node retransmits frame in each subsequent slot with prob p until nodes are synchronized

if 2 or more nodes transmit in slot all nodes detect

lli i

slot with prob p until success

collision

Link Layer 5-22

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 23: Chapter 5 Li k LLink Layer - ntut.edu.tw

Slotted ALOHASlotted ALOHA1 1 1 1node 1

2

3

2 2

3 3

node 2

node 3

P C

3 3 3node 3

C C CS S SE E E

Pros single active node can

continuously transmit at

Cons collisions wasting slots

idl lcontinuously transmit at full rate of channel

highly decentralized only

idle slots nodes may be able to

detect collision in less slots in nodes need to be in sync

simple

detect collision in less than time to transmit packet

Link Layer 5-23

simple clock synchronization

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 24: Chapter 5 Li k LLink Layer - ntut.edu.tw

Slotted ALOHA efficiency

Slotted ALOHA efficiency

max efficiency find p that maximizes Np(1-p)N-1

efficiency long-run fraction of successful slots (many nodes all with many

pp N d ith

p( p) for many nodes take limit

of Np(1-p)N-1 as N goes to infinity gives

(many nodes all with many frames to send)

suppose N nodes with many frames to send each transmits in slot with

to infinity givesmax efficiency = 1e = 37

probability p prob that given node has

success in a slot = p(1-at best channelused for useful success in a slot = p(1-

p)N-1

prob that any node has a N 1

used for useful transmissions 37of time

Link Layer 5-24

success = Np(1-p)N-1

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 25: Chapter 5 Li k LLink Layer - ntut.edu.tw

Pure (unslotted) ALOHAPure (unslotted) ALOHA

unslotted Aloha simpler no synchronizationp y when frame first arrives transmit immediately

collision probability increases frame sent at t0 collides with other frames sent in [t0-

1 t +1]1t0+1]

Link Layer 5-25

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 26: Chapter 5 Li k LLink Layer - ntut.edu.tw

Pure ALOHA efficiencyyP(success by given node) = P(node transmits)

P(no other node transmits in [t0-1t0] P(no other node transmits in [t0-1t0]

= p (1-p)N-1 (1-p)N-1

= p (1-p)2(N-1)

hellip choosing optimum p and then letting n

= 1(2e) = 18= 1(2e) = 18

even worse than slotted Aloha

Link Layer 5-26

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 27: Chapter 5 Li k LLink Layer - ntut.edu.tw

CSMA (carrier sense multiple access)CSMA (carrier sense multiple access)

CSMA listen before transmitif channel sensed idle transmit entire frame if channel sensed busy defer transmission

human analogy donrsquot interrupt others

Link Layer 5-27

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

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

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

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

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

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

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

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

transparent hosts are unaware of presence of switchesp

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

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

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

Link Layer 5-82

f f p

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

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

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

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

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

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

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

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 28: Chapter 5 Li k LLink Layer - ntut.edu.tw

CSMA collisionsCSMA collisions

lli i ill

spatial layout of nodes

collisions can still occur propagation delay means two nodes may not hear yeach otherrsquos transmission

collision entire packet collision entire packet transmission time wasted distance amp propagation

delay play role in in determining collision probabilityprobability

Link Layer 5-28

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

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

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

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

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

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

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

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

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

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

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

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

111111111110111 111 111 112

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

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 29: Chapter 5 Li k LLink Layer - ntut.edu.tw

CSMACD (collision detection)CSMACD (collision detection)

CSMACD carrier sensing deferral as in CSMACSMACD carrier sensing deferral as in CSMA collisions detected within short time colliding transmissions aborted reducing channel wastage colliding transmissions aborted reducing channel wastage

collision detection easy in wired LANs measure signal strengths compare y g g p

transmitted received signals difficult in wireless LANs received signal strength

h l d b l l t i i t th overwhelmed by local transmission strength

Link Layer 5-29

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

1A 2F BB 76 09 AD eg 1A-2F-BB-76-09-AD

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

1A-2F-BB-76-09-AD

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

0C-C4-11-6F-E3-98

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 30: Chapter 5 Li k LLink Layer - ntut.edu.tw

CSMACD (collision detection)CSMACD (collision detection)

ti l l t f dspatial layout of nodes

Link Layer 5-30

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

1A 2F BB 76 09 AD eg 1A-2F-BB-76-09-AD

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

1A-2F-BB-76-09-AD

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

0C-C4-11-6F-E3-98

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 31: Chapter 5 Li k LLink Layer - ntut.edu.tw

Ethernet CSMACD algorithmthernet CSMAC algorithm

1 NIC receives datagram 4 If NIC detects another 1 NIC receives datagram from network layer creates frame

4 If NIC detects another transmission while transmitting aborts and

2 If NIC senses channel idle starts frame transmission If NIC

gsends jam signal

5 After aborting NIC bi ( p i l) transmission If NIC

senses channel busy waits until channel idle

enters binary (exponential) backoff after mth collision NIC

then transmits3 If NIC transmits entire

f i h d i

after mth collision NIC chooses K at random from 012 hellip 2m-1 NIC waits K512 bit frame without detecting

another transmission NIC is done with frame

NIC waits K 512 bit times returns to Step 2

longer backoff interval

Link Layer 5-31

NIC is done with frame gwith more collisions

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

1A 2F BB 76 09 AD eg 1A-2F-BB-76-09-AD

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

1A-2F-BB-76-09-AD

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

0C-C4-11-6F-E3-98

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 32: Chapter 5 Li k LLink Layer - ntut.edu.tw

CSMACD efficiencyCSMACD efficiency

T d l b 2 d i LAN Tprop = max prop delay between 2 nodes in LAN ttrans = time to transmit max-size frame

efficiency 1

efficiency goes to 1 as t goes to 0

transprop ttff y

51

as tprop goes to 0 as ttrans goes to infinity

better performance than ALOHA and simple cheap better performance than ALOHA and simple cheap decentralized

Link Layer 5-32

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

1A 2F BB 76 09 AD eg 1A-2F-BB-76-09-AD

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

1A-2F-BB-76-09-AD

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

0C-C4-11-6F-E3-98

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 33: Chapter 5 Li k LLink Layer - ntut.edu.tw

ldquoTaking turnsrdquo MAC protocolsTaking turns MAC protocols

h l i i i MAC lchannel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access 1N inefficient at low load delay in channel access 1N

bandwidth allocated even if only 1 active node random access MAC protocolsrandom access MAC protocols efficient at low load single node can fully utilize

channel high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Link Layer 5-33

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

1A 2F BB 76 09 AD eg 1A-2F-BB-76-09-AD

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

1A-2F-BB-76-09-AD

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

0C-C4-11-6F-E3-98

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 34: Chapter 5 Li k LLink Layer - ntut.edu.tw

ldquoTaking turnsrdquo MAC protocols

polling

Taking turns MAC protocols

polling master node ldquoinvitesrdquo

slave nodes to transmit d tin turn

typically used with ldquod brdquo l d i master

polldata

dumb slave devices concerns polling overhead

masterdata

polling overhead latency single point of slavesg p

failure (master)

Link Layer 5-34

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

1A 2F BB 76 09 AD eg 1A-2F-BB-76-09-AD

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

1A-2F-BB-76-09-AD

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

0C-C4-11-6F-E3-98

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 35: Chapter 5 Li k LLink Layer - ntut.edu.tw

ldquoTaking turnsrdquo MAC protocolstoken passing

Taking turns MAC protocolstoken passing control token passed

from one node to next

T

sequentially token message (nothing concerns token overhead latency

to send)T

latency single point of failure

(token)

Link Layer 5-35

data

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

1A 2F BB 76 09 AD eg 1A-2F-BB-76-09-AD

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

1A-2F-BB-76-09-AD

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

0C-C4-11-6F-E3-98

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 36: Chapter 5 Li k LLink Layer - ntut.edu.tw

Cable access network (Brief) ( )Internet framesTV channels control transmitted

downstream at different frequencies

cable headend

CMTS

cablemodemsplitter

hellip

ISP

cable modemtermination system

modemhellip

upstream Internet frames TV control transmitted

multiple 40Mbps downstream (broadcast) channels

p upstream at different frequencies in time slots

p p ( ) single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access all users contend for certain upstream

channel time slots (others assigned)

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

1A 2F BB 76 09 AD eg 1A-2F-BB-76-09-AD

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

1A-2F-BB-76-09-AD

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

0C-C4-11-6F-E3-98

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 37: Chapter 5 Li k LLink Layer - ntut.edu.tw

Cable access network (Brief)MAP frame forInterval [t1 t2]

cable headend

( )

Interval [t1 t2]

Downstream channel i

Upstream channel j

CMTS

Residences with cable modemst1 t2

DOCSIS data over cable service interface spec

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

DOCSIS data over cable service interface spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention TDM upstream some slots assigned some have contention downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted

Link Layer 5-37

q p ( )random access (binary backoff) in selected slots

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

1A 2F BB 76 09 AD eg 1A-2F-BB-76-09-AD

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

1A-2F-BB-76-09-AD

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

0C-C4-11-6F-E3-98

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 38: Chapter 5 Li k LLink Layer - ntut.edu.tw

Summary of MAC protocolsSummary of MAC protocols

h l p i i i b i f d channel partitioning by time frequency or code Time Division Frequency Division

random access (dynamic) random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard

in others (wireless) CSMACD used in Ethernet CSMACA d i 802 11 CSMACA used in 80211

taking turns polling from central site token passingpolling from central site token passing bluetooth FDDI token ring

Link Layer 5-38

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

1A 2F BB 76 09 AD eg 1A-2F-BB-76-09-AD

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

1A-2F-BB-76-09-AD

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

0C-C4-11-6F-E3-98

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 39: Chapter 5 Li k LLink Layer - ntut.edu.tw

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-39

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

1A 2F BB 76 09 AD eg 1A-2F-BB-76-09-AD

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

1A-2F-BB-76-09-AD

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

0C-C4-11-6F-E3-98

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 40: Chapter 5 Li k LLink Layer - ntut.edu.tw

MAC addresses and ARPMAC addresses and ARP

32 bi IP dd 32-bit IP address network-layer address for interface used for layer 3 (network layer) forwarding used for layer 3 (network layer) forwarding

MAC (or LAN or physical or Ethernet) address function used lsquolocallyrdquo to get frame from one interface to function used locally to get frame from one interface to

another physically-connected interface (same network in IP-addressing sense)

48 bit MAC address (for most LANs) burned in NIC ROM also sometimes software settable

1A 2F BB 76 09 AD eg 1A-2F-BB-76-09-AD

hexadecimal (base 16) notation( h ldquo b rdquo t 4 bit )

Link Layer 5-40

(each ldquonumberrdquo represents 4 bits)

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

1A-2F-BB-76-09-AD

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

0C-C4-11-6F-E3-98

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 41: Chapter 5 Li k LLink Layer - ntut.edu.tw

LAN addresses and ARPLAN addresses and ARPeach adapter on LAN has unique LAN addressp q

1A-2F-BB-76-09-AD

adapterLAN

(wired ori l )

58-23-D7-FA-20-B071-65-F7-2B-08-53

wireless)

0C-C4-11-6F-E3-98

Link Layer 5-41

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 42: Chapter 5 Li k LLink Layer - ntut.edu.tw

LAN addresses (more)LAN addresses (more)

MAC dd ll i d i i d b IEEE MAC address allocation administered by IEEE manufacturer buys portion of MAC address space

(t i )(to assure uniqueness) analogy MAC dd lik S i l S it N b MAC address like Social Security Number IP address like postal address

MAC flat address portability MAC flat address portability can move LAN card from one LAN to another

IP hierarchical address not portable IP hierarchical address not portable address depends on IP subnet to which node is

attached

Link Layer 5-42

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 43: Chapter 5 Li k LLink Layer - ntut.edu.tw

ARP address resolution protocolARP address resolution protocol

Question how to determine

ARP table each IP node (host t ) LAN h t bl

interfacersquos MAC address knowing its IP address

router) on LAN has table IPMAC address

mappings for some LAN 137196778

pp gnodes

lt IP address MAC address TTLgt

TTL (Time To Live)

1A-2F-BB-76-09-AD137196723

137196714 TTL (Time To Live)

time after which address mapping will be f ( i ll 20 58-23-D7-FA-20-B0

71-65-F7-2B-08-53

LAN

forgotten (typically 20 min)

58 23 D7 FA 20 B0

0C-C4-11-6F-E3-98137 196 7 88

Link Layer 5-43

137196788

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 44: Chapter 5 Li k LLink Layer - ntut.edu.tw

ARP protocol same LANp A wants to send datagram

t Bto B Brsquos MAC address not in

Arsquos ARP table A caches (saves) IP-to-

MAC address pair in its A broadcasts ARP query

packet containing Bs IP address

ARP table until information becomes old (times out)address

dest MAC address = FF-FF-FF-FF-FF-FF

all nodes on LAN receive

( ) soft state information that

times out (goes away) unless refreshed all nodes on LAN receive

ARP query B receives ARP packet

li A i h i (B )

ARP is ldquoplug-and-playrdquo nodes create their ARP

tables without intervention replies to A with its (Bs) MAC address frame sent to Arsquos MAC

tables without intervention from net administrator

Link Layer 5-44

address (unicast)

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 45: Chapter 5 Li k LLink Layer - ntut.edu.tw

Addressing routing to another LANwalkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame)

g g

focus on addressing at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R assume A knows Rrsquos MAC address

A BR

11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221

Link Layer 5-45

E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D111111111112 222222222221

88-B2-2F-54-1A-0F

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 46: Chapter 5 Li k LLink Layer - ntut.edu.tw

Addressing routing to another LANg g A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4B

IP

IP src 111111111111IP dest 222222222222

MAC dest E6-E9-00-17-BB-4B

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-46

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 47: Chapter 5 Li k LLink Layer - ntut.edu.tw

Addressing routing to another LANg g frame sent from A to R frame received at R datagram removed passed up to IP g p p

MAC src 74-29-9C-E8-FF-55MAC dest E6 E9 00 17 BB 4BIP src 111 111 111 111

IP IP

MAC dest E6-E9-00-17-BB-4BIP src 111111111111

IP dest 222222222222

IP src 111111111111IP dest 222222222222

A B

EthPhy

IPEthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-47

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 48: Chapter 5 Li k LLink Layer - ntut.edu.tw

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-48

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 49: Chapter 5 Li k LLink Layer - ntut.edu.tw

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

MAC src 1A-23-F9-CD-06-9BMAC d t 49 BD D2 C7 56 2A

IP src 111111111111IP dest 222222222222

MAC dest 49-BD-D2-C7-56-2A

IPIPEth

A B

IPEthPhy

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-49

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 50: Chapter 5 Li k LLink Layer - ntut.edu.tw

Addressing routing to another LANg g R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame y

contains A-to-B IP datagram

IP src 111 111 111 111

MAC src 1A-23-F9-CD-06-9BMAC dest 49-BD-D2-C7-56-2A

IP src 111111111111IP dest 222222222222

IPEth

A B

EthPhy

R11111111111174-29-9C-E8-FF-55

A

22222222222249 BD D2 C7 56 2A

B

1A-23-F9-CD-06-9B222222222220

111111111110111 111 111 112

49-BD-D2-C7-56-2A

222222222221E6-E9-00-17-BB-4BCC-49-DE-D0-AB-7D

111111111112 22222222222188-B2-2F-54-1A-0F

Link Layer 5-50

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 51: Chapter 5 Li k LLink Layer - ntut.edu.tw

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-51

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 52: Chapter 5 Li k LLink Layer - ntut.edu.tw

Ethernetldquodominantrdquo wired LAN technology cheap $20 for NIC first widely used LAN technology i l h th t k LAN d ATM simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps

Link Layer 5-52

Metcalfersquos Ethernet sketch

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 53: Chapter 5 Li k LLink Layer - ntut.edu.tw

Ethernet physical topologyp y p gy bus popular through mid 90s all nodes in same collision domain (can collide with each all nodes in same collision domain (can collide with each

other) star prevails today

h active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

d t llid ith h th )do not collide with each other)

switchstar

Link Layer 5-53

bus coaxial cablestar

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 54: Chapter 5 Li k LLink Layer - ntut.edu.tw

Ethernet frame structure

di d l IP d ( h sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

type

destaddress

sourceaddress

data (payload) CRCpreamble

type

preamble 7 bytes with pattern 10101010 followed by one 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011 used to synchronize receiver sender clock rates used to synchronize receiver sender clock rates

Link Layer 5-54

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 55: Chapter 5 Li k LLink Layer - ntut.edu.tw

Ethernet frame structure (more)Ethernet frame structure (more) addresses 6 byte source destination MAC addressesy if adapter receives frame with matching destination

address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolpasses data in frame to network layer protocol

otherwise adapter discards frame type indicates higher layer protocol (mostly IP but type indicates higher layer protocol (mostly IP but

others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver CRC cyclic redundancy check at receiver error detected frame is dropped

t

destaddress

sourceaddress

data (payload) CRCpreamble

type

Link Layer 5-55

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 56: Chapter 5 Li k LLink Layer - ntut.edu.tw

Ethernet unreliable connectionlessEthernet unreliable connectionless

i l h d h ki b di d connectionless no handshaking between sending and receiving NICs

eliable i i NIC d t d k k unreliable receiving NIC does not send acks or nacksto sending NIC data in dropped frames recovered only if initial data in dropped frames recovered only if initial

sender uses higher layer rdt (eg TCP) otherwise dropped data lostpp

Ethernetrsquos MAC protocol unslotted CSMACD wthbinary backoffy ff

Link Layer 5-56

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 57: Chapter 5 Li k LLink Layer - ntut.edu.tw

8023 Ethernet standards link amp physical layersp y y

many different Ethernet standardsy common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps

10G bps different physical layer media fiber cable

MAC protocolapplicationtransportnetwork

li k

MAC protocoland frame format

100BASE-TX 100BASE-FX100BASE-T2link

physical100BASE-T4 100BASE-SX 100BASE-BX

Link Layer 5-57

fiber physical layercopper (twisterpair) physical layer

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 58: Chapter 5 Li k LLink Layer - ntut.edu.tw

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-58

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 59: Chapter 5 Li k LLink Layer - ntut.edu.tw

Ethernet switch link-layer device takes an active role store forward Ethernet frames store forward Ethernet frames examine incoming framersquos MAC address

selectively forward frame to one-or-more selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segmentg g

transparent hosts are unaware of presence of switchesp

plug-and-play self-learning switches do not need to be configuredswitches do not need to be configured

Link Layer 5-59

Switch multiple simultaneous transmissionsSwitch multiple simultaneous transmissions

hosts have dedicated direct Aconnection to switch

switches buffer packets BCrsquo

Ethernet protocol used on eachincoming link but no collisions full duplex

1 2

345

6

full duplex each link is its own collision

domain Brsquo C

345

switching A-to-Arsquo and B-to-Brsquocan transmit simultaneously without collisions

Arsquowithout collisions switch with six interfaces

(123456)

Link Layer 5-60

Switch forwarding tableg

Q how does switch know Arsquo AQ how does switch know Areachable via interface 4 Brsquoreachable via interface 5 BCrsquo

1 2

345

6 A each switch has a switch table each entry

Brsquo C

345 (MAC address of host interface to reach host time stamp)

Arsquo looks like a routing table

Q h t i t d switch with six interfaces(123456)

Q how are entries created maintained in switch table something like a routing protocol

Link Layer 5-61

something like a routing protocol

Switch self-learning Source A

A

Switch self learning switch learns which hosts A Arsquo

Dest Arsquo

BCrsquo

1 2

can be reached through which interfaces when frame received 1 2

345

6when frame received switch ldquolearnsrdquolocation of sender incoming LAN segment

Brsquo Cincoming LAN segment

records senderlocation pair in switch table

Arsquo

p

MAC addr interface TTLMAC addr interface TTLSwitch table

(initially empty)A 1 60

Link Layer 5-62

Switch frame filteringforwardingg g

when frame received at switch

1 record incoming link MAC address of sending host2 index switch table using MAC destination address3 if entry found for destination

then then if destination on segment from which frame arrived

then drop framepelse forward frame on interface indicated by entry

else flood forward on all interfaces except arriving

interface

Link Layer 5-63

Self-learning forwarding example Source A

A

Self learning forwarding exampleA Arsquo

Dest Arsquo

frame destination Arsquo BCrsquo

1 2

frame destination A locaton unknown flood

d A l 1 2

345

6

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo destination A location

known selectively send

Brsquo C

Arsquo A

on just one link

Arsquo

MAC addr interface TTLMAC addr interface TTLswitch table

(initially empty)A 1 60Arsquo 4 60

Link Layer 5-64

Interconnecting switchesg

switches can be connected togetherg

S

S4

A

B

S1

C DF

S2

S3

IB C D

E HI

G

Q sending from A to G - how does S1 know to forward frame destined to F via S and S forward frame destined to F via S4 and S3 A self learning (works exactly the same as in

single-switch case)

Link Layer 5-65

single switch case)

Institutional networkInstitutional network

to externalnetwork

mail server

networkrouter web server

IP subnet

Link Layer 5-66

Switches vs routers

both are store-and-forward applicationtransportnetworkdatagram

routers network-layer devices (examine network-layer headers)

networklink

physical linkh i l

datagramframe

framelayer headers)switches link-layer devices (examine link-layer headers)

physical

switch

both have forwarding tablesrouters compute tables using

networklink

h i lframe

datagram

p grouting algorithms IP addressesswitches learn forwarding

physical

applicationtransportswitches learn forwarding

table using flooding learning MAC addresses

transportnetwork

linkphysical

Link Layer 5-67

physical

VLANs motivationVLANs motivationconsider CS user moves office to

EE but wants connect to CS switchCS switch

single broadcast domain all layer-2 broadcast all layer 2 broadcast

traffic (ARP DHCP unknown location of destination MAC

Computer S i

Computer destination MAC address) must cross entire LAN

Science ElectricalEngineering

ComputerEngineering

securityprivacy efficiency issues

Link Layer 5-68

VLANsport-based VLAN switch ports

grouped (by switch management VLANs grouped (by switch management software) so that single physical switch helliphellip

Virtual Local

switch(es) supporting

Virtual Local Area Network 1

8

9

16102

7 15

switch(es) supporting VLAN capabilities can be configured to d fi lti l i t l

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

define multiple virtualLANS over single physical LAN

(VLAN ports 1-8) (VLAN ports 9-15)

hellip operates as multiple virtual switchesp yinfrastructure

1

82

7 9

1610

15

Electrical Engineering

hellip hellip

Computer Science

Link Layer 5-69

Electrical Engineering(VLAN ports 1-8)

Computer Science(VLAN ports 9-16)

Port-based VLANPort-based VLAN traffic isolation frames tofrom

1 8 l h

router

ports 1-8 can only reach ports 1-8 can also define VLAN based on

1

8

9

16102

7 15

MAC addresses of endpoints rather than switch port

d i b hip t hellip

Electrical Engineering Computer Science

hellip dynamic membership ports

can be dynamically assigned among VLANs ec ca g ee g

(VLAN ports 1-8)p

(VLAN ports 9-15)

forwarding between VLANS done via routing (just as with separate g (j pswitches) in practice vendors sell combined

switches plus routers

Link Layer 5-70

switches plus routers

VLANS spanning multiple switchesVLANS spanning multiple switches

1

8

9

102

7 15

2

73 5

4 6 816

1

hellip

Electrical Engineering(VLAN ports 1 8)

Computer Science(VLAN ports 9 15)

hellip

Ports 235 belong to EE VLANPorts 4 6 7 8 belong to CS VLAN

trunk port carries frames between VLANS defined over

(VLAN ports 1-8) (VLAN ports 9-15) Ports 4678 belong to CS VLAN

pmultiple physical switches frames forwarded within VLAN between switches must carry VLAN

ID infoID info 8021q protocol addsremoved additional header fields for frames

forwarded between trunk ports

Link Layer 5-71

802 1Q VLAN frame formattype

8021Q VLAN frame format

8021 framedest

addresssourceaddress data (payload) CRCpreamble

8021Q framedestaddress

sourceaddresspreamble data (payload) CRC

type

2-byte Tag Protocol Identifier Recomputedy g(value 81-00)

Recomputed CRC

Tag Control Information (12 bit VLAN ID field 3 bit priority field like IP TOS)

Link Layer 5-72

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS (omission)

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-73

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-74

Data center networks

10rsquos to 100rsquos of thousands of hosts often closely ycoupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)

challenges multiple applications each

i i b f serving massive numbers of clients

managingbalancing load g g g avoiding processing networking data bottlenecks

Link Layer 5-75

Inside a 40-ft Microsoft container Chicago data center

Data center networks load balancer application-layer routing receives external client requests

Internet

receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

dBorder router

Internet center internals from client)

Tier‐1 switches

Load balancer

Load balancer

B

Access router

Tier‐2 switches

B

A C

Server racks

TOR switches

Link Layer 5-76

1 2 3 4 5 6 7 8

Data center networks rich interconnection among switches racks increased throughput between racks (multiple routing

paths possible)i d li bili i d d increased reliability via redundancy

Tier‐1 switches

Tier‐2 switches

Server racks

TOR switches

1 2 3 4 5 6 7 8

Link layer LANs outlineLink layer LANs outline

5 1 i d i i 5 5 li k i li i 51 introduction services52 error detection

ti

55 link virtualization MPLS

5 6 d t t correction 53 multiple access

protocols

56 data center networking

5 7 a day in the life of a protocols54 LANs addressing ARP

57 a day in the life of a web request

addressing ARP Ethernet switchesswitches VLANS

Link Layer 5-78

Synthesis a day in the life of a web requestSynthesis a day in the life of a web request

journey down protocol stack completej y p p application transport network link

putting-it-all-together synthesisp g g y goal identify review understand protocols (at all

layers) involved in seemingly simple scenario requesting www pagerequesting www page

scenario student attaches laptop to campus network requestsreceives wwwgooglecom

Link Layer 5-79

A day in the life scenario

DNS serverbrowser

Comcast network 68800013

school network 68802024

web page

G l rsquo t kweb server Googlersquos network 64233160019 64233169105

web server

Link Layer 5-80

A day in the lifehellip connecting to the Internet

connecting laptop needs to get its own IP address addr

DHCPUDP

IP

DHCP

DHCP gof first-hop router addr of DNS server use DHCP

IPEthPhy

DHCP

DHCP

DHCP

DHCPUDP

DHCPDHCP

DHCP request encapsulatedin UDP encapsulated in IP encapsulated in 8023

router(runs DHCP)

UDPIPEthPhy

DHCP

DHCP

DHCP

encapsulated in 8023Ethernet

Ethernet frame broadcastPhy(dest FFFFFFFFFFFF) on LAN received at router running DHCP serverDHCP server

Ethernet demuxed to IP demuxed UDP demuxed to

Link Layer 5-81

DHCP

A day in the lifehellip connecting to the Internet

DHCP server formulates DHCP ACK containing l rsquo IP dd IP

DHCPUDP

IPDHCP

DHCP

DHCP

clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server

IPEthPhy

DHCP

DHCP

address of DNS server

DHCPUDP

DHCP

encapsulation at DHCP server frame forwarded (switch learning) through

router(runs DHCP)

DHCP

DHCP

DHCP

UDPIPEthPhy

(switch learning) through LAN demultiplexing at client

DHCP client receives DHCPPhy DHCP client receives

DHCP ACK reply

Client now has IP address knows name amp addr of DNS server IP address of its first-hop router

Link Layer 5-82

f f p

A day in the lifehellip ARP (before DNS before HTTP)

before sending HTTP request need IP address of wwwgooglecom DNS

DNSUDP

IP

DNS

DNS

DNS DNSIPEthPhy

DNS

DNS query created encapsulated in UDP encapsulated in IP

ARP queryARP

UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARPEth

ARPARP reply

router(runs DHCP)

router interface ARP

ARP query broadcast received by router which replies with ARP

Phy

preply giving MAC address of router interfaceli t k MAC dd client now knows MAC address

of first hop router so can now send frame containing DNS

Link Layer 5-83

query

DNSDNSUDPDNS

A day in the lifehellip using DNS

DNSUDP

IP

DNS

DNS

DNS

DNS serverUDPIPEthPhy

DNS

DNS

DNS

DNS

IPEthPhy

DNS

DNS

DNSComcast network 68800013

router(runs DHCP)

IP datagram forwarded from campus network into comcast

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop

pnetwork routed (tables created by RIP OSPF IS-IS andor BGProuting protocols) to DNS serverswitch from client to 1st hop

routerrouting protocols) to DNS server

demuxrsquoed to DNS server DNS server replies to client

Link Layer 5-84

pwith IP address of wwwgooglecom

A day in the lifehellipTCP connection carrying HTTP

HTTPTCPIP

HTTP

SYN

SYN

SYNACK

SYNACK IPEthPhy

SYN

SYN

SYN

SYNACK

SYNACK

to send HTTP request client first opens TCP socket

router(runs DHCP)

client first opens TCP socketto web server

TCP SYN segment (step 1 in 3-way handshake) inter domain way handshake) inter-domain routed to web server

SYN

SYN

SYN

TCPIPEthPhy

SYNACK

SYNACK

SYNACKSYNACK

web server responds with TCP

TCP i bli h d64 233 169 105web server

Phy web server responds with TCP SYNACK (step 2 in 3-way handshake)

Link Layer 5-85

TCP connection established64233169105

A day in the lifehellip HTTP requestreply HTTPTCPIP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP web page finally () displayed

IPEthPhy

HTTP

HTTPHTTP

HTTP

HTTP

HTTP request sent into TCP

router(runs DHCP)

socket

IP datagram containing HTTP request routed to HTTPHTTP request routed to wwwgooglecom

TCPIPEthPhy

web server responds with HTTP pl ( t i i b

HTTP

HTTP

HTTPHTTP

IP datagram containing HTTP 64 233 169 105web server

Phy HTTP reply (containing web page)

Link Layer 5-86

g greply routed back to client

64233169105

Chapter 5 SummaryChapter 5 Summary principles behind data link layer servicesp p y error detection correction sharing a broadcast channel multiple access link layer addressing

instantiation and implementation of various link l h llayer technologies Ethernet it h d LANS VLAN switched LANS VLANs virtualized networks as a link layer MPLS

synthesis a day in the life of a web request synthesis a day in the life of a web request

Link Layer 5-87

Chapter 5 letrsquos take a breathC apte 5 et s ta e a b eat

journey down protocol stack complete (except j y p p ( pPHY)

solid understanding of networking principles g g p ppractice

hellip could stop here hellip but lots of interesting topics wireless

l i di multimedia security network management network management

Link Layer 5-88

Page 60: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 61: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 62: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 63: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 64: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 65: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 66: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 67: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 68: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 69: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 70: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 71: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 72: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 73: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 74: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 75: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 76: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 77: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 78: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 79: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 80: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 81: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 82: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 83: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 84: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 85: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 86: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 87: Chapter 5 Li k LLink Layer - ntut.edu.tw
Page 88: Chapter 5 Li k LLink Layer - ntut.edu.tw