network layer - university of washington · 2020-02-11 · •network service models •datagrams...

181
Network Layer

Upload: others

Post on 13-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Network Layer

Page 2: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Where we are in the Course

• Moving on up to the Network Layer!

CSE 461 University of Washington 2

Physical

Link

Network

Transport

Application

Page 3: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Network Layer

• How to connect different link layer networks• Routing as the primary concern

CSEP 561 University of Washington 3

Physical

Link

Network

Transport

Application

Page 4: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Why do we need a Network layer?

• We can already build networks with links and switches and send frames between hosts …

CSEP 561 University of Washington 4

Page 5: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Shortcomings of Switches

1. Don’t scale to large networks• Blow up of routing table, broadcast

CSEP 561 University of Washington 5

Table for all destinations in the world!

Broadcast new destinations to the whole world!

Page 6: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Shortcomings of Switches (2)

2. Don’t work across more than one link layer technology

• Hosts on Ethernet + 3G + 802.11 …

CSEP 561 University of Washington 6

Can we play too? Go away!

Page 7: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Shortcomings of Switches (3)

3. Don’t give much traffic control• Want to plan routes / bandwidth

CSEP 561 University of Washington 7

That was lame.

Page 8: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Network Layer Approach

• Scaling:• Hierarchy, in the form of prefixes

• Heterogeneity:• IP for internetworking

• Bandwidth Control:• Lowest-cost routing

• Later QOS (Quality of Service)

CSEP 561 University of Washington 8

Page 9: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Topics

• Network service models• Datagrams (packets), virtual circuits

• IP (Internet Protocol)• Internetworking

• Forwarding (Longest Matching Prefix)

• Helpers: ARP and DHCP

• Errors: ICMP (traceroute!)• IPv6, scaling IP to the world

• NAT, and “middleboxs”

• Routing Algorithms

CSEP 561 University of Washington 9

Page 10: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing vs. Forwarding

• Routing is the process of deciding in which direction to send traffic

• Network wide (global) and expensive

CSEP 561 University of Washington 10

Which way?

Which way?

Which way?

Page 11: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing vs. Forwarding (2)

• Forwarding is the process of sending a packet • Node process (local) and fast

CSEP 561 University of Washington 11

Forward!packet

Page 12: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Networking Services

Page 13: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Topic

• What kind of service does the Network layer provide to the Transport layer?

• How is it implemented at routers?

CSEP 561 University of Washington 13

Service? What’s he talking about?

Page 14: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Two Network Service Models

• Datagrams, or connectionless service• Like postal letters• (IP as an example)

• Virtual circuits, or connection-oriented service• Like a telephone call• Cut for space

CSEP 561 University of Washington 14

Page 15: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Store-and-Forward Packet Switching

• Implemented with store-and-forward packet switching

• Routers receive a complete packet, storing it temporarily if necessary before forwarding it onwards

• We use statistical multiplexing to share link bandwidth over time

CSEP 561 University of Washington 15

Page 16: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Store-and-Forward (2)

• Switching element has internal buffering for contention

CSEP 561 University of Washington 16

. . .

. . .

. . . . . .

Input Buffer Output BufferFabric

Input Output

Page 17: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Store-and-Forward (3)

• Simplified view with per port output buffering• Buffer is typically a FIFO (First In First Out) queue• If full, packets are discarded (congestion, later)

CSEP 561 University of Washington 17

(FIFO) Queue

QueuedPackets

Router

Router

=

Page 18: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Datagram Model

• Packets contain a destination address; each router uses it to forward packets, maybe on different paths

CSEP 561 University of Washington 18

ISP’s equipment

Page 19: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Datagram Model (2)

• Each router has a forwarding table keyed by address• Gives next hop for each destination address; may change

CSEP 561 University of Washington 19

A’s table (initially) A’s table (later) C’s Table E’s Table

BB

Page 20: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IP (Internet Protocol)

• Network layer of the Internet, uses datagrams (next)• IPv4 carries 32 bit addresses on each packet (often 1.5 KB)

20

Payload (e.g., TCP segment)

Page 21: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Internetworking (IP)

Page 22: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Topic

• How do we connect different networks together?• This is called internetworking• We’ll look at how IP does it

CSEP 561 University of Washington 22

Hi there! Hi yourself

Page 23: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

How Networks May Differ

• Basically, in a lot of ways:• Service model (datagrams, Virtual Circuits)• Addressing (what kind)

• QOS (priorities, no priorities)

• Packet sizes

• Security (whether encrypted)

• Internetworking hides the differences with a common protocol. (Uh oh.)

CSEP 561 University of Washington 23

Page 24: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Internetworking – Cerf and Kahn

• Pioneers: Cerf and Kahn• “Fathers of the Internet”• In 1974, later led to TCP/IP

• Tackled the problems of interconnecting networks

• Instead of mandating a single network technology

CSEP 561 University of Washington 24

© 2009 IEEE

Vint Cerf Bob Kahn

Page 25: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Internet Reference Model

• Internet Protocol (IP) is the “narrow waist” • Supports many different links below and apps above

25

4. Application

3. Transport

2. Internet

1. LinkEthernet

802.11

IP

TCP UDP

HTTPSMTP RTP DNS

3G

DSLCable

Page 26: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IP as a Lowest Common Denominator

• Suppose only some networks support QOS or security etc.

• Difficult for internetwork to support

• Pushes IP to be a “lowest common denominator”• Asks little of lower-layer networks• Gives little as a higher layer service

CSEP 561 University of Washington 26

