96
Computer Networks Shyam Gollakota

Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

ComputerNetworksShyamGollakota

Page 2: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

ComputerNetworks 2

ProtocolsandLayers•  Protocolsandlayeringisthemainstructuringmethodusedtodivideupnetworkfunctionality–  Eachinstanceofaprotocoltalksvirtuallytoitspeerusingtheprotocol

–  Eachinstanceofaprotocolusesonlytheservicesofthelowerlayer

Page 3: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

ProtocolsandLayers(3)•  Protocolsarehorizontal,layersarevertical

ComputerNetworks 3

X

YY

XInstanceofprotocolX

Peerinstance

Node1 Node2

Lowerlayerinstance(ofprotocolY)

ProtocolX

ServiceprovidedbyProtocolY

Page 4: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

ProtocolsandLayers(4)•  Setofprotocolsinuseiscalledaprotocolstack

ComputerNetworks 4

Page 5: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

ComputerNetworks 5

ProtocolsandLayers(6)•  Protocolsyou’veprobablyheardof:

–  TCP,IP,802.11,Ethernet,HTTP,SSL,DNS,…andmanymore

•  Anexampleprotocolstack–  UsedbyawebbrowseronahostthatiswirelesslyconnectedtotheInternet

HTTP

TCP

IP

802.11

Browser

Page 6: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

ComputerNetworks 6

Encapsulation•  Encapsulationisthemechanismusedtoeffectprotocollayering–  Lowerlayerwrapshigherlayercontent,addingitsowninformationtomakeanewmessagefordelivery

–  Likesendingaletterinanenvelope;postalservicedoesn’tlookinside

Page 7: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

Encapsulation(3)•  Message“onthewire”beginstolooklikeanonion

–  Lowerlayersareoutermost

ComputerNetworks 7

HTTP

TCP

IP

802.11

HTTP

TCP HTTP

TCP HTTPIP

TCP HTTPIP802.11

Page 8: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

Encapsulation(4)

ComputerNetworks 8

HTTP

TCP

IP

802.11

HTTP

TCP HTTP

TCP HTTPIP

TCP HTTPIP802.11

HTTP

TCP

IP

802.11(wire)

HTTP

TCP HTTP

TCP HTTPIP

TCP HTTPIP802.11

TCP HTTPIP802.11

Page 9: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

AdvantageofLayering•  Informationhidingandreuse

ComputerNetworks 9

HTTP

Browser

HTTP

Server

HTTP

Browser

HTTP

Server

or

Page 10: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

AdvantageofLayering(2)•  Informationhidingandreuse

ComputerNetworks 10

HTTP

TCP

IP

802.11

Browser

HTTP

TCP

IP

802.11

Server

HTTP

TCP

IP

Ethernet

Browser

HTTP

TCP

IP

Ethernet

Server

or

Page 11: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

AdvantageofLayering(3)•  Usinginformationhidingtoconnectdifferentsystems

ComputerNetworks 11

HTTP

TCP

IP

802.11

Browser

HTTP

TCP

IPEthernet

Server

Page 12: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

AdvantageofLayering(4)•  Usinginformationhidingtoconnectdifferentsystems

ComputerNetworks 12

HTTP

TCP

IP

802.11

Browser

IP

802.11

IP

Ethernet

HTTP

TCP

IPEthernet

Server

IP TCP HTTP

802.11 IP TCP HTTP Ethernet IP TCP HTTP

Page 13: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

ComputerNetworks 13

DisadvantageofLayering•  ??

Page 14: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

InternetReferenceModel•  Afourlayermodelbasedonexperience;omitssomeOSIlayersandusesIPasthenetworklayer.

ComputerNetworks 14

4Application–Programsthatusenetworkservice3Transport–Providesend-to-enddatadelivery2Internet –Sendpacketsovermultiplenetworks

1Link –Sendframesoveralink

Page 15: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

InternetReferenceModel(3)•  IPisthe“narrowwaist”oftheInternet

–  Supportsmanydifferentlinksbelowandappsabove

ComputerNetworks 15

4Application3Transport

2Internet

1Link Ethernet802.11

IP

TCP UDP

HTTPSMTP RTP DNS

3GDSLCable

Page 16: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

ComputerNetworks 16

Layer-basedNames(2)•  Fordevicesinthenetwork:

NetworkLink

NetworkLink

Link Link

Physical PhysicalRepeater(orhub)

Switch(orbridge)

Router

Page 17: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

