csc358 week 9 - university of toronto

52
CSC358 Week 9 Adapted from slides by J.F. Kurose and K. W. Ross. All material copyright 1996-2016 J.F Kurose and K.W. Ross, All Rights Reserved

Upload: others

Post on 07-Feb-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSC358 Week 9 - University of Toronto

CSC358 Week 9

Adapted from slides by J.F. Kurose and K. W. Ross.All material copyright 1996-2016 J.F Kurose and K.W. Ross, All Rights Reserved

Page 2: CSC358 Week 9 - University of Toronto

Logistics

§ A3 out

Network Layer 4-2

Page 3: CSC358 Week 9 - University of Toronto

5.1 introduction5.2 routing protocols§ link state§ distance vector5.3 intra-AS routing in

the Internet: OSPF5.4 routing among the ISPs:

BGP

5.5 The SDN control plane5.6 ICMP: The Internet

Control Message Protocol

Outline

5-3Network Layer: Control Plane

Page 4: CSC358 Week 9 - University of Toronto

Making routing scalable

scale: with billions of destinations:

§ can�t store all destinations in routing tables!

§ routing table exchange would swamp links!

administrative autonomy§ internet = network of

networks§ each network admin may

want to control routing in its own network

our routing study thus far - idealized § all routers identical§ network �flat�… not true in practice

5-4Network Layer: Control Plane

Page 5: CSC358 Week 9 - University of Toronto

aggregate routers into regions known as �autonomous systems� (AS) (a.k.a. “domains”)

inter-AS routing§ routing among AS’es§ gateways perform inter-

domain routing (as well as intra-domain routing)

Internet approach to scalable routing

intra-AS routing§ routing among hosts, routers

in same AS (“network”)§ all routers in AS must run same intra-domain protocol

§ routers in differentAS can run different intra-domain routing protocol

§ gateway router: at “edge” of its own AS, has link(s) to router(s) in other AS’es

5-5Network Layer: Control Plane

Page 6: CSC358 Week 9 - University of Toronto

3b

1d

3a

1c2aAS3

AS1AS2

1a

2c2b

1b

Intra-ASRouting algorithm

Inter-ASRouting algorithm

Forwardingtable

3c

Interconnected ASes

§ forwarding table configured by both intra-and inter-AS routing algorithm• intra-AS routing

determine entries for destinations within AS

• inter-AS & intra-AS determine entries for external destinations

5-6Network Layer: Control Plane

Page 7: CSC358 Week 9 - University of Toronto

Inter-AS tasks§ suppose router in AS1

receives datagram destined outside of AS1:• router should forward

packet to gateway router, but which one?

AS1 must:1. learn which dests are

reachable through AS2, which through AS3

2. propagate this reachability info to all routers in AS1

job of inter-AS routing!

AS3

AS2

3b

3c3a

AS1

1c1a

1d1b

2a2c

2bothernetworks

othernetworks

5-7Network Layer: Control Plane

Page 8: CSC358 Week 9 - University of Toronto

Intra-AS Routing

§ also known as interior gateway protocols (IGP)§ most common intra-AS routing protocols:• RIP: Routing Information Protocol• OSPF: Open Shortest Path First (IS-IS protocol

essentially same as OSPF)• IGRP: Interior Gateway Routing Protocol

(Cisco proprietary for decades, until 2016)

5-8Network Layer: Control Plane

Page 9: CSC358 Week 9 - University of Toronto

OSPF (Open Shortest Path First)

§ �open�: publicly available§ uses link-state algorithm • link state packet dissemination• topology map at each node• route computation using Dijkstra�s algorithm