Page 27: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IPv4 (Internet Protocol)

• Various fields to meet straightforward needs• Version, Header (IHL), Total length, Protocol, and Header Checksum

27

Payload (e.g., TCP segment)

Page 28: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Payload (e.g., TCP segment)

IPv4 (2)

• Some fields to handle packet size differences• Identification, Fragment offset, Fragment control bits

28

Page 29: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Payload (e.g., TCP segment)

IPv4 (3)

• Other fields to meet other needs (later, later)• Differentiated Services, Time to live (TTL)

29

Later, with ICMP

Later, with QOS

Page 30: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Payload (e.g., TCP segment)

IPv4 (4)

• Network layer of the Internet, uses datagrams • Provides a layer of addressing above link addresses (next)

30

Page 31: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IP Addresses

• IPv4 uses 32-bit addresses• Later we’ll see IPv6, which uses 128-bit addresses

• Written in “dotted quad” notation• Four 8-bit numbers separated by dots

CSEP 561 University of Washington 31

aaaaaaaabbbbbbbbccccccccdddddddd ↔ A.B.C.D

8 bits 8 bits 8 bits 8 bits

00010010000111110000000000000001 ↔

Page 32: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IP Prefixes

• Addresses are allocated in blocks called prefixes• Addresses in an L-bit prefix have the same top L bits• There are 232-L addresses aligned on 232-L boundary

CSEP 561 University of Washington 32

Page 33: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IP Prefixes (2)

• Written in “IP address/length” notation• Address is lowest address in the prefix, length is prefix bits• E.g., 128.13.0.0/16 is 128.13.0.0 to 128.13.255.255• So a /24 (“slash 24”) is 256 addresses, and a /32 is one

address

CSEP 561 University of Washington 33

000100100001111100000000xxxxxxxx ↔

↔ 128.13.0.0/16

Page 34: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Classful IP Addressing

• Originally, IP addresses came in fixed size blocks with the class/size encoded in the high-order bits

• They still do, but the classes are now ignored

CSEP 561 University of Washington 34

0 16 24 32 bits8

Class A, 224 addresses

Class B, 216 addresses

Class C, 28 addresses

Network portion Host portion

Page 35: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Classful IP Addressing

• This is an ARPANet assignment.

Page 36: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IP Forwarding

• Addresses on one network belong to a unique prefix

• Node uses a table that lists the next hop for prefixes

CSEP 561 University of Washington 36

D

CB

A

Prefix Next Hop

192.24.0.0/19 D

192.24.12.0/22 B

Page 37: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Longest Matching Prefix

• Prefixes in the table might overlap!• Combines hierarchy with flexibility

• Longest matching prefix forwarding rule:• For each packet, find the longest prefix that contains the

destination address, i.e., the most specific entry• Forward the packet to the next hop router for that prefix

CSEP 561 University of Washington 37

Page 38: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Longest Matching Prefix (2)

CSEP 561 University of Washington 38

Prefix Next Hop

192.24.0.0/19 D

192.24.12.0/22 B

192.24.0.0

192.24.63.255

/19

/22

192.24.12.0

192.24.15.255

IP address

192.24.6.0 → 192.24.14.32 →192.24.54.0 →

More specific

Page 39: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IP Address Work Slide:

• Route to D = 192.00011x.x.x

• Route to B = 192.00011000.000011x.x

• 192.24.6.0 = 192.00011000.00000110.00000000

• 192.24.14.32 = 192.00011000.00001110.00010000

• 192.24.54.0 = 192.00011000.00110110.00000000

Page 40: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Longest Matching Prefix (2)

CSEP 561 University of Washington 40

Prefix Next Hop

192.24.0.0/19 D

192.24.12.0/22 B

192.24.0.0

192.24.63.255

/19

/22

192.24.12.0

192.24.15.255

IP address

192.24.6.0 → D 192.24.14.32 → B192.24.54.0 → D

More specific

Page 41: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Host/Router Distinction

• In the Internet:• Routers do the routing, know way to all destinations• Hosts send remote traffic (out of prefix) to nearest router

CSEP 561 University of Washington 41

It’s my job to know which way to go …

Not for my network? Send it to the gateway (router)

Page 42: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Host Networking

• Consists of 4 pieces of data:• IP Address• Subnet Mask

• Defines local addresses

• Gateway• Who (local) to send non-local packets to for routing

• DNS Server (Later)

Page 43: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Host Forwarding Table

• Give using longest matching prefix• 0.0.0.0/0 is a default route that catches all IP addresses

CSEP 561 University of Washington 43

Prefix Next Hop

My network prefix Send to that IP

0.0.0.0/0 Send to my router

Page 44: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Flexibility of Longest Matching Prefix

• Can provide default behavior, with less specifics• Send traffic going outside an organization to a border

router (gateway)

• Can special case behavior, with more specifics• For performance, economics, security, …

CSEP 561 University of Washington 44

Page 45: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Performance of Longest Matching Prefix

• Uses hierarchy for a compact table• Relies on use of large prefixes

• Lookup more complex than table• Used to be a concern for fast routers• Not an issue in practice these days

CSEP 561 University of Washington 45

Page 46: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing

Page 47: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing versus Forwarding

• Forwarding is the process of sending a packet on its way

• Routing is the process of deciding in which direction to send traffic

CSEP 561 University of Washington 47

Forward!packet

Which way?

Which way?

Which way?

Page 48: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Improving on the Spanning Tree

• Spanning tree provides basic connectivity

• e.g., some path B→C

• Routing uses all links to find “best” paths

• e.g., use BC, BE, and CE

