internet protocol stack - university of michiganarp+dhcp.pdf · internet protocol stack ......

12
Computer Networks Lecture 21: Physical and Link Layers Internet Protocol Stack application: supporting network applications HTTP, SMTP, FTP, etc. transport: endhost-endhost data transfer TCP, UDP network: routing of datagrams from source to destination IP, routing protocols link: data transfer between neighboring network elements Ethernet, WiFi physical: bits “on the wire” application transport network link physical Physical Layer: Signals We only look at a very brief overview of the physical layer in this course to learn more, take EECS 455: Signals and Systems, EECS 554: Digital Communication and Coding, and/or EECS 557: Communication Networks Physical Layer: Signals Signal degrades (attenuates) as it travels further from the source (caused by resistance on the wire, cosmic interference, etc.) How different types of PHY tech alleviates signal attenuation: coax: shielding of core reduces interference twisted pair: twisting a pair of wires changes the electrical property of the pair, reducing interference glass fiber: LED or laser as signal source more fragile but no interference can carry more data hard to splice

Upload: halien

Post on 05-Jul-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

Computer Networks

Lecture21:PhysicalandLinkLayers

InternetProtocolStackapplication:supportingnetworkapplications

•  HTTP,SMTP,FTP,etc.

transport:endhost-endhostdatatransfer•  TCP,UDP

network:routingofdatagramsfromsourcetodestination

•  IP,routingprotocols

link:datatransferbetweenneighboringnetworkelements

•  Ethernet,WiFi

physical:bits“onthewire”

application

transport

network

link

physical

PhysicalLayer:Signals

Weonlylookataverybriefoverviewofthephysicallayerinthiscourse•  tolearnmore,takeEECS455:SignalsandSystems,EECS554:DigitalCommunicationandCoding,and/orEECS557:CommunicationNetworks

PhysicalLayer:SignalsSignaldegrades(attenuates)asittravelsfurtherfromthesource(causedbyresistanceonthewire,cosmicinterference,etc.)

HowdifferenttypesofPHYtechalleviatessignalattenuation:•  coax:shieldingofcorereducesinterference•  twistedpair:twistingapairofwireschangestheelectricalpropertyofthepair,reducinginterference

•  glassfiber:•  LEDorlaserassignalsource•  morefragilebutnointerference•  cancarrymoredata•  hardtosplice

TransmissionDistanceLimitationTransmissiondistancelimiteddueto:signallosscausedbyinterferenceandsharingcondition

Examples:•  serialline(RS-232):15m•  twistedpair:•  Cat5(e):1-10Base-T(2wires),

1GBase-T(4wires):100m

•  Cat6:≤ 1GBase-T:100m,10GBase-T:37-55m

•  Cat6a:10GBase-T:100m

•  fiber:2-100km

WiringSchemePoint-to-point:O(N2) connectionstoconnectNcomputers

SharedLAN:bus ring star

WirelessRadio:•  satellite:orderofGbps,up-downlatencyof250ms(toolong)

•  cellular,WiFi,WiMax

•  Bluetooth:2.4GHzshortrangeradio,721Kbps–2.1Mbps,1-100m

•  UWB:3.1GHz-10.6GHz,480-675Mbps,10m,lessinterferenceduetouseofshortpulses•  WirelessUSB

•  Bluetooth3.0•  WirelessFireWire

Wireless

Microwave:•  highbandwidth:1.5Gbps•  canbeaimedinasingledirection•  requires“line-of-sight”•  mostusefultoconnectbuildingsoncampus

Infrared:shorterdistance,noneedforantenna

Bitvs.BaudRateBitvs.Baud•  bitstransmittedaselectricaloropticalsignal

•  bitrate:numberofbitspersecond

•  baudrate:signal/voltagelevelchangespersecond

•  eachlevelcanrepresentmultiplebits•  forbinarysignaling,bitrate==baudrate

•  forM-ary(Mlevels)signaling,bitrate≠baudrate