ComputerNetworks 17

Layer-basedNames(3)•  Fordevicesinthenetwork:

Proxyormiddleboxorgateway

NetworkLink

NetworkLink

AppTransport

AppTransport

Buttheyalllooklikethis!

Page 18: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

18

ScopeofthePhysicalLayer•  Concernshowsignalsareusedtotransfermessagebitsoveralink– Wiresetc.carryanalogsignals– Wewanttosenddigitalbits

…1011010110…

Signal

Page 19: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

SimpleLinkModel•  We’llendwithanabstractionofaphysicalchannel

–  Rate(orbandwidth,capacity,speed)inbits/second–  Delayinseconds,relatedtolength

•  Otherimportantproperties:– Whetherthechannelisbroadcast,anditserrorrate

19

DelayD,RateR

Message

Page 20: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

MessageLatency•  Latencyisthedelaytosendamessageoveralink

–  Transmissiondelay:timetoputM-bitmessage“onthewire”

–  Propagationdelay:timeforbitstopropagateacrossthewire

–  Combiningthetwotermswehave:

20

Page 21: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

MessageLatency(2)•  Latencyisthedelaytosendamessageoveralink

–  Transmissiondelay:timetoputM-bitmessage“onthewire”

T-delay=M(bits)/Rate(bits/sec)=M/Rseconds

–  Propagationdelay:timeforbitstopropagateacrossthewire

P-delay=Length/speedofsignals=Length/⅔c=Dseconds

–  Combiningthetwotermswehave:L=M/R+D

21

Page 22: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

22

MetricUnits•  Themainprefixesweuse:

•  Usepowersof10forrates,2forstorage–  1Mbps=1,000,000bps,1KB=210bytes

•  “B”isforbytes,“b”isforbits

Prefix Exp. prefix exp. K(ilo) 103 m(illi) 10-3

M(ega) 106 µ(micro) 10-6

G(iga) 109 n(ano) 10-9

Page 23: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

23

LatencyExamples(2)•  “Dialup”withatelephonemodem:

D=5ms,R=56kbps,M=1250bytes

L=5ms+(1250x8)/(56x103)sec=184ms!

•  Broadbandcross-countrylink:D=50ms,R=10Mbps,M=1250bytes

L=50ms+(1250x8)/(10x106)sec=51ms

•  Alonglinkoraslowratemeanshighlatency–  Often,onedelaycomponentdominates

Page 24: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

24

Bandwidth-DelayProduct•  Messagestakespaceonthewire!

•  Theamountofdatainflightisthebandwidth-delay(BD)product

BD=RxD– Measureinbits,orinmessages–  SmallforLANs,bigfor“longfat”pipes

Page 25: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

25

Bandwidth-DelayExample(2)•  Fiberathome,cross-country

R=40Mbps,D=50msBD=40x106x50x10-3bits

=2000Kbit=250KB

•  That’squitealotofdata“inthenetwork”!

110101000010111010101001011

Page 26: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

weightsofharmonicfrequenciesSignalovertime

=

FrequencyRepresentation•  Asignalovertimecanberepresentedbyitsfrequencycomponents(calledFourieranalysis)

26am

plitu

de

Page 27: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

Lost!

EffectofLessBandwidth•  Fewerfrequencies(=lessbandwidth)degradessignal

27

Lost!

27

Lost!Bandwidth

Page 28: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

SignalsoveraWire(2)•  Example:

28

2:Attenuation:

3:Bandwidth:

4:Noise:

Sentsignal

Page 29: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

29

SignalsoverWireless•  Signalstransmittedonacarrierfrequency,likefiber

•  Travelatspeedoflight,spreadoutandattenuatefasterthan1/dist2

•  Multiplesignalsonthesamefrequencyinterfereatareceiver

Page 30: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

30

SignalsoverWireless(5)•  Variousothereffectstoo!

– Wirelesspropagationiscomplex,dependsonenvironment

•  Somekeyeffectsarehighlyfrequencydependent,–  E.g.,multipathatmicrowavefrequencies

Page 31: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

WirelessMultipath•  Signalsbounceoffobjectsandtakemultiplepaths

–  Somefrequenciesattenuatedatreceiver,varieswithlocation– Messesupsignal;handledwithsophisticatedmethods(§2.5.3)

31

Page 32: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

32

Wireless•  Senderradiatessignaloveraregion

–  Inmanydirections,unlikeawire,topotentiallymanyreceivers