CSEP 561 University of Washington 48

A B C

D E F

A B C

D E F

Unused

Page 49: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Perspective on Bandwidth Allocation

• Routing allocates network bandwidth adapting to failures; other mechanisms used at other timescales

CSEP 561 University of Washington 49

Mechanism Timescale / Adaptation

Load-sensitive routing Seconds / Traffic hotspots

Routing Minutes / Equipment failures

Traffic Engineering Hours / Network load

Provisioning Months / Network customers

Page 50: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Delivery Models

• Different routing used for different delivery models

CSEP 561 University of Washington 50

Unicast(§5.2)

Multicast(§5.2.8)

Anycast(§5.2.9)

Broadcast(§5.2.7)

Page 51: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Goals of Routing Algorithms

• We want several properties of any routing scheme:

CSEP 561 University of Washington 51

Property Meaning

Correctness Finds paths that work

Efficient paths Uses network bandwidth well

Fair paths Doesn’t starve any nodes

Fast convergence Recovers quickly after changes

Scalability Works well as network grows large

Page 52: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Rules of Routing Algorithms

• Decentralized, distributed setting• All nodes are alike; no controller• Nodes only know what they learn by exchanging messages

with neighbors • Nodes operate concurrently • May be node/link/message failures

CSEP 561 University of Washington 52

Who’s there?

Page 53: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Host/Router Combination

• Hosts attach to routers as IP prefixes (usually /32)• Router needs table to reach all hosts

CSEP 561 University of Washington 53

Rest ofnetwork

IP router“A”

Single network(One IP prefix “P”)

LAN switch

Page 54: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Network Topology for Routing

• Send out routes for hosts you have paths to• “Advertise” the routes• And the routes you’ve received

CSEP 561 University of Washington 54

PA

B

EE

B

A,B,E

Page 55: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Network Topology for Routing (2)

• Routing now works!• Routers advertise IP prefixes for hosts• Router addresses are “/32” prefixes• Lets all routers find a path to hosts• Hosts find by sending to their router

CSEP 561 University of Washington 55

Page 56: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IP Prefix Aggregation and Subnets

Page 57: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Idea

• Scale routing by adjusting the size of IP prefixes• Split (subnets) and join (aggregation)

CSEP 561 University of Washington 57

I’m the whole region

Region1

2

3

IP /16IP1 /18

IP2 /18

IP3 /17

Page 58: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Prefixes and Hierarchy

• IP prefixes help to scale routing, but can go further• Use a less specific (larger) IP prefix as a name for a region

CSEP 561 University of Washington 58

I’m the whole region

Region

1

2

3

IP /16IP1 /18

IP2 /18

IP3 /17

Page 59: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Subnets and Aggregation

• Two use cases for adjusting the size of IP prefixes; both reduce routing table

1. Subnets• Internally split one large prefix into multiple smaller ones

2. Aggregation• Join multiple smaller prefixes into one large prefix

CSEP 561 University of Washington 59

Page 60: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Subnets

• Internally split up one IP prefix

32K addresses

One prefix sent to rest of Internet16K

8K

4K Company Rest of Internet

Page 61: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Aggregation

• Externally join multiple separate IP prefixes

One prefix sent to rest of Internet

\

ISPRest of Internet

Page 62: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing Process

1. Ship these prefixes or regions around to nearby routers

2. Receive multiple prefixes and the paths of how you got them

3. Build a global routing table

Page 63: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Best Path Routing

Page 64: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

CSEP 561 University of Washington 64

What are “Best” paths anyhow?• Many possibilities:

• Latency, avoid circuitous paths• Bandwidth, avoid slow links• Money, avoid expensive links• Hops, to reduce switching

• But only consider topology• Ignore workload, e.g., hotspots

A B

C

D

E

F

G

H

Page 65: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Shortest Paths

We’ll approximate “best” by a cost function that captures the factors

• Often call lowest “shortest”

1. Assign each link a cost (distance)

2. Define best path between each pair of nodes as the path that has the lowest total cost (or is shortest)

3. Pick randomly to any break tiesCSEP 561 University of Washington 65

Page 66: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

CSEP 561 University of Washington 66

Shortest Paths (2)

• Find the shortest path A → E

• All links are bidirectional, with equal costs in each direction

• Can extend model to unequal costs if needed A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

Page 67: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

CSEP 561 University of Washington 67

Shortest Paths (3)

• ABCE is a shortest path

• dist(ABCE) = 4 + 2 + 1 = 7

• This is less than:• dist(ABE) = 8• dist(ABFE) = 9• dist(AE) = 10• dist(ABCDE) = 10

A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

Page 68: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

CSEP 561 University of Washington 68

Shortest Paths (4)

• Optimality property:• Subpaths of shortest paths are

also shortest paths

• ABCE is a shortest path So are ABC, AB, BCE, BC, CE

A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

Page 69: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

CSEP 561 University of Washington 69

Sink Trees

• Sink tree for a destination is the union of all shortest paths towards the destination

• Similarly source tree

• Find the sink tree for E A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

Page 70: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

CSEP 561 University of Washington 70

Sink Trees (2)

• Implications:• Only need to use destination to

follow shortest paths• Each node only need to send to

the next hop

• Forwarding table at a node• Lists next hop for each

destination• Routing table may know more

A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

Page 71: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Link-State Routing

Page 72: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Link-State Routing

• Broad class of routing algorithms• Other is distance vector which is used when computation

is harder

• Widely used in practice• Used in Internet/ARPANET from 1979• Modern networks use OSPF (L3) and IS-IS (L2)