•  example:4-arysignalingcarries2bitsperlevel

voltage

+3

+1

-1

-3

11 10 11 01 00 11 00

0time

1sec

7 baud/sec = 14 bps

Signals

Example:RS-232•  negativevoltage(�15V)representsa1•  positivevoltage(+15V)representsa0•  bitrate==baudrate•  7bits/character•  toallowasynchronouscommunication:

1startbit,1stopbit

SignalDigitizationThemaximumrateatwhichyoucantransmitdataislimitedbyhowfast(inHertz)thesender’shardwarecanchangevoltagelevelandhowsensitivethereceiver’shardwareistovoltagelevelchangesNyquistSamplingTheorem(1924):

ForasignalbandlimitedinfrequencyatBHz,weneedtosampleat2BHztoreconstructtheoriginalsignalfromthesamples

SignalDigitizationConversely,andmoregenerally,foranM-levelsignal,themaximumdatarate(R)isdeterminedby:

R = 2B log2 Mbps,whereBisthelinebandwidth(inHz)Example:RS-232,M = 2,phoneline:B = 3kHzSo,signaltravellingoverphonelineusingRS-232signalinghasamaximumdatarateofR = 2B = 6 Kbps(modemsdon’tuseRS-232signaling!)

ManchesterEncodingProblemwithlongstringsof0sor1s•  notransitionfromlow-to-high,orhigh-to-low•  receiverkeepsaverageofsignalithasreceivedandusestheaveragetodistinguishbetweenhighandlow

•  longflatstringsmakereceiversensitivetosmallchanges

WithManchesterencoding,eachbitcontainsatransition• allowssenderandreceivertosynchronizeclockswitheachother

•  noneedforacentralized,globalclock!• usedin10BaseTEthernet

SignaltoNoiseRatio(dB)NyquistSamplingTheoremassumesnoiselesschannel

Inreality,channelsarenoisyS/N:ratioofsignalpower(watts)tonoisepower(watts)usuallygivenassignal-to-noiseratioinquantityof10 log10 S/N,calleddB(decibles)

Examples:•  S/N = 10,signal-to-noiseratiois10dB•  S/N = 100,signal-to-noiseratiois20dB

SignaltoNoiseRatio(dB)ShannonCapacity(1948):themaximumdatarate(C)ofanoisychannelwithbandwidthBHzandagivensignal-to-noiseratiois:

C = B log2 (1+S/N)bps,

whichgivesM(levelsofsignal,orbitsperlevel,required)ontheorderof√(1+S/N)PhonelineshaveB= 3 kHz,S/N = 30 db,soC = 29.9 kbps(3 · log2(1+1000))

CarrierWaveObservation:acontinuous,oscillatingsignalpropagatesfurther(withlesssignalloss)thanothersignals

Hencetosenddatalongdistances,weuseacontinuoussinewaveasacarrierwave

Datais“carried”bymodifyingthecarrierwave,aprocesscalledmodulation

Twotypesofmodulation:1. AmplitudeModulation(AM):notasrobust2. FrequencyModulation(FM):morerobust

Modem:modulator-demodulator

TransmissionBandwidths

http://en.wikipedia.org/wiki/List_of_device_bandwidths

DataLinkLayer

Thedata-linklayerhastheresponsibilityoftransferringpacketsfromonenodetoanadjacentnodeoveralinkAtthelinklayer,apacketiscalledaframe,anditencapsulatesanetwork-layerdatagramAnetworkdatagrammaybetransferredbydifferentlinkprotocolsoverdifferentlinks:•  e.g.,Ethernetonthefirstlink,framerelayonintermediatelinks,and802.11onthelastlink

“link”

AdaptorsCommunicating

Linklayerimplementedin“adaptor”(a.k.a.NIC)•  Ethernetcard,USBcard,802.11card

Sendingside:•  encapsulatesdatagraminaframe•  addserrorcheckingbits,flowcontrol,etc.

Receivingside•  looksforerrors,flowcontrol,etc.•  extractsdatagram,passestoreceivingnode

