31
Naming in Networking Jennifer Rexford COS 316 Guest Lecture

Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

NaminginNetworking

JenniferRexford

COS316GuestLecture

Page 2: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

Names

2

TypeofName ExampleUniform Resource Locator http://www.cs.princeton.edu/

~jrex/foo.htmlE-mail [email protected] www.cs.princeton.eduInternet Protocol 128.112.7.156Media Access Control 00:15:C5:49:04:A9

Today’s lecture focuses on the last three!

Page 3: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

InternetProtocolLayers

3

Best-effort local packet delivery

Best-effort global packet delivery

Reliable streams

Applications

Messages

Link

Network

Transport

Application Hostname

IP address

MAC address

Page 4: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

InternetProtocolStack

4

HTTP

TCP

IP

Ethernetinterface

HTTP

TCP

IP

Ethernetinterface

IP IP

Ethernetinterface

Ethernetinterface

Opticalinterface

Opticalinterface

host host

router router

HTTP message

TCP segment

IP packet IP packetIP packet

Ethernet frame Ethernet frame

Page 5: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

What’sinaName?• Humanreadable?– Ifendusersinteractwiththenames

• Fixedlength?– Ifnamesmustbeprocessedathighspeed

• Largenamespace?– Ifmanynodesneeduniquenames

• Hierarchicalnames?– Ifthesystemisverylargeand/orfederated

• Self-certifying?– Ifpreventing“spoofing”isimportant 5

Page 6: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

DifferentLayers,DifferentNames

• Hostname (e.g.,www.cs.princeton.edu)– Mnemonic,variable-length,appreciatedbyhumans– Hierarchical,basedonorganizations

• IPaddress (e.g.,128.112.7.156)– Numerical32-bitaddressappreciatedbyrouters– Hierarchical,basedonorganizationsandtopology

• MACaddress (e.g.,00:15:C5:49:04:A9)– Numerical48-bitaddressappreciated byadapters– Non-hierarchical,unrelatedtonetworktopology

6

Page 7: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

HierarchicalAllocationProcesses

• Hostname: www.cs.princeton.edu– Domain:registrarforeachtop-leveldomain(e.g.,.edu)– Hostname:localadministratorassignstoeachhost

• IPaddresses: 128.112.7.156– Prefixes:ICANN,regionalInternetregistries,andISPs– Hosts:staticconfiguration,ordynamicusingDHCP

• MACaddresses: 00:15:C5:49:04:A9– Blocks:assignedtoequipmentvendorsbytheIEEE– Adapters:assignedbythevendorfromitsblock

7

Page 8: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

HostNamesvs.IPAddresses

• Namesareeasier(forus!)toremember– www.cnn.comvs.64.236.16.20

• IPaddressescanchangeunderneath– E.g.,renumberingwhenchangingproviders

• NamecouldmaptomultipleIPaddresses– www.cnn.comtomultiplereplicasoftheWebsite

• Maptodifferentaddressesindifferentplaces– E.g.,toreducelatency,orreturndifferentcontent

• Multiplenamesforthesameaddress– E.g.,aliaseslikeee.mit.eduandcs.mit.edu

8

Page 9: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

IPvs.MACAddresses

• LANsdesignedforarbitrarynetworkprotocols– NotjustforIP(e.g.,IPX,Appletalk,X.25,…)– DifferentLANsmayhavedifferentaddressschemes

• Ahostmaymovetoanewlocation– So,cannotsimplyassignastaticIPaddress– Instead,mustreconfiguretheadapter

• Mustidentifytheadapterduringbootstrap– NeedtotalktotheadaptertoassignitanIPaddress

9

Page 10: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

Hostname,IP,andMACHostname IP Address MAC Address

Example www.cs.princeton.edu 128.112.7.156 00:15:C5:49:04:A9

Size Hierarchical, human readable, variable length

Hierarchical, machine readable, 32 bits (in IPv4)

Flat, machine readable, 48 bits

Read by Humans, hosts Internet routers LAN switches

Allocation, top-level

Domain name assigned by registrar (e.g., for .edu)

Variable-length prefixes, assigned by ICANN, RIR, or ISP

Fixed-sized blocks, assigned by IEEE to vendors (e.g., Dell)

Allocation, low-level

Host name assigned by local administrator

Interface, by DHCPor local administrator