CSEP 561 University of Washington 72

Page 73: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Link-State Setting

Nodes compute their forwarding table in the classic distributed setting:

1. Nodes know only the cost to their neighbors; not topology

2. Nodes can talk only to their neighbors using messages

3. All nodes run the same algorithm concurrently

4. Nodes/links may fail, messages may be lost

CSEP 561 University of Washington 73

Page 74: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Link-State Algorithm

Proceeds in two phases:

1. Nodes flood topology with link state packets• Each node learns full topology

2. Each node computes its own forwarding table• By running Dijkstra (or equivalent)

CSEP 561 University of Washington 74

Page 75: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Part 1: Flood Routing

Page 76: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Flooding

• Rule used at each node:• Sends an incoming message on to all other neighbors• Remember the message so that it is only flooded once

CSEP 561 University of Washington 76

Page 77: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Flooding (2)

• Consider a flood from A; first reaches B via AB, E via AE

CSEP 561 University of Washington 77

A B

C

D

E

F

G

H

Page 78: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Flooding (3)

• Next B floods BC, BE, BF, BG, and E floods EB, EC, ED, EF

CSEP 561 University of Washington 78

A B

C

D

E

F

G

H

E and B send to each other

Page 79: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Flooding (4)

• C floods CD, CH; D floods DC; F floods FG; G floods GF

79

A B

C

D

E

F

G

H

F gets another copy

Page 80: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Flooding (5)

• H has no-one to flood … and we’re done

CSEP 561 University of Washington 80

A B

C

D

E

F

G

H

Each link carries the message, and in at least one direction

Page 81: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Flooding Details

• Remember message (to stop flood) using source and sequence number

• So next message (with higher sequence) will go through

• To make flooding reliable, use ARQ• So receiver acknowledges, and sender resends if needed

CSEP 561 University of Washington 81

Page 82: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Flooding Details

• Remember message (to stop flood) using source and sequence number

• So next message (with higher sequence) will go through

• To make flooding reliable, use ARQ• So receiver acknowledges, and sender resends if needed

CSEP 561 University of Washington 82

Problem?

Page 83: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Flooding Problem

• F receives the same message multiple times

CSEP 561 University of Washington 83

A B

C

D

E

F

G

H

E and B send to each other too

Page 84: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Part 2: Dijkstra’s Algorithm

Page 85: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

CSEP 561 University of Washington 85

Edsger W. Dijkstra (1930-2002)

• Famous computer scientist• Programming languages• Distributed algorithms• Program verification

• Dijkstra’s algorithm, 1969• Single-source shortest paths, given

network with non-negative link costsBy Hamilton Richards, CC-BY-SA-3.0, via Wikimedia Commons

Page 86: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Dijkstra’s Algorithm

Algorithm:

• Mark all nodes tentative, set distances from source to 0 (zero) for source, and ∞ (infinity) for all other nodes

• While tentative nodes remain:• Extract N, a node with lowest distance• Add link to N to the shortest path tree• Relax the distances of neighbors of N by lowering any

better distance estimatesCSEP 561 University of Washington 86

Page 87: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Dijkstra’s Algorithm (2)

• Initialization

CSEP 561 University of Washington 87

A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

0 ∞

∞ ∞

We’ll compute shortest paths

from A ∞

Page 88: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Dijkstra’s Algorithm (3)

• Relax around A

CSEP 561 University of Washington 88

A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

0 ∞

∞ 10

4

Page 89: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Dijkstra’s Algorithm (4)

• Relax around B

CSEP 561 University of Washington 89

A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

0∞

8

4

Distance fell!

6

7

7

Page 90: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Dijkstra’s Algorithm (5)

• Relax around C

CSEP 561 University of Washington 90

A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

0

7

4

Distance fellagain!

6

7

7

8

9

Page 91: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Dijkstra’s Algorithm (6)

• Relax around G (say)

CSEP 561 University of Washington 91

A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

0

7

4

Didn’t fall …

6

7

7

8

9

Page 92: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Dijkstra’s Algorithm (7)

• Relax around F (say)

CSEP 561 University of Washington 92

A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

0

7

4

Relax has no effect

6

7

7

8

9

Page 93: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Dijkstra’s Algorithm (8)

• Relax around E

CSEP 561 University of Washington 93

A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

0

7

4

6

7

7

8

9

Page 94: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Dijkstra’s Algorithm (9)

• Relax around D

CSEP 561 University of Washington 94

A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

0

7

4

6

7

7

8

9

Page 95: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Dijkstra’s Algorithm (10)

• Finally, H … done

CSEP 561 University of Washington 95

A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

0

7

4

6

7

7

8

9

Page 96: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Dijkstra Comments

• Finds shortest paths in order of increasing distance from source

• Leverages optimality property

• Runtime depends on cost of extracting min-cost node

• Superlinear in network size (grows fast) • Using Fibonacci Heaps the complexity turns out to be

O(|E|+|V|log| V|)

• Gives complete source/sink tree• More than needed for forwarding!

CSEP 561 University of Washington 96

Page 97: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Bringing it all together…

Page 98: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

CSEP 561 University of Washington 98

Phase 1: Topology Dissemination• Each node floods link state packet

(LSP) that describes their portion of the topology

A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

Seq. #

A 10

B 4

C 1

D 2

F 2

Node E’s LSP flooded to A, B, C, D, and F

Page 99: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Phase 2: Route Computation

• Each node has full topology• By combining all LSPs