Adaptorissemi-autonomouslink&physicallayers

sendingnode

frame

receivingnode

datagram

frame

adaptor adaptor

linklayerprotocol

Ethernet“Dominant”wiredLANtechnology:Cheap:$20for100Mbps!FirstwidelyusedLANtechnologySimpler,cheaperthantokenLANsandATMKeptupwithspeedrace:10Mbps–10Gbps

Metcalfe’sEthernetsketch

DataLinkLayer

Thedatalinklayercanbefurthersubdividedinto:

1.  LogicalLinkControl(LLC):errorandflowcontrol

2. MediaAccessControl(MAC):framingandmediaaccess

differentlinkprotocolsmayprovidedifferentservices,e.g.,Ethernetdoesn’tprovidereliabledelivery(errorrecovery)

application

transport

network

LLC MAC

physical

DataLinkLayer

MACtopics:•  framingandMACaddressassignment• LANforwarding•  IPtoMACaddressresolution•  IPtoMAC:AddressResolutionProtocol(ARP)• MACtoIP:DynamicHostConfigurationProtocol(DHCP)

• mediaaccesscontrol

application

transport

network

LLC MAC

physical

FramingWhypacketize/framedata?•  • 

Framingallowssourceswithsmallamountofdata(e.g.,VoIP)tofinishpromptly

FramingFramingisdonebyusingaspecialbitpatterntodenotestart&endofframe(soh&eot)Bitstuffing:ifsoh&eotshowsupindata,theymustbeprotected/escaped

EthernetFrameStructureSendingadaptorencapsulatesIPdatagram(orothernetworklayerprotocolpacket)inEthernetframePreamble:7bytesofpattern10101010followedbyonebyteofpattern10101011,usedtosynchronizereceiver-senderclockrates

Addresses:6byteseachType:indicatesthehigherlayerprotocol,e.g.,IP,IPX,AppleTalk

CRC(cyclicredundancycheck):checkedatreceiver,iferrorisdetected,theframeissimplydropped

FrameTransmission

FrametransmissiononasharedbusLAN:•  framesaretaggedwithdestinationMACaddress

•  framessenttoallhostsontheLAN

•  theNIConeachhostmakesacopyofframe

•  iftheframeisaddressedtothehost,orabroadcastframe(e.g.,ARPpacket)theNICsendstheframeuptotheCPU,otherwisediscardsframe

• aframecanalsohaveabroadcastormulticastaddress

• NICscouldbeputinpromiscuousmode(e.g.,tcpdump,ethereal,networksniffer,networkanalyser)

WhyNotJustUseIPAddresses?LANsaredesignedforarbitrarynetworkprotocols• notjustforIP(e.g.,IPX,Appletalk,X.25,…)

•  thoughIPisnowthemaingameintown• differentLANsmayhavedifferentaddressingschemes

•  thoughEthernetisnowthemaingameintown•  Ethernetaddresses:00-15-C5-49-04-A9

•  blocks:assignedtovendorsbytheIEEE•  adapters:assignedbythevendorfromitsblock

MACaddressassignment• static:Ethernet(48-bits):requiresglobaladdressassignment• configurable:requiresDIPswitch,EPROM• dynamic(randomnumber):•  advantage:onlyneedtobeuniquewithinaLAN•  disadvantage:addresschangesbetweenreboots

AddressResolution

IProutingonaLAN:assumehostsknowtheirownnetworknumberandsubnetmask:

• senddirectlytothedestinationifonthesameLAN

• sendtoadefaultrouterotherwise

hostmustknowtheMACaddressofeitherthedestinationorthedefaultrouter

AddressResolution

Givenanode’sIPaddress,howdoesahostknowitsMACaddress?

• MACaddresscanbeinferredfromtheIPaddress(IPv6)

•  fromastaticallyconfiguredtable

• askaserver

• usetheAddressResolutionProtocol(ARP)