Interface, by equipment vendor

10

Page 11: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

Directory:TranslateNametoAddress

11

linksession

path

name

address

Page 12: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

Directory

• Akey-valuestore– Key:name,value:address(es)– Answerqueries:givenname,returnaddress(es)

• Cachingtheresponse– Reusetheresponse,foraperiodoftime– Betterperformanceandloweroverhead

• Allowentriestochange– Updatingtheaddress(es)associatedwithaname– Invalidatingorexpiringcachedresponses

12

Page 13: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

DirectoryDesign:ThreeExtremes• Floodthequery(e.g.,ARP)– Thenamednoderespondswithitsownaddress– But,highoverheadinlargenetworks

13

Page 14: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

AddressResolutionProtocol(ARP)

• EveryhostinaLANmaintainsanARPtable– (IPaddress,MACaddress)pair

• Consultthetablewhensendingapacket–MapdestinationIPaddresstodest MACaddress– TransmittheIPpacketwithinanEthernetframe

14

1.2.3.4 1.2.3.19

00:15:C5:49:04:A9 78:9A:B5:23:5D:98

LocalAreaNetwork

Page 15: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

AddressResolutionProtocol(ARP)

• But,whatifthekeyisnotinthetable?– Senderbroadcast:“WhohasIPaddress1.2.3.19?”– Receiveranswer:“MACaddress78:9A:B5:23:5D:98”– SendercachestheresultinitslocalARPcache

15

1.2.3.4 1.2.3.19

00:15:C5:49:04:A9 78:9A:B5:23:5D:98

LocalAreaNetwork

Page 16: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

AddressResolutionProtocol(ARP)

• ManagingtheARPcache– Storingallkey-valuepairsintroducesoverhead– Entriesbecomestale(e.g.,IPassignedtonewhost)– Removeanentryifnotusedforsomeperiodoftime

16

1.2.3.4 1.2.3.19

00:15:C5:49:04:A9 78:9A:B5:23:5D:98

LocalAreaNetwork

Page 17: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

DirectoryDesign:ThreeExtremes• Floodthequery(e.g.,ARP)– Thenamednoderespondswithitsaddress– But,highoverheadinlargenetworks

• Pushdatatoallnodes(e.g.,/etc/hosts)– Allnodesstoreafullcopyofthedirectory– But,highoverheadformanynamesandupdates

• Centraldirectoryserver– Alldataandquerieshandledbyonenode– But,poorperformance,scalability,andreliability

17

Page 18: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

DistributedDirectoryDesign

• Hierarchicaldirectory(e.g.,DNS)– Followthehierarchyofthenamespace– Distributethedirectory,distributethequeries– Enabledecentralizedupdatestothedirectory

• DistributedHashTable(e.g.,P2Papplications)– Directoryasahashtablewithflatnames– Eachdirectorynodehandlesrangeofhashoutputs– Usehashtodirectquerytothedirectorynode

18

Page 19: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

DomainNameSystem(DNS)

• PropertiesofDNS– Hierarchicalnamespacedividedintozones– DistributedoveracollectionofDNSservers

• HierarchyofDNSservers– Rootservers– Top-leveldomain(TLD)servers– AuthoritativeDNSservers

• Performingthetranslations– LocalDNSserversandclientresolvers

19

Page 20: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

DistributedHierarchicalDatabase

20

com edu org ac uk zw arpa

unnamed root

bar

west east

foo my

ac

cam

usr

in-addr

12

34

56

generic domains country domains

my.east.bar.edu usr.cam.ac.uk

12.34.56.0/24

Page 21: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

DNSRootServers

21