–  Nearbysignals(samefreq.)interfereatareceiver;needtocoordinateuse

Page 33: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

33

WiFi

WiFi

Page 34: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

Wireless(2)•  Microwave,e.g.,3G,andunlicensed(ISM)frequencies,e.g.,WiFi,arewidelyusedforcomputernetworking

34

802.11b/g/n

802.11a/g/n

Page 35: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

35

Topic•  We’vetalkedaboutsignalsrepresentingbits.How,exactly?–  Thisisthetopicofmodulation

…1011010110…

Signal

Page 36: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

ASimpleModulation•  Letahighvoltage(+V)representa1,andlowvoltage(-V)representa0– ThisiscalledNRZ(Non-ReturntoZero)

36

Bits

NRZ

0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0

+V

-V

Page 37: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

ASimpleModulation(2)•  Letahighvoltage(+V)representa1,andlowvoltage(-V)representa0– ThisiscalledNRZ(Non-ReturntoZero)

37

Bits

NRZ

0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0

+V

-V

Page 38: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

Modulation

38

NRZsignalofbits

Amplitudeshiftkeying

Frequencyshiftkeying

Phaseshiftkeying

Page 39: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

39

KeyChannelProperties•  Thebandwidth(B),signalstrength(S),andnoisestrength(N)–  Blimitstherateoftransitions–  SandNlimithowmanysignallevelswecandistinguish

BandwidthB SignalS,NoiseN

Page 40: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

40

ClaudeShannon(1916-2001)•  Fatherofinformationtheory

–  “AMathematicalTheoryofCommunication”,1948

•  Fundamentalcontributionstodigitalcomputers,security,andcommunications

Credit:CourtesyMITMuseum

Electromechanicalmousethat“solves”mazes!

Page 41: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

ShannonCapacity•  HowmanylevelswecandistinguishdependsonS/N

–  OrSNR,theSignal-to-NoiseRatio–  Notenoiseisrandom,hencesomeerrors

•  SNRgivenonalog-scaleindeciBels:–  SNRdB=10log10(S/N)

41

0

1

2

3

N

S+N

Page 42: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

42

ShannonCapacity(2)•  Shannonlimitisforcapacity(C),themaximuminformationcarryingrateofthechannel:

C=Blog2(1+S/(BN))bits/sec

Page 43: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

Wired/WirelessPerspective•  Wires,andFiber

– EngineerlinktohaverequisiteSNRandB→ Canfixdatarate

•  Wireless– GivenB,butSNRvariesgreatly,e.g.,upto60dB!→ Can’tdesignforworstcase,mustadaptdatarate

43

Page 44: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

Wired/WirelessPerspective(2)•  Wires,andFiber

– EngineerlinktohaverequisiteSNRandB→ Canfixdatarate

•  Wireless– GivenB,butSNRvariesgreatly,e.g.,upto60dB!→ Can’tdesignforworstcase,mustadaptdatarate

44

EngineerSNRfordatarate

AdaptdataratetoSNR

Page 45: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

Puttingitalltogether–DSL•  DSL(DigitalSubscriberLine)iswidelyusedforbroadband;manyvariantsoffer10sofMbps–  Reusestwistedpairtelephonelinetothehome;ithasupto~2MHzofbandwidthbutusesonlythelowest~4kHz

45

Page 46: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

DSL(2)•  DSLusespassbandmodulation(calledOFDM)

–  Separatebandsforupstreamanddownstream(larger)– Modulationvariesbothamplitudeandphase(calledQAM)–  HighSNR,upto15bits/symbol,lowSNRonly1bit/symbol

46

Upstream Downstream

26–138kHz

0-4kHz 143kHzto1.1MHz

Telephone

Freq.

Voice Upto1Mbps Upto12Mbps

ADSL2:

Page 47: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 47

Topic•  Somebitswillbereceivedinerrordue

tonoise.Whatcanwedo?–  Detecterrorswithcodes»–  Correcterrorswithcodes»–  Retransmitlostframes

•  Reliabilityisaconcernthatcutsacrossthelayers–we’llseeitagain

Later

Page 48: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

Problem–Noisemayflipreceivedbits

CSE461UniversityofWashington 48

Signal0 0 0 0

11 10

0 0 0 011 1

0

0 0 0 011 1

0

SlightlyNoisy

Verynoisy

Page 49: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 49

Approach–AddRedundancy•  Errordetectioncodes

–  Addcheckbitstothemessagebitstoletsomeerrorsbedetected