AddressResolutionProtocol(ARP)HowwouldhostA discoverhostB’sMACaddress,assumingitknowsB’sIPaddress?

EachIPnode(host,router)ontheLANmaintainsanARPtable• ARPtable:IP-to-MACaddressmappingsforsomeLANnodes•  <IPaddress;MACaddress;ttl>

•  ttl(timetolive):timeafterwhich,addressmappingwillbeflushed(typically20min)

• maintainedinanLRUmanner

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

58-23-D7-FA-20-B0

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

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

LAN

237.196.7.23

237.196.7.78

237.196.7.14

237.196.7.88

A

B

ARPProtocol:SameLANAwantstosenddatagramtoB,butB’sMACaddressnotinA’sARPtableAbroadcastsARPquerypacket,containingB'sIPaddress• destinationisbroadcastMACaddressFF-FF-FF-FF-FF-FF • allmachinesonLANreceiveARPquery• querypacketalsocontainsA’sownIPandMACaddressesBrepliestoAwithB’sIPandMACaddresses•  framesenttoA’sMACaddress(unicast)• Bcaches(saves)A’sIP-to-MACaddressmappinginitsownARPtable,orrefreshesA’sentryifitalreadyexists

ARPProtocol:SameLAN

AcachesB’sIP-to-MACaddresspairinitsARPtableuntilttlexpires,atwhichtimeitwillbeflushed•  softstate:informationthattimesout(goesaway)unlessrefreshed

ARPis“plug-and-play”:• nodescreatetheirARPtableswithouthumanintervention•  tryoutarp(8)(mayneedroot/administratorpermission)

TosenddatagramfromAtoBviaR,assumingAknowsB’sIPaddress(e.g.,viaDNS)•  routerRhastwoARPtables:oneforeachLAN• Aknowsthatitsdefaultrouter(R)hasIPaddress111.111.111.110 • AlooksupR’sMACaddressE6-E9-00-17-BB-4BfromitsARPtable,orifthemappingdoesn’texist,itsendsoutanARPrequestpackettoresolveit

AR

B

ForwardingtoAnotherLAN

AR

B

• AcreatesdatagramwithsourceIPA,destinationIPB • Acreateslink-layerframewithR'sMACaddressasdestination,framecontainingA-to-BIPdatagram• A’ssendsframetoR

• R receivesframe,extractsIPdatagramfromframe,seesthatitsdestinationisB• RusesARPtogetB’sMACaddress,andcreatesanewframecontainingA-to-BIPdatagramwithMACdestinationaddresssettoB’s

ForwardingtoAnotherLAN

ObtaininganIPAddress

HowdoesahostobtainitsIPaddress?1. static:hard-codedbysystemadministratorinafile

• Windows:ControlPanel�Network�Configuration�TCP/IP�Properties•  UNIX:/etc/rc.config

2.  dynamic:askaserver:•  ReverseARP(RARP)(obsolete)•  BOOTProtocol(BOOTP)(obsolete)•  DynamicHostConfigurationProtocol(DHCP):dynamicallyrequestanaddressfromaserverwhenthehostboots•  “plug-and-play”

DHCP

DynamicHostConfigurationProtocolClienthost:• broadcastsaDHCPdiscoverpacketwithitsownMACaddress•  usesUDP/IPwithIPbroadcasting

•  limitingDHCPusewithinaLAN,butbeyondaphysicalsegment

• broadcastprecededbyarandomwaittime,topreventstormingtheLAN

host host host...

DHCP server

newclient

DHCPserver233.1.2.5 DHCPdiscover

DHCPoffer

DHCPrequest

DHCPACK

(broadcast)

DHCP

Servers:• maintainapoolofsharedhostidentities•  ifMACaddressofaqueryinghostisnotinthedatabaseofpermanentidentities,assigns(leases)itatemporaryidentityfrompool

• oneormoreDHCPserversrespondwithIPaddressoffer

Clienthost:• choosesoneofferandrequestsitfromtheofferingserver•  ifnoreply,servermaybedownorbusy,retrylater