• 13rootservers(seehttp://www.root-servers.org/)• LabeledAthroughM

B USC-ISI Marina del Rey, CAL ICANN Los Angeles, CA

E NASA Mt View, CAF Internet Software C. PaloAlto, CA (and 17 other locations)

I Autonomica, Stockholm (plus 3 other locations)

K RIPE London (also Amsterdam, Frankfurt)

m WIDE Tokyo

A Verisign, Dulles, VAC Cogent, Herndon, VA (also Los Angeles)D U Maryland College Park, MDG US DoD Vienna, VAH ARL Aberdeen, MDJ Verisign, ( 11 locations)

Page 22: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

TLDandAuthoritativeDNSServers

• GlobalTop-leveldomain(gTLD)servers– Genericdomains(e.g.,.com,.org,.edu)– Countrydomains(e.g.,.uk,.fr,.ca,.jp)– Managedprofessionally(e.g.,Verisignfor.com.net)

• AuthoritativeDNSservers– Providepublicrecordsforhostsatanorganization– Fortheorganization’sservers(e.g.,Webandmail)– Canbemaintainedlocallyorbyaserviceprovider

22

Page 23: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

UsingDNS

• LocalDNSserver(“defaultnameserver”)– Usuallyneartheendhostswhouseit– Localhostsconfiguredwithlocalserver(e.g.,/etc/resolv.conf)orlearntheserverviaDHCP

• Clientapplication– Extractservername(e.g.,fromtheURL)– Dogethostbyname() orgetaddrinfo()togetaddress

• Serverapplication– ExtractclientIPaddressfromsocket– Optionalgethostbyaddr() totranslateintoname

23

Page 24: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

DNSQueries

24

Hostatcis.poly.edu wantsIPaddressforgaia.cs.umass.edu

requesting hostcis.poly.edu

gaia.cs.umass.edu

root DNS server

local DNS serverdns.poly.edu

1

23

4

5

6

authoritative DNS serverdns.cs.umass.edu

78

TLD DNS server

Recursive query: #1Iterative queries: #2, 4, 6

Page 25: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

Recursivevs.IterativeQueries

• Recursivequery– Askservertogetanswerforyou

– E.g.,request1andresponse8

• Iterativequery– Askserverwhotoasknext

– E.g.,allotherrequest-responsepairs

25

requesting hostcis.poly.edu

root DNS server

local DNS serverdns.poly.edu

1

23

4

5

6

authoritative DNS serverdns.cs.umass.edu

78

TLD DNS server

Page 26: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

DNSCaching• DNSquerylatency

– E.g.,1seclatencybeforestartingadownload

• Cachingtoreduceoverheadanddelay– Small#oftop-levelservers,thatchangerarely

– Popularsitesvisitedoften

• Wheretocache?– LocalDNSserver– Browser

26

requesting hostcis.poly.edu

root DNS server

local DNS serverdns.poly.edu

1

23

4

5

6

authoritative DNS serverdns.cs.umass.edu

78

TLD DNS server

Page 27: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

DNSCacheConsistency

• Cacheconsistency– Ensuringcacheddataisuptodate

• DNSdesignconsiderations– Cacheddatais“readonly”– Explicitinvalidationwouldbeexpensive

• Avoidingstaleinformation– Responsesincludea“timetolive”(TTL)field– DeletethecachedentryafterTTLexpires

27

Page 28: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

SettingtheTimeToLive(TTL)

• TTLtrade-offs– SmallTTL:fastresponsetochange– LargeTTL:highercachehitrate

• Followingthehierarchy– Topofthehierarchy:daysorweeks– Bottomofthehierarchy:secondstohours

• Tensioninpractice– SetlowTTLsforloadbalancingandfailover– Browserscachefor15-60seconds

28

Page 29: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

NegativeCaching

• Brokendomainnamesareslowtoresolve–Misspellingslikewww.cnn.comm andwww.cnnn.com

– Thesecantakealongtimetofailthefirsttime• Rememberthingsthatdon’twork– Goodtorememberthattheydon’twork– …sothefailuretakeslesstimeinthefuture

• Butdon’trememberfortoolong– Useatime-to-livetoexpire

29

Page 30: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

DNSReliability

• DNSserversarereplicated– Nameserviceavailableifatleastone replicaisup– Queriescanbeloadbalancedbetweenreplicas

• Retransmissionoflostqueries– Noresponsetoaquery?Tryagain!

• Tryalternateserversontimeout– Exponentialback-offwhenretryingsameserver

30

Page 31: Naming in Networking · • A key-value store – Key: name, value: address(es) – Answer queries: given name, return address(es) • Caching the response – Reuse the response,

Conclusions

• Networknames– Toidentifyremoteend-points– Readability?Format?Length?Hierarchy?– Hostnames,IPaddresses,andMACaddresses

• Networkdirectories– Key-valuestorestomapnametoaddress– Flooding(ARP),localcopy,centralserver– Hierarchical(DNS)ornon-hierarchical(DHT)

• Moreonprotocollayersinafewweeks!

31