• Each node simply runs Dijkstra• Replicated computation, but finds required routes directly• Compile forwarding table from sink/source tree• That’s it folks!

CSEP 561 University of Washington 99

Page 100: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Forwarding Table

CSEP 561 University of Washington 100

To Next

A C

B C

C C

D D

E --

F F

G F

H C

A B

C

D

E

F

G

H

2

1

10

2

2

4

24

4

3

3

3

Source Tree for E (from Dijkstra) E’s Forwarding Table

Page 101: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Handling Changes

• On change, flood updated LSPs, re-compute routes• E.g., nodes adjacent to failed link or node initiate

CSEP 561 University of Washington 101

A B

C

D

E

F

G

H

2

1

10

2

24

24

4

3

3

3

XXXXSeq. #

A 4

C 2

E 4

F 3

G ∞

B’s LSPSeq. #

B 3

E 2

G ∞

F’s LSPFailure!

Page 102: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Handling Changes (2)

• Link failure• Both nodes notice, send updated LSPs• Link is removed from topology

• Node failure• All neighbors notice a link has failed (link state!)• Failed node can’t update its own LSP• But it is OK: all links to node removed

CSEP 561 University of Washington 102

Page 103: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Handling Changes (3)

• Addition of a link or node• Add LSP of new node to topology• Old LSPs are updated with new link

• Additions are the easy case …

CSEP 561 University of Washington 103

Page 104: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Link-State Complications

• Things that can go wrong:• Seq. number reaches max, or is corrupted• Node crashes and loses seq. number• Network partitions then heals

• Strategy:• Include age on LSPs and forget old information that is not

refreshed

• Much of the complexity is due to handling corner cases

CSEP 561 University of Washington 104

Page 105: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Border Gateway Protocol (BGP)

Page 106: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Structure of the Internet

• Networks (ISPs, CDNs, etc.) group with IP prefixes• Networks are richly interconnected, often using IXPs

CDN C

Prefix C1

ISP A

Prefix A1

Prefix A2Net F

Prefix F1

IXPIXP

IXPIXP

CDN D

Prefix D1

Net E

Prefix E1

Prefix E2

ISP B

Prefix B1

Page 107: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Internet-wide Routing Issues

• Two problems beyond routing within a network

1. Scaling to very large networks• Techniques of IP prefixes, hierarchy, prefix aggregation

2. Incorporating policy decisions• Letting different parties choose their routes to suit their

own needs

CSEP 561 University of Washington 107

Yikes!

Page 108: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

CSEP 561 University of Washington 108

Effects of Independent Parties

• Each party selects routes to suit its own interests

• e.g, shortest path in ISP

• What path will be chosen for A2→B1 and B1→A2?

• What is the best path?Prefix B2

Prefix A1

ISP A ISP B

Prefix B1

Prefix A2

Page 109: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

CSEP 561 University of Washington 109

Effects of Independent Parties (2)

• Selected paths are longer than overall shortest path

• And symmetric too!

• This is a consequence of independent goals and decisions, not hierarchy Prefix B2

Prefix A1

ISP A ISP B

Prefix B1

Prefix A2

Page 110: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing Policies

• Capture the goals of different parties• Could be anything• E.g., Internet2 only carries non-commercial traffic

• Common policies we’ll look at:• ISPs give TRANSIT service to customers• ISPs give PEER service to each other

CSEP 561 University of Washington 110

Page 111: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

CSEP 561 University of Washington 111

Routing Policies – Transit• One party (customer) gets TRANSIT

service from another party (ISP)• ISP accepts traffic for customer from

the rest of Internet• ISP sends traffic from customer to the

rest of Internet• Customer pays ISP for the privilege

Customer 1

ISP

Customer 2

Rest ofInternet

Non-customer

Page 112: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

CSEP 561 University of Washington 112

Routing Policies – Peer• Both party (ISPs in example) get

PEER service from each other• Each ISP accepts traffic from the other

ISP only for their customers• ISPs do not carry traffic to the rest of

the Internet for each other• ISPs don’t pay each other

Customer A1

ISP A

Customer A2

Customer B1

ISP B

Customer B2

Page 113: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing with BGP (Border Gateway Protocol)• iBGP is for internal routing

• eBGP is interdomain routing for the Internet• Path vector, a kind of distance vector

113

ISP APrefix A1

Prefix A2Net F

Prefix F1

IXP

ISP BPrefix B1 Prefix F1 via ISP

B, Net F at IXP

Page 114: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing with BGP (2)

•Parties like ISPs are called AS (Autonomous Systems)• AS numbers assigned by regional Internet Assigned

Numbers Authority (IANA) like APNIC

•AS’s MANUALLY configure their internal BGP routes/advertisements

•External routes go through complicated filters for forwarding/filtering

•AS BGP routers communicate with each other to CSEP 561 University of Washington 114

Page 115: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing with BGP (2)

•Border routers of ASes announce BGP routes

•Route announcements have IP prefix, path vector, next hop• Path vector is list of ASes on the way to the prefix• List is to find loops

•Route announcements move in the opposite direction to traffic

CSEP 561 University of Washington 115

Page 116: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing with BGP (3)

CSEP 561 University of Washington 116

• Application-layer protocol (uses TCP)

• Types of BGP Messages

• Open: Create a relationship

• Keepalive: Still here (reset timeouts)

• Update: A route changed

• Notification: Error message

• Route Refresh: Please send me the route again

Page 117: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing with BGP (5)

CSEP 561 University of Washington 117

Prefix

Page 118: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing with BGP (5)

CSEP 561 University of Washington 118