•  Errorcorrectioncodes–  Addmorecheckbitstoletsomeerrorsbecorrected

•  Keyissueisnowtostructurethecodetodetectmanyerrorswithfewcheckbitsandmodestcomputation

Page 50: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 50

MotivatingExample•  Asimplecodetohandleerrors:

–  Sendtwocopies!Errorifdifferent.

•  Howgoodisthiscode?–  Howmanyerrorscanitdetect/correct?–  Howmanyerrorswillmakeitfail?

Page 51: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 51

MotivatingExample(2)•  Wewanttohandlemoreerrorswithlessoverhead– Willlookatbettercodes;theyareappliedmathematics

–  But,theycan’thandleallerrors–  Andtheyfocusonaccidentalerrors(willlookatsecurehasheslater)

Page 52: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 52

UsingErrorCodes•  CodewordconsistsofDdataplusR

checkbits(=systematicblockcode)

•  Sender:–  ComputeRcheckbitsbasedontheDdatabits;sendthecodewordofD+Rbits

D R=fn(D)Databits Checkbits

Page 53: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 53

UsingErrorCodes(2)•  Receiver:

–  ReceiveD+Rbitswithunknownerrors–  RecomputeRcheckbitsbasedontheDdatabits;errorifRdoesn’tmatchR’

D R’Databits Checkbits

R=fn(D)=?

Page 54: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 54

IntuitionforErrorCodes•  ForDdatabits,Rcheckbits:

•  Randomlychosencodewordisunlikelytobecorrect;overheadislow

AllcodewordsCorrect

codewords

Page 55: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 55

R.W.Hamming(1915-1998)•  Muchearlyworkoncodes:

–  “ErrorDetectingandErrorCorrectingCodes”,BSTJ,1950

•  Seealso:–  “YouandYourResearch”,1986

Source:IEEEGHN,©2009IEEE

Page 56: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 56

HammingDistance•  DistanceisthenumberofbitflipsneededtochangeD1toD2

•  Hammingdistanceofacodeistheminimumdistancebetweenanypairofcodewords

Page 57: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 57

HammingDistance(2)•  Errordetection:

–  Foracodeofdistanced+1,uptoderrorswillalwaysbedetected

Page 58: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 58

HammingDistance(3)•  Errorcorrection:

–  Foracodeofdistance2d+1,uptoderrorscanalwaysbecorrectedbymappingtotheclosestcodeword

Page 59: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 59

Topic•  Somebitsmaybereceivedinerror

duetonoise.Howdowedetectthis?–  Parity»–  Checksums»–  CRCs»

•  Detectionwillletusfixtheerror,forexample,byretransmission(later).

Page 60: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 60

SimpleErrorDetection–ParityBit•  TakeDdatabits,add1checkbitthatisthesumoftheDbits–  Sumismodulo2orXOR

Page 61: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 61

ParityBit(2)•  Howwelldoesparitywork?

– Whatisthedistanceofthecode?–  Howmanyerrorswillitdetect/correct?

•  Whataboutlargererrors?

Page 62: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 62

Checksums•  Idea:sumupdatainN-bitwords

– Widelyusedin,e.g.,TCP/IP/UDP

•  Strongerprotectionthanparity

1500bytes 16bits

Page 63: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 63

InternetChecksum•  Sumisdefinedin1scomplementarithmetic(mustaddbackcarries)–  Andit’sthenegativesum

•  “Thechecksumfieldisthe16bitone'scomplementoftheone'scomplementsumofall16bitwords…”–RFC791

Page 64: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 64

InternetChecksum(2)Sending:1. Arrangedatain16-bitwords

2. Putzeroinchecksumposition,add

3. Addanycarryoverbacktoget16bits

4. Negate(complement)togetsum

0001 f203 f4f5 f6f7

+(0000) ------ 2ddf0

ddf0

+ 2 ------ ddf2

220d

Page 65: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 65

InternetChecksum(3)Sending:1. Arrangedatain16-bitwords2. Putzeroinchecksumposition,add

3. Addanycarryoverbacktoget16bits

4. Negate(complement)togetsum

0001 f203 f4f5 f6f7

+(0000) ------ 2ddf0

ddf0

+ 2 ------ ddf2

220d

Page 66: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 66

InternetChecksum(4)Receiving:1. Arrangedatain16-bitwords2. Checksumwillbenon-zero,add

3. Addanycarryoverbacktoget16bits

