50
Computer Networks: Architecture and Protocols CS4450 Lecture 14 IP: Addressing and Forwarding Spring 2018 Rachit Agarwal

lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

ComputerNetworks:ArchitectureandProtocols

CS4450

Lecture14IP:AddressingandForwarding

Spring2018RachitAgarwal

Page 2: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Announcements

• Pleasefilloutthefeedbackform

• Iemailedalink

• Ireceivedyouremailsregardingconflictswithprelims/final

• We’lldiscussandrespondtoemailssoon

2

Page 3: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

GoalsforToday’sLecture

• ContinuewithdesignofTHEInternetProtocol(IP)

• Toachieveitsfunctionality,IPprotocolhasthreeresponsibilities

• Addressinghosts

• Forwardingpackets(actuallydatagrams)

3

Page 4: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Addressing

Page 5: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Addressingsofar

• Eachnodehasa“name”

• Wehavesofarworkedonlywithnames

• Assumedthatforwarding/routingetc.doneonnames

• Today:

• Whydoweneedaddresses?

• Whydoweassignaddressesthewayweassignaddresses?

Page 6: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Threerequirementsforaddressing

• Scalablerouting

• Howmuststatemustbestoredtoforwardpackets?

• Howmuchstateneedstobeupdateduponhostarrival/departure?

• Efficientforwarding

• Howquicklycanonelocateitemsinroutingtable?

• Hostmustbeabletorecognizepacketisforthem

Page 7: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Layer2(linklayer):“Flat”Addressing

• UsesMACaddress

• “Names”,remember?Usedasidentifier

• Uniqueidentifiershardcodedinthehardware

• Nolocationinformation

• Localareanetworksrouteonthese“flat”addresses

• SpanningTreeProtocolrunsonswitchesandhosts

• Eachswitchstoresaseparateroutingentryforeachhost

• End-hostsstorenothing

• Uponreceivingapacket,anend-host:

• Putsdestination’sanditsownMACaddressintheheader

• Forwardsittotheswitchitisconnectedto

• Destinationisabletorecognizethepacketisforthemusingaddress

Page 8: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Howdoesthismeetourrequirements?

• Scalablerouting

• Howmuchstatetoforwardpackets?

• Oneentryperhostperswitch

• Howmuchstateupdatedforeacharrival/departure?

• Oneentryperhostperswitch

• Efficientforwarding

• ExactmatchlookuponMACaddresses(exactmatchiseasy!)

• Hostmustbeabletorecognizethepacketisforthem

• MACaddressdoesthisperfectly

Conclusion:L2addressingdoesnotenablescalablerouting

Page 9: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

HowwouldyouscaleL2?

• SupposewewanttodesignamuchlargerL2network

• MustuseMACaddressaspartoftheaddress

• Onlywayhostknowsthatthepacketisforthem

• Buthowwouldyouenablescalablerouting?

• Small#routingentries(lessthanoneentryperhostperswitch)

• Small#updates(lessthanoneupdateperswitchperhostchange)

Page 10: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

OnepossibleSolution:TowardsInternet-scaleaddressing

• Assigneachend-hostanaddressesoftheform—Switch:MAC

• SpanningTreeProtocolrunsonlyonswitches

• So,eachswitchhasoneentryperswitch(ratherthanperhost)

• Uponreceivingapacket,anend-host:

• Putsdestination’sanditsownSwitch:MACaddressintheheader

• Forwardsittotheswitchitisconnectedto

• Switchesforwardthepacketusingfirstpartoftheaddress

• Destinationisabletorecognizethepacketisforthemusingsecondpartoftheaddress

Page 11: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Layer3(IP):Hierarchicaladdressing

• RoutingtablescannothaveentryforeachswitchintheInternet

• Useaddressesoftheform—Network:Host

• Routersknowhowtoreachallnetworksintheworld

• Routingalgorithmsonlyannounce“Network”partoftheaddresses

• Routingtablesnowstoreanext-hopforeach“network”

• Forwarding:

• Routersignorehostpartoftheaddress

• Whenthepacketreachestherightnetwork

• PacketforwardedusingHostpartoftheaddress

• UsingLayer2

• ThiswastheoriginalIPaddressingscheme

Page 12: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

WhatdoImeanby“network”

• IntheoriginalIPaddressingscheme…

• NetworkmeantanL2network

• Oftenreferredtoasa“subnet”

• Therearetoomanyofthemnowtoscale

Page 13: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Aggregation

• Aggregation:singleforwardingentryusedformanyindividualhosts

• Example:

• InourscalableL2solution:aggregatewasswitch

• InourscalableL3solution:aggregatewasnetwork

• Advantages:

• Fewerentriesandmorestable

• Changeofhostsdonotchangetables

• Don’tneedtokeepstateonindividualhosts

Page 14: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

HierarchicalStructure

• TheInternetisan“inter-network”

• Usedtoconnectnetworkstogether,nothosts

• Formsanaturaltwo-wayhierarchy

• WideAreaNetwork(WAN)deliverstotheright“network”