§ router floods OSPF link-state advertisements to all other routers in entire AS• carried in OSPF messages directly over IP (rather than

TCP or UDP• link state: for each attached link

5-9Network Layer: Control Plane

Page 10: CSC358 Week 9 - University of Toronto

OSPF �advanced� features

§ security: all OSPF messages authenticated (to prevent malicious intrusion)

§ multiple same-cost paths allowed (only one path in RIP)

§ for each link, multiple cost metrics for different ToS(e.g., satellite link cost set low for best effort ToS; high for real-time ToS)

§ integrated uni- and multi-cast support: • Multicast OSPF (MOSPF) uses same topology data

base as OSPF§ hierarchical OSPF in large domains.

5-10Network Layer: Control Plane

Page 11: CSC358 Week 9 - University of Toronto

5.1 introduction5.2 routing protocols§ link state§ distance vector5.3 intra-AS routing in the

Internet: OSPF5.4 routing among the

ISPs: BGP

5.5 The SDN control plane5.6 ICMP: The Internet

Control Message Protocol

Outline

5-11Network Layer: Control Plane

Page 12: CSC358 Week 9 - University of Toronto

Internet inter-AS routing: BGP§ BGP (Border Gateway Protocol): the de facto

inter-domain routing protocol• �glue that holds the Internet together�

§ BGP provides each AS a means to:• eBGP: obtain subnet reachability information from

neighboring ASes

• iBGP: propagate reachability information to all AS-internal routers.

• determine �good� routes to other networks based on reachability information and policy

§ allows subnet to advertise its existence to rest of Internet: �I am here�

5-12Network Layer: Control Plane

Page 13: CSC358 Week 9 - University of Toronto

eBGP, iBGP connections

eBGP connectivityiBGP connectivity

1b

1d

1c1a

2b

2d

2c2a3b

3d

3c3a

AS 2

AS 3AS 1

5-13Network Layer: Control Plane

1c

gateway routers run both eBGP and iBGP protocols

Page 14: CSC358 Week 9 - University of Toronto

BGP basics

§ when AS3 gateway router 3a advertises path AS3,X to AS2 gateway router 2c:

• AS3 promises to AS2 it will forward datagrams towards X

§ BGP session: two BGP routers (�peers�) exchange BGP messages over semi-permanent TCP connection:

• advertising paths to different destination network prefixes (BGP is a �path vector� protocol)

1b

1d

1c1a2b

2d

2c2a

3b

3d

3c3a

AS 2

AS 3AS 1

XBGP advertisement:AS3, X

5-14Network Layer: Control Plane

Page 15: CSC358 Week 9 - University of Toronto

Path attributes and BGP routes§ advertised prefix includes BGP attributes • prefix + attributes = �route�

§ two important attributes:• AS-PATH: list of ASes through which prefix advertisement

has passed• NEXT-HOP: indicates specific internal-AS router to next-

hop AS§ Policy-based routing:• gateway receiving route advertisement uses import policy to

accept/decline path (e.g., never route through AS Y).• AS policy also determines whether to advertise path to

other other neighboring ASes

5-15Network Layer: Control Plane

Page 16: CSC358 Week 9 - University of Toronto

BGP path advertisement

§ Based on AS2 policy, AS2 router 2c accepts path AS3,X, propagates (via iBGP) to all AS2 routers

1b

1d

1c1a2b

2d

2c2a

3b

3d

3c3a

AS2

AS3AS1

XAS3,X

AS2,AS3,X

§ AS2 router 2c receives path advertisement AS3,X (via eBGP) from AS3 router 3a

§ Based on AS2 policy, AS2 router 2a advertises (via eBGP) path AS2, AS3, X to AS1 router 1c

5-16Network Layer: Control Plane

Page 17: CSC358 Week 9 - University of Toronto

BGP path advertisement

§ AS1 gateway router 1c learns path AS2,AS3,X from 2a

1b

1d

1c1a2b

2d

2c2a

3b

3d

3c3a

AS2

AS3AS1

XAS3,X

AS2,AS3,X

gateway router may learn about multiple paths to destination:

AS3,X

§ AS1 gateway router 1c learns path AS3,X from 3a

§ Based on policy, AS1 gateway router 1c chooses path AS3,X, and advertises path within AS1 via iBGP

5-17Network Layer: Control Plane

Page 18: CSC358 Week 9 - University of Toronto

BGP messages

§ BGP messages exchanged between peers over TCP connection

§ BGP messages:• OPEN: opens TCP connection to remote BGP peer and

authenticates sending BGP peer• UPDATE: advertises new path (or withdraws old)• KEEPALIVE: keeps connection alive in absence of

UPDATES; also ACKs OPEN request• NOTIFICATION: reports errors in previous msg; also

used to close connection

5-18Network Layer: Control Plane

Page 19: CSC358 Week 9 - University of Toronto

BGP, OSPF, forwarding table entries

§ recall: 1a, 1b, 1c learn about dest X via iBGP from 1c: “path to X goes through 1c”

1b

1d

1c1a2b

2d

2c2a

3b

3d

3c3a

AS2

AS3AS1

XAS3,X

AS2,AS3,X

AS3,X

§ 1d: OSPF intra-domain routing: to get to 1c, forward over outgoing local interface 1

AS3,X

Q: how does router set forwarding table entry to distant prefix?

12

1

2

dest interface…

…X

…1

physical link

local link interfacesat 1a, 1d

5-19Network Layer: Control Plane

Page 20: CSC358 Week 9 - University of Toronto

BGP, OSPF, forwarding table entries

§ recall: 1a, 1b, 1c learn about dest X via iBGP from 1c: “path to X goes through 1c”

1b

1d

1c1a2b

2d

2c2a

3b

3d

3c3a

AS2

AS3AS1

X

§ 1d: OSPF intra-domain routing: to get to 1c, forward over outgoing local interface 1

Q: how does router set forwarding table entry to distant prefix?

dest interface…

…X

…2

§ 1a: OSPF intra-domain routing: to get to 1c, forward over outgoing local interface 2

1

2

5-20Network Layer: Control Plane

Page 21: CSC358 Week 9 - University of Toronto

BGP route selection§ router may learn about more than one route to

destination AS, selects route based on:1. local preference value attribute: policy decision2. shortest AS-PATH 3. closest NEXT-HOP router: hot potato routing4. additional criteria

5-21Network Layer: Control Plane

Page 22: CSC358 Week 9 - University of Toronto

Hot Potato Routing

§ 2d learns (via iBGP) it can route to X via 2a or 2c§ hot potato routing: choose local gateway that has least intra-

domain cost (e.g., 2d chooses 2a, even though more AS hops to X): don’t worry about inter-domain cost!

1b

1d

1c1a2b

2d

2c2a

3b

3d

3c3a

AS2

AS3AS1

XAS3,X

AS1,AS3,X

OSPF link weights201

152112

263

5-22Network Layer: Control Plane

Page 23: CSC358 Week 9 - University of Toronto

§ A advertises path Aw to B and to C§ B chooses not to advertise BAw to C:

§ B gets no �revenue� for routing CBAw, since none of C, A, w are B�s customers

§ C does not learn about CBAw path§ C will route CAw (not using B) to get to w

A

B

C

WX

Y

legend:

customer network:

providernetwork

Suppose an ISP only wants to route traffic to/from its customer networks (does not want to carry transit traffic between other ISPs)

5-23Network Layer: Control Plane

BGP: achieving policy via advertisements

Page 24: CSC358 Week 9 - University of Toronto

Why different Intra-, Inter-AS routing ?

policy:§ inter-AS: admin wants control over how its traffic

routed, who routes through its net. § intra-AS: single admin, so no policy decisions neededscale:§ hierarchical routing saves table size, reduced update

trafficperformance: § intra-AS: can focus on performance§ inter-AS: policy may dominate over performance

5-24Network Layer: Control Plane

Page 25: CSC358 Week 9 - University of Toronto

5.1 introduction5.2 routing protocols§ link state§ distance vector5.3 intra-AS routing in the

Internet: OSPF5.4 routing among the ISPs:

BGP

5.5 The SDN control plane

5.6 ICMP: The Internet Control Message Protocol

Outline

5-25Network Layer: Control Plane

Page 26: CSC358 Week 9 - University of Toronto

Software defined networking (SDN)

§ Internet network layer: historically has been implemented via distributed, per-router approach• monolithic router contains switching hardware, runs

proprietary implementation of Internet standard protocols (IP, RIP, IS-IS, OSPF, BGP) in proprietary router OS (e.g., Cisco IOS)

• different “middleboxes” for different network layer functions: firewalls, load balancers, NAT boxes, ..

§ ~2005: renewed interest in rethinking network control plane

5-26Network Layer: Control Plane

Page 27: CSC358 Week 9 - University of Toronto

Recall: per-router control plane

RoutingAlgorithm

Individual routing algorithm components in each and every router interact with each other in control plane to compute forwarding tables

dataplane

controlplane

4.1 • OVERVIEW OF NETWORK LAYER 309

tables. In this example, a routing algorithm runs in each and every router and both forwarding and routing functions are contained within a router. As we’ll see in Sec-tions 5.3 and 5.4, the routing algorithm function in one router communicates with the routing algorithm function in other routers to compute the values for its forward-ing table. How is this communication performed? By exchanging routing messages containing routing information according to a routing protocol! We’ll cover routing algorithms and protocols in Sections 5.2 through 5.4.

The distinct and different purposes of the forwarding and routing functions can be further illustrated by considering the hypothetical (and unrealistic, but technically feasible) case of a network in which all forwarding tables are configured directly by human network operators physically present at the routers. In this case, no routing protocols would be required! Of course, the human operators would need to interact with each other to ensure that the forwarding tables were configured in such a way that packets reached their intended destinations. It’s also likely that human configu-ration would be more error-prone and much slower to respond to changes in the net-work topology than a routing protocol. We’re thus fortunate that all networks have both a forwarding and a routing function!

Values in arrivingpacket’s header

1

23

Local forwardingtable

header

0100011001111001

1101

3221

output

Control plane

Data plane

Routing algorithm

Figure 4.2 ♦ Routing algorithms determine values in forward tables

M04_KURO4140_07_SE_C04.indd 309 11/02/16 3:14 PM

5-27Network Layer: Control Plane

Page 28: CSC358 Week 9 - University of Toronto

dataplane

controlplane

Recall: logically centralized control planeA distinct (typically remote) controller interacts with local control agents (CAs) in routers to compute forwarding tables

Remote Controller

CA

CA CA CA CA

5-28Network Layer: Control Plane

Page 29: CSC358 Week 9 - University of Toronto

Software defined networking (SDN)

Why a logically centralized control plane?§ easier network management: avoid router

misconfigurations, greater flexibility of traffic flows§ flow-based forwarding, allows “programming”

routers• centralized “programming” easier: compute tables

centrally and distribute• distributed “programming”: more difficult: compute

tables as result of distributed algorithm (protocol) implemented in each and every router

§ open (non-proprietary) implementation of control plane

5-29Network Layer: Control Plane

Page 30: CSC358 Week 9 - University of Toronto

Traffic engineering: difficult traditional routing

Q: what if network operator wants u-to-z traffic to flow along uvwz, x-to-z traffic to flow xwyz?

A: need to define link weights so traffic routing algorithm computes routes accordingly (or need a new routing algorithm)!

Link weights are only control “knobs”: wrong!5-30Network Layer: Control Plane

22

13

1

1

2

53

5

v w

u z

yx

Page 31: CSC358 Week 9 - University of Toronto

Traffic engineering: difficult

Q: what if network operator wants to split u-to-z traffic along uvwz and uxyz (load balancing)?

A: can’t do it (or need a new routing algorithm)

5-31Network Layer: Control Plane

22

13

1

1

2

53

5

v w

u z

yx

Page 32: CSC358 Week 9 - University of Toronto

yx

wv

z2

21

3

1

1

2

53

5

Traffic engineering: difficult

u

v

x

w

y

z

Q: what if w wants to route blue and red traffic differently?

A: can’t do it (with destination based forwarding, and LS, DV routing)

Networking 401

5-32Network Layer: Control Plane

Page 33: CSC358 Week 9 - University of Toronto

Read Textbook Chapter 5.5 for more details about SDN.

Page 34: CSC358 Week 9 - University of Toronto

5.1 introduction5.2 routing protocols§ link state§ distance vector5.3 intra-AS routing in the

Internet: OSPF5.4 routing among the ISPs:

BGP

5.5 The SDN control plane5.6 ICMP: The Internet

Control Message Protocol

Outline

5-34Network Layer: Control Plane

Page 35: CSC358 Week 9 - University of Toronto

ICMP: internet control message protocol

§ used by hosts & routers to communicate network-level information• error reporting:

unreachable host, network, port, protocol

• echo request/reply (used by ping)

§ network-layer �above� IP:• ICMP msgs carried in IP

datagrams§ ICMP message: type, code

plus first 8 bytes of IP datagram causing error

Type Code description0 0 echo reply (ping)3 0 dest. network unreachable3 1 dest host unreachable3 2 dest protocol unreachable3 3 dest port unreachable3 6 dest network unknown3 7 dest host unknown4 0 source quench (congestion

control - not used)8 0 echo request (ping)9 0 route advertisement10 0 router discovery11 0 TTL expired12 0 bad IP header

5-35Network Layer: Control Plane

Page 36: CSC358 Week 9 - University of Toronto

Traceroute and ICMP§ source sends series of

UDP segments to destination• first set has TTL =1• second set has TTL=2, etc.• unlikely port number

§ when datagram in nth set arrives to nth router:• router discards datagram and

sends source ICMP message (type 11, code 0, TTL expired)

• ICMP message include name of router & IP address

§ when ICMP message arrives, source records RTTs

stopping criteria:§ UDP segment eventually

arrives at destination host§ destination returns ICMP �port unreachable�message (type 3, code 3)

§ source stops

3 probes

3 probes

3 probes

5-36Network Layer: Control Plane

Page 37: CSC358 Week 9 - University of Toronto

Summary: Network Layer Control Plane

we’ve learned a lot!§ approaches to network control plane• per-router control (traditional)• logically centralized control (software defined networking)

§ traditional routing algorithms• link state algorithm, distance vector algorithms• implementation in Internet: OSPF, BGP

§ SDN controllers§ Internet Control Message Protocol§ network management

next stop: link layer!5-37Network Layer: Control Plane

Page 38: CSC358 Week 9 - University of Toronto

Going deeper: Link Layer

4-38

Page 39: CSC358 Week 9 - University of Toronto

Link layer and LANsour goals:§ understand principles behind link layer

services:• error detection, correction• sharing a broadcast channel: multiple access• link layer addressing• local area networks: Ethernet, VLANs

§ instantiation, implementation of various link layer technologies

6-39Link Layer and LANs

Page 40: CSC358 Week 9 - University of Toronto

Link layer: Outline

6.1 introduction, services6.2 error detection,

correction 6.3 multiple access

protocols6.4 LANs• addressing, ARP• Ethernet• switches• VLANS

6.5 link virtualization: MPLS

6.6 data center networking

6.7 a day in the life of a web request

6-40Link Layer and LANs

Page 41: CSC358 Week 9 - University of Toronto

Link layer: introductionterminology:§ hosts and routers: nodes§ communication channels that

connect adjacent nodes along communication path: links• wired links• wireless links• LANs

§ layer-2 packet: frame,encapsulates datagram

data-link layer has responsibility of transferring datagram from one node to physically adjacent node over a link

6-41Link Layer and LANs

Page 42: CSC358 Week 9 - University of Toronto

Link layer: context

§ datagram transferred by different link protocols over different links:• e.g., Ethernet on first link,

frame relay on intermediate links, 802.11 on last link

§ each link protocol provides different services• e.g., may or may not

provide rdt over link

transportation analogy:§ trip from Princeton to Lausanne

• limo: Princeton to JFK• plane: JFK to Geneva• train: Geneva to Lausanne

§ tourist = datagram§ transportation mode = link

layer protocol§ travel agent = routing

algorithm

6-42Link Layer and LANs

Page 43: CSC358 Week 9 - University of Toronto

Link layer services§ framing, link access:• encapsulate datagram into frame, adding header, trailer• channel access if shared medium• �MAC� addresses used in frame headers to identify source,

destination • different from IP address!

§ reliable delivery between adjacent nodes• we learned how to do this already!• seldom used on low bit-error link (fiber, some twisted pair)• wireless links: high error rates

• Q: why both link-layer and transport-layer reliability?

6-43Link Layer and LANs

Page 44: CSC358 Week 9 - University of Toronto

§ flow control:• pacing between adjacent sending and receiving nodes

§ error detection: • errors caused by signal attenuation, noise. • receiver detects presence of errors:

• signals sender for retransmission or drops frame

§ error correction:• receiver identifies and corrects bit error(s) without resorting to

retransmission

§ half-duplex and full-duplex• with half duplex, nodes at both ends of link can transmit, but not

at same time

Link layer services (more)

6-44Link Layer and LANs

Page 45: CSC358 Week 9 - University of Toronto

Where is the link layer implemented?§ in each and every host/node§ link layer implemented in �adaptor� (aka network interface card NIC) or on a chip• Ethernet card, 802.11 card;

Ethernet chipset• implements link, physical

layer§ attaches into host’s system

buses§ combination of hardware,

software, firmware

controller

physicaltransmission

cpu memory

host bus (e.g., PCI)

network adaptercard

applicationtransportnetworklink

linkphysical

6-45Link Layer and LANs

Page 46: CSC358 Week 9 - University of Toronto

Adaptors communicating

§ sending side:• encapsulates datagram in

frame• adds error checking bits,

rdt, flow control, etc.

§ receiving side• looks for errors, rdt,

flow control, etc.• extracts datagram, passes

to upper layer at receiving side

controller controller

sending host receiving host

datagram datagram

datagram

frame

6-46Link Layer and LANs

Page 47: CSC358 Week 9 - University of Toronto

Link layer, LANs: outline

6.1 introduction, services6.2 error detection,

correction 6.3 multiple access

protocols6.4 LANs• addressing, ARP• Ethernet• switches• VLANS

6.5 link virtualization: MPLS

6.6 data center networking

6.7 a day in the life of a web request

6-47Link Layer and LANs

Page 48: CSC358 Week 9 - University of Toronto

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

• Error detection not 100% reliable!• protocol may miss some errors, but rarely• larger EDC field yields better detection and correction

otherwise

6-48Link Layer and LANs

Page 49: CSC358 Week 9 - University of Toronto

Parity checking

single bit parity:§ detect single bit

errors

two-dimensional bit parity:§ detect and correct single bit errors

0 0

6-49Link Layer and LANs

Page 50: CSC358 Week 9 - University of Toronto

Internet checksum (review)

sender:§ treat segment contents

as sequence of 16-bit integers

§ checksum: addition (1�s complement sum) of segment contents

§ sender puts checksum value into UDP checksum field

receiver:§ compute checksum of

received segment§ check if computed

checksum equals checksum field value:• NO - error detected• YES - no error detected.

But maybe errors nonetheless?

goal: detect �errors� (e.g., flipped bits) in transmitted packet (note: used at transport layer only)

6-50Link Layer and LANs

Page 51: CSC358 Week 9 - University of Toronto

Cyclic Redundancy Check (CRC)§ more powerful error-detection coding§ view data bits, D, as a binary number§ choose r+1 bit pattern (generator), G§ goal: choose r CRC bits, R, such that

• <D,R> exactly divisible by G (modulo 2) • receiver knows G, divides <D,R> by G. If non-zero remainder:

error detected!• can detect burst bit errors

§ widely used in practice (Ethernet, 802.11 WiFi, ATM)

6-51Link Layer and LANs

Page 52: CSC358 Week 9 - University of Toronto

CRC examplewant:

D.2r xor R = nGequivalently:

D.2r “+” R = nGD.2r “-” R = nG

(when binary modulo 2, x+y mod 2 = x–y mod 2 = x xor y)

equivalently:if we divide D.2r by G, want remainder R to satisfy:

6-52Link Layer and LANs

A xor B = C ó A = B xor C ó B = A xor C

More details on the math: https://www.cs.jhu.edu/~scheideler/courses/600.344_S02/CRC.html

R = remainder[ ]D.2r

G