4. Negatetheresultandcheckitis0

0001 f203 f4f5 f6f7

+ 220d ------ 2fffd

fffd

+ 2 ------ ffff

0000

Page 67: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 67

InternetChecksum(5)Receiving:1. Arrangedatain16-bitwords2. Checksumwillbenon-zero,add

3. Addanycarryoverbacktoget16bits

4. Negatetheresultandcheckitis0

0001 f203 f4f5 f6f7

+ 220d ------ 2fffd

fffd

+ 2 ------ ffff

0000

Page 68: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 68

InternetChecksum(6)•  Howwelldoesthechecksumwork?

– Whatisthedistanceofthecode?–  Howmanyerrorswillitdetect/correct?

•  Whataboutlargererrors?

Page 69: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 69

CyclicRedundancyCheck(CRC)•  Evenstrongerprotection

–  Givenndatabits,generatekcheckbitssuchthatthen+kbitsareevenlydivisiblebyageneratorC

•  Examplewithnumbers:–  n=302,k=onedigit,C=3

Page 70: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 70

CRCs(2)•  Thecatch:

–  It’sbasedonmathematicsoffinitefields,inwhich“numbers”representpolynomials

–  e.g,10011010isx7+x4+x3+x1

•  Whatthismeans:– Weworkwithbinaryvaluesandoperateusingmodulo2arithmetic

Page 71: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 71

CRCs(3)•  SendProcedure:1.  Extendthendatabitswithkzeros2.  DividebythegeneratorvalueC3.  Keepremainder,ignorequotient4.  Adjustkcheckbitsbyremainder

•  ReceiveProcedure:1.  Divideandcheckforzeroremainder

Page 72: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CRCs(4)

CSE461UniversityofWashington 72

Databits:1101011111

Checkbits:C(x)=x4+x1+1C=10011

k=4

100111101011111

Page 73: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CRCs(5)

CSE461UniversityofWashington 73

Page 74: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 74

CRCs(6)•  Protectiondependongenerator

–  StandardCRC-32is100000100110000010001110110110111

•  Properties:–  HD=4,detectsuptotriplebiterrors–  Alsooddnumberoferrors–  Andburstsofuptokbitsinerror–  Notvulnerabletosystematicerrorslikechecksums

Page 75: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 75

ErrorDetectioninPractice•  CRCsarewidelyusedonlinks

– Ethernet,802.11,ADSL,Cable…•  ChecksumusedinInternet

–  IP,TCP,UDP…butitisweak•  Parity

–  Islittleused

Page 76: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 76

Topic•  Somebitsmaybereceivedinerrorduetonoise.Howdowefixthem?–  Hammingcode»–  Othercodes»

•  Andwhyshouldweusedetectionwhenwecanusecorrection?

Page 77: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 77

WhyErrorCorrectionisHard•  Ifwehadreliablecheckbitswecouldusethemtonarrowdownthepositionoftheerror–  Thencorrectionwouldbeeasy

•  Buterrorcouldbeinthecheckbitsaswellasthedatabits!–  Datamightevenbecorrect

Page 78: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 78

IntuitionforErrorCorrectingCode•  Supposeweconstructacodewitha

Hammingdistanceofatleast3–  Need≥3biterrorstochangeonevalidcodewordintoanother

–  Singlebiterrorswillbeclosesttoauniquevalidcodeword

•  Ifweassumeerrorsareonly1bit,wecancorrectthembymappinganerrortotheclosestvalidcodeword–  WorksforderrorsifHD≥2d+1

Page 79: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 79

Intuition(2)•  Visualizationofcode:

A

B

Validcodeword

Errorcodeword

Page 80: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 80

Intuition(3)•  Visualizationofcode:

A

B

Validcodeword

Errorcodeword

SinglebiterrorfromA

ThreebiterrorstogettoB

Page 81: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 81

HammingCode•  Givesamethodforconstructingacodewithadistanceof3–  Usesn=2k–k–1,e.g.,n=4,k=3–  Putcheckbitsinpositionspthatarepowersof2,startingwithposition1

–  Checkbitinpositionpisparityofpositionswithaptermintheirvalues

•  Plusaneasywaytocorrect[soon]

Page 82: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 82

HammingCode(2)•  Example:data=0101,3checkbits

–  7bitcode,checkbitpositions1,2,4–  Check1coverspositions1,3,5,7–  Check2coverspositions2,3,6,7–  Check4coverspositions4,5,6,7