• LocalAreaNetwork(LAN)deliverstotherighthost

Page 15: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

HierarchicalAddressing

• Canyouthinkofanexample?

• AddressingintheUSmail

• Country

• City,Zipcode

• Street

• HouseNumber

• Occupant“Name”

???

Page 16: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

IPaddresses

• Unique32bitnumbersassociatedwithahost

• Usedotted-quadnotation,e.g.,128.84.139.5

Country City,State Street,Number Occupant

(8bits) (8bits) (8bits) (8bits)

10000000 0-1010100 10001011 00000-101

128 84 139 5

Network Host

Page 17: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

OriginalAddressingmechanism

• Firsteightbits:networkaddress(/8)

• Slashnotationindicatesnetworkaddress

• Last24bits:hostaddress

• Assumed256networksweremorethanenough!!!

• Nowwehavemillions!

Page 18: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Supposewewanttoaccommodatemorenetworks

• Wecanallocatemorebitstonetworkaddress

• Problem?

• Fewerbitsforhostnames

• Whatifsomenetworksneedmorehosts?

Page 19: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Today’sAddressing:CIDR

• ClasslessInter-domainRouting

• Idea:Flexibledivisionbetweennetworkandhostaddresses

• Prefixisnetworkaddress

• Suffixishostaddress

• Example:

• 128.84.139.5/23isa23bitprefixwith:

• First23bitsfornetworkaddress

• Next9bitsforhostaddresses:maximum2^9hosts

• Terminology:“Slash23”

Page 20: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

ExampleforCIDRAddressing

• 128.84.139.5/23isa23bitprefixwith2^9hostaddresses

10000000 0-1010100 10001011 00000-101

128 84 139 5

Network(23bits) Host(9bits)

Page 21: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Allocatingaddresses

• InternetCorporationforAssignedNamesandNumbers(ICANN)…

• AllocateslargeblocksofaddressestoRegionalInternetRegistries• E.g.,AmericanRegistryforInternetNames(ARIN)…

• ThatallocatesblocksofaddressestoLargeInternetServiceProviders(ISP)

• Thatallocateaddressestoindividualsandsmallerinstitutions

• Fakeexample:

• ICANN->ARIN->AT&T->Cornell->CS->Me

Page 22: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Allocatingaddresses:Fakeexample

• ICANNgivesARINseveral/8s

• ARINgivenAT&Tone/8,128.0/8

• Networkprefix:10000000

• AT&TgivesCornellone/16,128.84/16

• Networkprefix:1000000001010100

• CornellgivesCSone/24,128.84.139/24

• Networkprefix:100000000101010010001011

• CSgivenmeaspecificaddress128.84.139.5

• Networkprefix:10000000010101001000101100000101

Page 23: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Howdoesthismeetourrequirements?

• Tounderstandthis,weneedtounderstandtheroutingontheInternet

• Andtounderstandthat,weneedtounderstandtheInternet

Page 24: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Asetofnetworkelementsconnectedtogether,thatimplementasetofprotocolsforthepurposeofsharingresourcesattheendhosts

Backtothebasics:whatisacomputernetwork?

Page 25: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

“InteriorRouters”

“AutonomousSystem(AS)”or“Domain” Regionofanetworkunderasingleadministrativeentity

“BorderRouters”

An“end-to-end”route

Whatdoesacomputernetworklooklike?

Page 26: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

“InteriorRouters”

“AutonomousSystem(AS)”or“Domain” Regionofanetworkunderasingleadministrativeentity

“BorderRouters”

An“end-to-end”route

Whatdoesacomputernetworklooklike?

Page 27: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

AutonomousSystems(AS)

• AnASisanetworkunderasingleadministrativecontrol

• Currentlyover30,000

• Example:AT&T,FranceTelecom,Cornell,IBM,etc.

• AcollectionofroutersinterconnectingmultipleswitchedEthernets

• AndinterconnectionstoneighboringASes

• Sometimescalled“Domains”

• EachASassignedauniqueidentifier

• 16bitASnumber

Page 28: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

AT&T a.0.0.0/8

France Telecom

LBL a.b.0.0/16

Cornella.c.0.0/16

a.c.*.* is this way

a.b.*.* is this way

IP addressing ➔ Scalable Routing?

Page 29: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

AT&T a.0.0.0/8

France Telecom

LBL a.b.0.0/16

Cornella.c.0.0/16

a.*.*.* is this way

foo.com a.d.0.0/16

IP addressing ➔ Scalable Routing?

Can add new hosts/networks without updating the routing entries at France Telecom

Page 30: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

AT&T a.0.0.0/8

LBL a.b.0.0/16

Cornella.c.0.0/16

ESNet

IP addressing ➔ Scalable Routing?

ESNet must maintain routing entries for both a.*.*.* and a.c.*.*

Page 31: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Administrative Structure Shapes Interdomain Routing● ASes want freedom to pick routes based on policy● “My traffic can’t be carried over my competitor’s network!”● “I don’t want to carry A’s traffic through my network!”● Cannot be expressed as Internet-wide “least cost”