Page 119: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing with BGP (6)

Policy is implemented in two ways:

1. Border routers of ISP announce paths only to other parties who may use those paths

• Filter out paths others can’t use

2. Border routers of ISP select the best path of the ones they hear in any, non-shortest way

CSEP 561 University of Washington 119

Page 120: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing with BGP (7)

• TRANSIT: AS1 says [B, (AS1, AS3)], [C, (AS1, AS4)] to AS2

CSEP 561 University of Washington 120

Page 121: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing with BGP (8)

• CUSTOMER (other side of TRANSIT): AS2 says [A, (AS2)] to AS1

CSEP 561 University of Washington 121

Page 122: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing with BGP (9)

• PEER: AS2 says [A, (AS2)] to AS3, AS3 says [B, (AS3)] to AS2

CSEP 561 University of Washington 122

Page 123: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Routing with BGP (10)

• AS2 has two routes to B (AS1, AS3) and chooses AS3 (Free!)

CSEP 561 University of Washington 123

Page 124: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding
Page 125: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding
Page 126: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

BGP Thoughts

•Much more beyond basics to explore!

•Policy is a substantial factor• Can independent decisions be sensible overall?

•Other important factors:• Convergence effects• How well it scales• Integration with intradomain routing• And more …

CSEP 561 University of Washington 126

Page 127: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IP Services

Page 128: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Issues?

• What else is missing?

Page 129: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Issues?

• Where does this break down?

Bootstrapping (DHCP)

Finding Link nodes (ARP)

Errors in the network (ICMP)

Running out of addresses (IPv6, NAT)

Page 130: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Dynamic Host Configuration Protocol (DHCP)

Page 131: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Bootstrapping

• Problem:• A node wakes up for the first time …• What is its IP address? What’s the IP address of its router? • At least Ethernet address is on NIC

CSEP 561 University of Washington 131

What’s my IP?

Page 132: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Bootstrapping (2)

1. Manual configuration (old days)• Can’t be factory set, depends on use

2. DHCP: Automatically configure addresses • Shifts burden from users to IT folk

CSEP 561 University of Washington 132

Use A.B.C.DWhat’s my IP?

Page 133: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

DHCP

• DHCP (Dynamic Host Configuration Protocol), from 1993, widely used

• It leases IP address to nodes

• Provides other parameters too• Network prefix• Address of local router• DNS server, time server, etc.

CSEP 561 University of Washington 133

Page 134: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

DHCP Protocol Stack

• DHCP is a client-server application• Uses UDP ports 67, 68

CSEP 561 University of Washington 134

Ethernet

IP

UDP

DHCP

Page 135: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

DHCP Addressing

• Bootstrap issue:• How does node send a message to DHCP server before it

is configured?

• Answer:• Node sends broadcast messages that delivered to all

nodes on the network• Broadcast address is all 1s• IP (32 bit): 255.255.255.255• Ethernet (48 bit): ff:ff:ff:ff:ff:ff

CSEP 561 University of Washington 135

Page 136: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

DHCP Messages

CSEP 561 University of Washington 136

Client Server

One link

Page 137: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

DHCP Messages (2)

CSEP 561 University of Washington 137

Client Server

DISCOVER

REQUEST

OFFER

ACK

All Broadcast (255.255.255.255)

Page 138: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

DHCP Messages (3)

• To renew an existing lease, an abbreviated sequence is used:

• REQUEST, followed by ACK

• Protocol also supports replicated servers for reliability

CSEP 561 University of Washington 138

Page 139: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Address Resolution Protocol (ARP)

Page 140: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Sending an IP Packet

• Problem:• A node needs Link layer addresses to send a frame over

the local link• How does it get the destination link address from a

destination IP address?

CSEP 561 University of Washington 140

Uh oh … My IP is 1.2.3.4

Page 141: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

ARP (Address Resolution Protocol)

• Node uses to map a local IP address to its Link layer addresses

CSEP 561 University of Washington 141

SourceEthernet

Dest.Ethernet

Source IP

Dest.IP Payload …

Link layer

FromDHCP

FromNIC

From ARP

Page 142: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

ARP Protocol Stack

• ARP sits right on top of link layer• No servers, just asks node with target IP to identify itself• Uses broadcast to reach all nodes

CSEP 561 University of Washington 142

Ethernet

ARP

Page 143: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

ARP Messages

CSEP 561 University of Washington 143

Node Target

One link

Page 144: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

ARP Messages (2)

[root@host ~]# tcpdump -lni any arp & ( sleep 1; arp -d 10.0.0.254; ping -c1 -n 10.0.0.254 )

listening on any, link-type LINUX_SLL (Linux cooked), capture size 96 bytes

17:58:02.155495 arp who-has 10.2.1.224 tell 10.2.1.253

17:58:02.317444 arp who-has 10.0.0.96 tell 10.0.0.253

17:58:02.370446 arp who-has 10.3.1.12 tell 10.3.1.61

CSEP 561 University of Washington 144

Node Target

REQUEST Broadcast

Who has IP 1.2.3.4?

REPLY

I do at 1:2:3:4:5:6

Page 145: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

ARP Table

# arp -an | grep 10

? (10.241.1.114) at 00:25:90:3e:dc:fc [ether] on vlan241

? (10.252.1.8) at 00:c0:b7:76:ac:19 [ether] on vlan244

? (10.252.1.9) at 00:c0:b7:76:ae:56 [ether] on vlan244

? (10.241.1.111) at 00:30:48:f2:23:fd [ether] on vlan241