host host host...

DHCP server

newclient

DHCPserver233.1.2.5 DHCPdiscover

DHCPoffer

DHCPrequest

DHCPACK

(broadcast)

DHCP

Topreventtoomanyreplies:• eachhostcanbeassignedaprimaryserver• onrepeatedquery,non-primaryserverswaitarandomtimeforresponsefromotherserversbeforereplying

DynamicIPaddresseswithDHCP:• advantage:doesn’trequiremanualconfiguration• shortcoming:DHCP’sinteractionwithDNSunspecified(dynamicDNSnotyet/ever?widelydeployed)

host host host...

DHCP server

OtherInformationOtherinformationanewlybootedmachinemayneed:• subnetmask• defaultrouter’saddress• DNSserver•  timeserver• printserver• fileserver• bootfile(nameandsize,ifthin/disklessclient/netbook),etc.Queriesandrepliesforallofthesemaybebatchedtogetherforefficiency

FiniteStateMachineFinitestatemachine(FSM)isausefultoolfordesigninganddocumentingprotocol:• consistsofanumberofstates•  isagraphshowingthetransitionfromonestatetooneormorestates•  labelsontheedgesshow:•  whateventcauseseachtransition,e.g.,receivingacertaintypeofpacket

•  andwhatactionsorsideeffectseachtransitionmaycause,ifany

state1state2

eventcausingstatetransition

actionstakenonstatetransition

state:wheninthis“state”nextstateuniquelydeterminedbynextevent

DHCPSimplifiedFiniteStateMachine

newclient

DHCPserver233.1.2.5 DHCPdiscover

DHCPoffer

DHCPrequest

DHCPACK

(broadcast)

1

1

2

33

4

4

5

6

unicast to original server

broadcast to all servers

no reply from original server

or host reboot

7broadcast to all servers

DHCP�  DHCPOFFERmessagefromtheserver

•  configurationparameters(proposedIPaddress,mask,gatewayrouter,DNSserver,...)

•  leasetime(thetimetheinformationremainsvalid)

� SELECT:multipleserversmayrespond• multipleserversonthesamebroadcastmedia•  eachmayrespondwithanoffer•  theclientcandecidewhichoffertoaccept

� DHCPREQUEST:acceptingoneoftheoffers•  clientbroadcastsaDHCPREQUESTechoingtheparameters

• otherserversseetheacceptanceandupdatetheirleasedatabase

[afterRexford]

DHCPLeases� DHCPACK:serverconfirmation

•  theDHCPserverrespondswithaDHCPACKtoconfirm

� DHCPRELEASE:whyisaleasetimenecessary?•  clientcanreleasetheIPaddress(DHCPRELEASE)

•  ipconfig /releaseattheCLI•  cleanshutdownofthecomputer

• or,thehostmightnotreleasetheaddress•  thehostcrashes•  buggyclientsoftware

•  andyoudon’twanttheaddresstobeallocatedforever• performancetrade-offs

•  shortleasetime:returnsinactiveaddressesquickly•  longleasetime:avoidsoverheadoffrequentrenewals

[afterRexford]

DHCPLeases� RENEW:leasereaches50%expirationorupon

reboot•  renewleasewithoriginalserver• allowsclienttocacheIPaddressacrossboot

•  uponreboot,clienttriestorenewleaseofcachedaddress

  REBIND:leasereaches7/8thexpiration• originalserverdoesn’trespond• broadcasttoallservers•  ifnoservercanrenew,leaseanewaddress• howtokeepleasetimersconsistentacrossmultipleserversisnotpartoftheDHCPstandard[RFC2131]

DHCPPacketFormatOpcode:•  DHCPREQUEST •  DHCPACK

HardwareType:•  Ethernet(1),FireWire(24),etc.

hlen:hardwareaddresslengthTransactionID:•  arandomnumberchosenbyclienttoassociatemessageswithresponses

Secondselapsed:•  secondssinceclientbegananaddressacquisitionorrenewalprocess