_______ 1234567

Page 83: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 83

HammingCode(3)•  Example:data=0101,3checkbits

–  7bitcode,checkbitpositions1,2,4–  Check1coverspositions1,3,5,7–  Check2coverspositions2,3,6,7–  Check4coverspositions4,5,6,7

0100101p1=0+1+1=0,p2=0+0+1=1,p4=1+0+1=0

1234567

Page 84: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 84

HammingCode(4)•  Todecode:

–  Recomputecheckbits(withparitysumincludingthecheckbit)

–  Arrangeasabinarynumber–  Value(syndrome)tellserrorposition–  Valueofzeromeansnoerror–  Otherwise,flipbittocorrect

Page 85: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 85

HammingCode(5)•  Example,continued

0100101p1=p2=p4=

Syndrome=Data=

1234567

Page 86: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 86

HammingCode(6)•  Example,continued

0100101p1=0+0+1+1=0,p2=1+0+0+1=0,p4=0+1+0+1=0

Syndrome=000,noerrorData=0101

1234567

Page 87: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 87

HammingCode(7)•  Example,continued

0100111p1=p2=p4=

Syndrome=Data=

1234567

Page 88: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 88

HammingCode(8)•  Example,continued

0100111p1=0+0+1+1=0,p2=1+0+1+1=1,p4=0+1+1+1=1

Syndrome=110,flipposition6Data=0101(correctafterflip!)

1234567

Page 89: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 89

OtherErrorCorrectionCodes•  CodesusedinpracticearemuchmoreinvolvedthanHamming

•  Convolutionalcodes(§3.2.3)–  Takeastreamofdataandoutputamixoftherecentinputbits

– Makeseachoutputbitlessfragile–  DecodeusingViterbialgorithm(whichcanusebitconfidencevalues)

Page 90: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 90

OtherCodes(2)–LDPC•  LowDensityParityCheck(§3.2.3)

–  LDPCbasedonsparsematrices–  Decodediterativelyusingabeliefpropagationalgorithm

–  Stateofthearttoday•  InventedbyRobertGallagerin1963aspartofhisPhDthesis–  Promptlyforgottenuntil1996…

Source:IEEEGHN,©2009IEEE

Page 91: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 91

Detectionvs.Correction•  Whichisbetterwilldependonthepatternoferrors.Forexample:–  1000bitmessageswithabiterrorrate(BER)of1in10000

•  Whichhaslessoverhead?

Page 92: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 92

Detectionvs.Correction•  Whichisbetterwilldependonthepatternoferrors.Forexample:–  1000bitmessageswithabiterrorrate(BER)of1in10000

•  Whichhaslessoverhead?–  Itstilldepends!Weneedtoknowmoreabouttheerrors

Page 93: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 93

Detectionvs.Correction(2)1.  Assumebiterrorsarerandom

–  Messageshave0ormaybe1error

•  Errorcorrection:–  Need~10checkbitspermessage–  Overhead:

•  Errordetection:–  Need~1checkbitspermessageplus1000bit

retransmission1/10ofthetime–  Overhead:

Page 94: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 94

Detectionvs.Correction(3)2.  Assumeerrorscomeinburstsof100

–  Only1or2messagesin1000haveerrors

•  Errorcorrection:–  Need>>100checkbitspermessage–  Overhead:

•  Errordetection:–  Need32?checkbitspermessageplus1000

bitresend2/1000ofthetime–  Overhead:

Page 95: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 95

Detectionvs.Correction(4)•  Errorcorrection:

– Neededwhenerrorsareexpected– Orwhennotimeforretransmission

•  Errordetection:– Moreefficientwhenerrorsarenotexpected

– Andwhenerrorsarelargewhentheydooccur

Page 96: Computer Networks - University of Washington...Internet Reference Model (3) • IP is the “narrow waist” of the Internet – Supports many different links below and apps above

CSE461UniversityofWashington 96

ErrorCorrectioninPractice•  Heavilyusedinphysicallayer

–  LDPCisthefuture,usedfordemandinglinkslike802.11,DVB,WiMAX,LTE,power-line,…

–  Convolutionalcodeswidelyusedinpractice

•  Errordetection(w/retransmission)isusedinthelinklayerandaboveforresidualerrors

•  Correctionalsousedintheapplicationlayer–  CalledForwardErrorCorrection(FEC)–  Normallywithanerasureerrormodel–  E.g.,Reed-Solomon(CDs,DVDs,etc.)