? (10.252.1.6) at 00:c0:b7:74:fb:9a [ether] on vlan244

? (10.241.1.121) at 00:25:90:2c:d4:f7 [ether] on vlan241

[...]

Page 146: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Discovery Protocols

• Help nodes find each other• There are more of them!

• E.g., Zeroconf, Bonjour

• Often involve broadcast• Since nodes aren’t introduced• Very handy glue

CSEP 561 University of Washington 146

Page 147: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Internet Control Message Protocol (ICMP)

Page 148: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Topic

• Problem: What happens when something goes wrong during forwarding?

• Need to be able to find the problem

CSEP 561 University of Washington 148

Yikes!What happened?XXXXXXX

Page 149: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Internet Control Message Protocol

• ICMP is a companion protocol to IP• They are implemented together• Sits on top of IP (IP Protocol=1)

• Provides error report and testing• Error is at router while forwarding• Also testing that hosts can use

CSEP 561 University of Washington 149

Page 150: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

ICMP Errors

• When router encounters an error while forwarding:• It sends an ICMP error report back to the IP source• It discards the problematic packet; host needs to rectify

CSEP 561 University of Washington 150

Report then toss it!Oh, now I see …

XXXXXXX

ICMP report

Page 151: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

ICMP Message Format (2)

• Each ICMP message has a Type, Code, and Checksum

• Often carry the start of the offending packet as payload

• Each message is carried in an IP packet

CSEP 561 University of Washington 151

Src=router, Dst=AProtocol = 1

Type=X, Code=YSrc=A, Dst=B

XXXXXXXXXXXXXXX

Portion of offending packet,starting with its IP header

ICMP headerIP header ICMP data

Page 152: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Example ICMP Messages

CSEP 561 University of Washington 152

Name Type / Code Usage

Dest. Unreachable (Net or Host) 3 / 0 or 1 Lack of connectivity

Dest. Unreachable (Fragment) 3 / 4 Path MTU Discovery

Time Exceeded (Transit) 11 / 0 Traceroute

Echo Request or Reply 8 or 0 / 0 Ping

Testing, not a forwarding error: Host sends Echo Request, and destination responds with an Echo Reply

Page 153: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Traceroute

• IP header contains TTL (Time to live) field• Decremented every router hop, with ICMP error at zero• Protects against forwarding loops

CSEP 561 University of Washington 153

Page 154: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Traceroute (2)

• Traceroute repurposes TTL and ICMP functionality• Sends probe packets increasing TTL starting from 1• ICMP errors identify routers on the path

CSEP 561 University of Washington 154

. . . LocalHost

RemoteHost1 hop 2 hops

3 hops N-1 hopsN hops

Page 155: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Network Address Translation (NAT)

Page 156: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

CSEP 561 University of Washington 156

• Many billions of hosts

• And we’re using 32-bit addresses!

Problem: Internet Growth

Page 157: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

The End of New IPv4 Addresses

• Now running on leftover blocks held by the regional registries; much tighter allocation policies

CSEP 561 University of Washington 157

IANA(All IPs)

ARIN (US, Canada)

APNIC(Asia Pacific)

RIPE(Europe)

LACNIC(Latin Amer.)

AfriNIC(Africa)

ISPs

Companies

Exhaustedon 2/11! End of the world ? 12/21/12?

Exhaustedon 4/11

and 9/12!

Page 158: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Solution 1: Network Address Translation (NAT)

• Basic idea: Map many “Private” IP addresses to one “Public” IP.

• Allocate IPs for private use (192.168.x, 10.x)

CSEP 561 University of Washington 158

I’m a NAT box too!

Internet

Page 159: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Layering Review

• Remember how layering is meant to work?• “Routers don’t look beyond the IP header.” Well …

CSEP 561 University of Washington 159

TCP

IP

802.11

App

IP

802.11

IP

Ethernet

TCP

IP

802.11

App

IP

802.11

IP

Ethernet

Router

Page 160: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Middleboxes

• Sit “inside the network” but perform “more than IP” processing on packets to add new functionality

• NAT box, Firewall / Intrusion Detection System

CSEP 561 University of Washington 160

TCP

IP

802.11

App

IP

802.11

IP

Ethernet

TCP

IP

802.11

App

IP

802.11

IP

Ethernet

Middlebox

App / TCP

Page 161: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Middleboxes (2)

• Advantages• A possible rapid deployment path when no other option• Control over many hosts (IT)

• Disadvantages• Breaking layering interferes with connectivity

• strange side effects

• Poor vantage point for many tasks

CSEP 561 University of Washington 161

Page 162: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

NAT (Network Address Translation)

• NAT box maps an internal IP to an external IP• Many internal hosts connected using few external addresses• Middlebox that “translates addresses”

• Motivated by IP address scarcity• Controversial at first, now accepted

CSEP 561 University of Washington 162

Page 163: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

NAT (2)

• Common scenario:• Home computers use “private” IP addresses

• 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16• NAT (in AP/firewall) connects home to ISP using a single

external IP address

163

ISP

Unmodified computers at home Looks like one computer outside

NAT box

Page 164: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

How NAT Works

• Keeps an internal/external translation table• Typically uses IP address + TCP port• This is address and port translation

• Need ports to make mapping 1-1 since there are fewer external IPs

164

Internal IP : port External IP : port

192.168.1.12 : 5523 44.25.80.3 : 1500

192.168.1.13 : 1234 44.25.80.3 : 1501

192.168.2.20 : 1234 44.25.80.3 : 1502

What ISP thinksWhat host thinks

Page 165: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

How NAT Works (2)