● ASes want autonomy● Want to choose their own internal routing protocol● Want to choose their own policy

● ASes want privacy● Choice of network topology, routing policies, etc.

Page 32: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Choice of Routing Algorithm

● Link State (LS) vs. Distance Vector (DV)

The “Border Gateway Protocol” (BGP) extends Distance-Vector ideas to accomodate policy

● LS offers no privacy — broadcasts all network information● LS limits autonomy — need agreement on metric, algorithm

● DV is a decent starting point● Per-destination updates by intermediate nodes give us a hook● But, wasn’t designed to implement policy● … and is vulnerable to loops if shortest paths not taken

Page 33: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Business Relationships Shape Topology and Policy● Three basic kinds of relationships between ASes

● Business implications● Customer pays provider● Peers don’t pay each other● Exchange roughly equal traffic

● AS A can be AS B’s customer● AS A can be AS B’s provider● AS A can be AS B’s peer

Page 34: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

peer peerprovider customer

Relations between ASes• Customers pay provider • Peers don’t pay each other

Business Implications

Business Relationships

Page 35: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

peer peerprovider customer

Relations between ASes• Customers pay provider • Peers don’t pay each other

Business Implications

A

B C

D E

E.g., D and E talk a lot

Peering saves B and C money

Why Peer?

Page 36: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

● ASes provide “transit” between their customers ● Peers do not provide transit between other peers

traffic allowed traffic not allowed

A B C

D E F

QPr Cu

Peer Peer

Routing Follows the Money

Page 37: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

● An AS only carries traffic to/from its own customers over a peering link

A B C

D E F

QPr Cu

Peer Peer

Routing Follows the Money

Page 38: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Interdomain Routing: Setup● Destinations are IP prefixes (12.0.0.0/8)

● Nodes are Autonomous Systems (ASes)● Internals of each AS are hidden

● Links represent both physical links and business relationships

● BGP (Border Gateway Protocol) is the Interdomain routing protocol● Implemented by AS border routers

Page 39: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

BGP

Each AS selects the “best” route it hears advertised

for a prefix

An AS advertises its best routes

to one or more IP prefixes

Sound familiar?

Page 40: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

BGP Inspired by Distance Vector● Per-destination route advertisements

● No global sharing of network topology

● Iterative and distributed convergence on paths

● But, four key differences

Page 41: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

BGP vs. DV

● BGP selects route based on policy, not shortest distance/least cost

(1) BGP does not pick the shortest path routes!

2 3

1

Node 2 may prefer 2, 3, 1over 2, 1

● How do we avoid loops?

Page 42: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

BGP vs. DV

● Idea: advertise the entire path● Distance vector: send distance metric per dest. d● Path vector: send the entire path for each dest. d

(2) Path-vector Routing

C B A

d

“d: path (B,A)” “d: path (A)”

data traffic data traffic

Page 43: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Loop Detection with Path-Vector● Node can easily detect a loop● Look for its own node identifier in the path

● Node can simply discard paths with loops● e.g. node 1 sees itself in the path 3, 2, 1

3 2 1

“d: path (2,1)” “d: path (1)”

“d: path (3,2,1)”

d

Page 44: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

BGP vs. DV

● Idea: advertise the entire path● Distance vector: send distance metric per dest. d● Path vector: send the entire path for each dest. d

(2) Path-vector Routing

● Benefits● Loop avoidance is easy● Flexible policies based on entire path

Page 45: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

BGP vs. DV

● For policy reasons, an AS may choose not to advertise a route to a destination

(3) Selective Route Advertisement

● As a result, reachability is not guaranteed even if the graph is connected

AS 2

AS 3AS 1

Example: AS#2 does not want to carry traffic between AS#1 and AS#3

Page 46: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

BGP vs. DV

● For scalability, BGP may aggregate routes for different prefixes

(4) BGP may aggregate routes

AT&T a.0.0.0/8

LBL a.b.0.0/16

Cornella.c.0.0/16

a.*.*.* is this way

foo.com a.d.0.0/16

Page 47: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

BGP Outline● BGP Policy● Typical policies and implementation

● BGP protocol details

● Issues with BGP

Page 48: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Policy:

Imposed in how routes are selected and exported

Can reach 128.3/16

blah blah

Route selection

A

P

C

B

Q

Route export

● Selection: Which path to use● Controls whether / how traffic leaves the network

● Export: Which path to advertise● Controls whether / how traffic enters the network

Page 49: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Typical Selection Policy● In decreasing order of priority:

1. Make or save money (send to customer > peer > provider)2. Maximize performance (smallest AS path length)3. Minimize use of my network bandwidth (“hot potato”)4. …

Page 50: lecture14-IP-addressing-forwarding - Cornell …...Layer 3 (IP): Hierarchical addressing • Routing tables cannot have entry for each switch in the Internet • Use addresses of the

Typical Export Policy

Destination prefix advertised by… Export route to…

CustomerEveryone

(providers, peers, other customers)

Peer Customers

Provider Customers

Known as the “Gao-Rexford” rulesCapture common (but not required!) practice