• Internal → External:• Look up and rewrite Source IP/port

CSEP 561 University of Washington 165

Internal IP:port External IP : port

192.168.1.12 : 5523 44.25.80.3 : 1500

NAT

External destinationIP=X, port=Y

Internalsource

Dst =

Src =

Dst =

Src = 192.168.1.12:5523

123.1.1.10:5000

Page 166: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

How NAT Works (2)

• Internal → External:• Look up and rewrite Source IP/port

CSEP 561 University of Washington 166

Internal IP:port External IP : port

192.168.1.12 : 5523 44.25.80.3 : 1500

NAT

External destinationIP=X, port=Y

Internalsource

Src =

Dst =

Src =

Dst =

192.168.1.12:5523

123.1.1.10:5000

44.25.80.3:1500

123.1.1.10:5000

Page 167: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

How NAT Works (3)

• External ← Internal• Look up and rewrite Destination IP/port

CSEP 561 University of Washington 167

Internal IP:port External IP : port

192.168.1.12 : 5523 44.25.80.3 : 1500

NAT

External source

IP=X, port=Y

Internaldestination

Src =

Dst =

Src =

Dst =

123.1.1.10:5000

192.168.1.12:5523

123.1.1.10:5000

44.25.80.3:1500

Page 168: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

How NAT Works (4)

• Need to enter translations in the table for it to work• Create external name when host makes a TCP connection

CSEP 561 University of Washington 168

Internal IP:port External IP : port

192.168.1.12 : 5523

NAT

External destinationIP=X, port=Y

Internalsource

Src =

Dst =

Src =

Dst =

192.168.1.12:5523

123.1.1.10:5000

?

123.1.1.10:5000

Page 169: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

How NAT Works (5)

• What happens when a message arrives for an internal source without a table entry?

CSEP 561 University of Washington 169

Internal IP:port External IP : port

192.168.1.12 : 5523

NAT

External destinationIP=X, port=Y

Internalsource

Src =

Dst =

Src =

Dst =

123.1.1.10:5000

?

123.1.1.10:5000

44.25.80.3:1500

Page 170: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

NAT Downsides

• Connectivity has been broken!• Can only send incoming packets after an outgoing

connection is set up• Difficult to run servers or peer-to-peer apps (Skype)

• Doesn’t work when there are no connections (UDP)

• Breaks apps that expose their IP addresses (FTP)

CSEP 561 University of Washington 170

Page 171: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

NAT Upsides

• Relieves much IP address pressure• Many home hosts behind NATs

• Easy to deploy• Rapidly, and by you alone

• Useful functionality• Firewall, helps with privacy

• Kinks will get worked out eventually• “NAT Punching/Traversal” for incoming traffic

CSEP 561 University of Washington 171

Page 172: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IPv6

Page 173: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Problem: Internet Growth

• Many billions of hosts

• And we’re using 32-bit addresses!

CSEP 561 University of Washington 173

Page 174: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IP Version 6 to the Rescue

• Effort started by the IETF in 1994• Much larger addresses (128 bits)• Many sundry improvements

• Became an IETF standard in 1998• Nothing much happened for a decade• Hampered by deployment issues, and a lack of adoption

incentives • Big push ~2011 as exhaustion loomed

CSEP 561 University of Washington 174

Page 175: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IPv6

• Features large addresses• 128 bits, most of header

• New notation• 8 groups of 4 hex digits (16 bits)• Omit leading zeros, groups of zeros

CSEP 561 University of Washington 175

Ex: 2001:0db8:0000:0000:0000:ff00:0042:8329→ 2001:db8::ff00:42:8329

32 bits

Page 176: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IPv6 (2)

• Lots of other changes• Only public addresses

• No more NAT!

• Streamlined header processing• Flow label to group of packets• IPSec by default• Better fit with “advanced” features (mobility, multicasting,

security)

CSEP 561 University of Washington 176

32 bits

Page 177: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IPv6 (3)

• Does this fix ARP?• Does this fix DHCP?• Does this fix NAT?

CSEP 561 University of Washington 177

32 bits

Page 178: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IPv6 (3)

• Does this fix ARP? No: NDP• Does this fix DHCP? No: SLAAC• Does this fix NAT? Yes!

CSEP 561 University of Washington 178

32 bits

Page 179: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Neighbor Discovery Protocol

• Uses ICMPv6• DHCP Functions:⚫Router discovery (133)/advertisement (134)

• ARP Functions:⚫Neighbor discovery (135)/advertisement (136)

CSEP 561 University of Washington 179

Page 180: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

Stateless Autoconfiguration (SLAAC)

• Replaces DHCP (sorta…)

• Uses ICMPv6

• Process:• Send broadcast message• Get prefix from router• Attach MAC to router Prefix /w some math⚫ 48 bit → EUI-64 format

CSEP 561 University of Washington 180

MAC: 0200:1234:5678 → 0000:12FF:FE34:5678Address: 2000:1234:5678::12FF:FE34:5678

Address: 2000:1234:5678::1001/64Prefix: 2000:1234:5678:: /64

Page 181: Network Layer - University of Washington · 2020-02-11 · •Network service models •Datagrams (packets), virtual circuits •IP (Internet Protocol) •Internetworking •Forwarding

IPv6 Transition

• The Big Problem:• How to deploy IPv6?• Fundamentally incompatible with IPv4

• Dozens of approaches proposed• Dual stack (speak IPv4 and IPv6)• Translators (convert packets)• Tunnels (carry IPv6 over IPv4)

CSEP 561 University of Washington 181