35
1 ELEN 602 Lecture 19 • Routing

1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

  • View
    221

  • Download
    2

Embed Size (px)

Citation preview

Page 1: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

1

ELEN 602 Lecture 19

• Routing

Page 2: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

2

Overview

• Forwarding vs Routing– forwarding: to select an output port based on destination address

and routing table– routing: process by which routing table is built

• Network as a Graph

• Problem: Find lowest cost path between two nodes• Factors

– static: topology– dynamic: load

4

3

6

21

9

1

1D

A

FE

B

C

Page 3: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

3

Routing Algorithms

• Distance Vector– Each node constructs a vector of distances to its

neighbors and transmits it to neighbors– Use this information in building routing tables

• Link State– Disseminate link state information of neighbors

to everyone– Construct routing tables based on the sum of

information from all the nodes

Page 4: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

4

Distance Vector

• Each node maintains a set of triples – (Destination, Cost, NextHop)

• Exchange updates with directly connected neighbors– periodically ( on the order of several seconds)– whenever its table changes (called triggered update)

• Each update is a list of pairs:– (Destination, Cost)

• Update local table if receive a “better” route– smaller cost– came from next-hop

• Refresh existing routes; delete if they time out

Page 5: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

5

Example

Destination Cost NextHop A 1 A C 1 C D 2 C E 2 A F 2 A G 3 A

D

G

A

F

E

B

C

Page 6: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

6

Initial Distances(Global View)

Information at Distance to Reach Node

Node A B C D E F G

A 0 1 1 Inf 1 1 Inf

B 1 0 1 Inf Inf Inf Inf

C 1 1 0 1 Inf Inf Inf

D Inf Inf 1 0 Inf Inf 1

E 1 Inf Inf Inf 0 Inf Inf

F 1 Inf Inf Inf Inf 0 1

G Inf Inf Inf 1 Inf 1 0

Page 7: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

7

Initial Routing Table at A

Destination Cost Nexthop

B 1 B

C 1 C

D Inf ---

E 1 E

F 1 E

G Inf. ----

Page 8: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

8

Routing Table Updates

• Update an entry if a new distance vector shows a shorter route to destination.

• A shortest distance path to a destination consists of shortest distance paths between intermediate nodes.

– D(I, J) = min ( D(I, K) + D(K, J) ), over all K

• Bellman-Ford or Ford-Fulkerson Algorithm

• Periodic Updates based on timers

• Triggered updates --based on noticed changes in distance vector

• Recompute distances based on updates.

Page 9: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

9

Example Network

• When A hears from C, it finds a distance 2 path to D through C - update routing table entry for D.

• When A hears from D, it finds a distance 3 path to G through D -updates routing table entry for G.

• When A hears from F, it finds a distance 2 path to G through F -updates routing table entry for G.

Page 10: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

10

Final Routing Table at A

Destination Cost Nexthop

B 1 B

C 1 C

D 2 C

E 1 E

F 1 E

G 2 F

Page 11: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

11

Final Distances(Global View)

Information at Distance to Reach Node

Node A B C D E F G

A 0 1 1 2 1 1 2

B 1 0 1 2 2 2 3

C 1 1 0 1 2 2 2

D 2 2 1 0 3 2 1

E 1 2 2 3 0 2 3

F 1 2 2 2 2 0 1

G 2 3 2 1 3 1 0

Page 12: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

12

Routing Loops

• Example 1– F detects that link to G has failed– F sets distance to G to infinity and sends update t o A– A sets distance to G to infinity since it uses F to reach G– A receives periodic update from C with 2-hop path to G– A sets distance to G to 3 and sends update to F– F decides it can reach G in 4 hops via A

• Example 2– link from A to E fails– A advertises distance of infinity to E– B and C advertise a distance of 2 to E– B decides it can reach E in 3 hops through C; advertises this to A– A decides it can read E in 4 hops; advertises this to C– C decides that it can reach E in 5 hops…

Page 13: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

13

1

2

3

4

5

6

A

B

Switch or router

Host

Example Network

Page 14: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

14

2 2 3 3 4 4 5 2 6 3

Node 1

Node 2

Node 3

Node 4

Node 6

Node 5

1 1 2 4 4 4 5 6 6 6

1 3 2 5 3 3 4 3 5 5

Destination Next node

1 1 3 1 4 4 5 5 6 5

1 4 2 2 3 4 4 4 6 6

1 1 2 2 3 3 5 5 6 3

Destination Next node

Destination Next node

Destination Next node

Destination Next nodeDestination Next node

Routing Tables for Example Network

Page 15: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

15

1

2

3

4

5

6

1

1

2

32

3

5

2

4

Sample Network with link costs

Page 16: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

16

1

2

3

4

5

6

1

1

2

2

2

Shortest-path Tree to Node 6

Page 17: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

17

1

2

3

4

5

6

1

2

32

3

5

2

4

X

New Network with link 3-6 broken

Page 18: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

18

Routing entries to Destination Node 6

Update 1 2 3 4 5

Before break (3,3) (4,4) (6,1) (3,3) (6,2)

1 (3,3) (4,4) (4,5) (3,3) (6,2)

2 (3,7) (4,4) (4,5) (2,5) (6,2)

3 (3,7) (4,6) (4,7) (2,5) (6,2)

4 (2,9) (4,6) (4,7) (5,5) (6,2)

5 (2,9) (4,6) (4,7) (5,5) (6,2)

Each entry = (Next node, distance)

Page 19: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

19

31 2 41 1 1

31 2 41 1

X

(a)

(b)

Problems with link failures

Page 20: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

20

Routing Table

Update Node 1 Node 2 Node3

Before Break (2,3) (3,2) (4,1)

After Break (2,3) (3,2) (3,3)

1 (2,3) (3,4) (3,3)

2 (2,5) (3,4) (3,5)

3 (2,5) (3,6) (3,5)

4 (2,7) (3,6) (3,7)

……. …….. ……. …...

Page 21: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

21

Loop-Breaking Heuristics

• Set infinity to 16

• Split horizon

– Don’t send minimum cost to neighbor if neighbor is the NextHop

• Split horizon with poison reverse

– Send minimum cost to all neighbors, but set infinity to the NextHop neighbor

• Work satisfactorily in some cases

Page 22: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

22

Routing Table Example(Split Horizon with Poisoned Reverse)

Update Node 1 Node 2 Node3

Before break (2,3) (3,2) (4,1)

After break (2,3) (3,2) (-1,Inf)

1 (2,3) (-1, Inf) (-1,Inf)

2 (-1, Inf) (-1,Inf) (-1,Inf)

Page 23: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

23

Link State

• Strategy– send to all nodes (not just neighbors) information

about directly connected links (not entire routing table)

• Link State Packet (LSP)– id of the node that created the LSP– cost of the link to each directly connected

neighbor– sequence number (SEQNO)– time-to-live (TTL) for this packet

Page 24: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

24

Link State (cont)

• Reliable flooding– store most recent LSP from each node– forward LSP to all nodes but one that sent it– generate new LSP periodically

• increment SEQNO– start SEQNO at 0 when reboot– decrement TTL of each stored LSP

• discard when TTL=0

Page 25: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

25

Route Calculation

• Dijkstra’s shortest path algorithm• Let

– N denotes set of nodes in the graph– l (i, j) denotes non-negative cost (weight) for edge (i, j)– s denotes this node– M denotes the set of nodes incorporated so far– C(n) denotes cost of the path from s to node n

M = {s}for each n in N - {s}

C(n) = l(s, n)while (N != M)

M = M union {w} such that C(w)is the minimum for all w in (N - M)for each n in (N - M)

C(n) = MIN(C(n), C (w) + l(w, n ))

Page 26: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

26

Example Route Calculation

Iteration N 2 3 4 5 6

0 {1} 3 2 5 Inf Inf

1 {1,3} 3 2 4 Inf 3

2 {1,2,3} 3 2 4 7 3

3 {1,2,3,6} 3 4 4 5 3

4 {1,2,3,4,6} 3 2 4 5 3

5 {1,2,3,4,5,6} 3 2 4 5 3

Page 27: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

27

1

2

3

4

5

6

1

2

2

3

2

Shortest-path tree from node 1

Page 28: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

28

Metrics

• Original ARPANET metric– measures number of packets enqueued on each link– took neither latency or bandwidth into consideration

• New ARPANET metric– stamp each incoming packet with its arrival time (AT)– record departure time (DT)– when link-level ACK arrives, compute

Delay = (DT - AT) + Transmit + Latency

– if timeout, reset DT to departure time for retransmission – link cost = average delay over some time period

• Fine Tuning– compressed dynamic range– replaced dynamic with link utilization

Page 29: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

29

How to Make Routing Scale

• Flat versus Hierarchical Addresses

• Inefficient use of Hierarchical Address Space

– class C with 2 hosts (2/255 = 0.78% efficient)

– class B with 256 hosts (256/65535 = 0.39% efficient)

• Still Too Many Networks

– routing tables do not scale

– route propagation protocols do not scale

Page 30: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

30

0000 0001 0010 0011

0100 0101 0110 0111

1100 1101 1110 1111

1000 1001 1010 1011

R1R2

1

2 5

4

3

00 1 01 3 10 2 11 3

00 3 01 4 10 3 11 5

(a)

0000 0111 1010 1101

0001 0100 1011 1110

0011 0101 1000 1111

0011 0110 1001 1100

R1R2

1

2 5

4

3

0000 1 0111 1 1010 1 … …

0001 4 0100 4 1011 4 … …

(b)

Figure 7.27

Page 31: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

31

Subnetting

• Add another level to address/routing hierarchy: subnet• Subnet masks define variable partition of host part• Subnets visible only within site

Network number Host number

Class B address

Subnet mask (255.255.255.0)

Subnetted address

111111111111111111111111 00000000

Network number Host IDSubnet ID

Page 32: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

32

Subnet Example

Forwarding table at router R1Subnet Number Subnet Mask Next Hop

128.96.34.0 255.255.255.128 interface 0

128.96.34.128 255.255.255.128 interface 1

128.96.33.0 255.255.255.0 R2

Subnet mask: 255.255.255.128Subnet number: 128.96.34.0

128.96.34.15 128.96.34.1

H1R1

128.96.34.130Subnet mask: 255.255.255.128Subnet number: 128.96.34.128

128.96.34.129128.96.34.139

R2H2

128.96.33.1128.96.33.14

Subnet mask: 255.255.255.0Subnet number: 128.96.33.0

H3

Page 33: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

33

Forwarding Algorithm

D = destination IP addressfor each entry (SubnetNum, SubnetMask, NextHop) D1 = SubnetMask & D if D1 = SubnetNum if NextHop is an interface deliver datagram directly to D else deliver datagram to NextHop

• Use a default router if nothing matches• Not necessary for all 1s in subnet mask to be contiguous • Can put multiple subnets on one physical network• Subnets not visible from the rest of the Internet

Page 34: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

34

Supernetting

• Assign block of contiguous network numbers to nearby networks

• Called CIDR: Classless Inter-Domain Routing

• Represent blocks with a single pair

(first_network_address, count)• Restrict block sizes to powers of 2

• Use a bit mask (CIDR mask) to identify block size

• All routers must understand CIDR addressing

Page 35: 1 ELEN 602 Lecture 19 Routing. 2 Overview Forwarding vs Routing –forwarding: to select an output port based on destination address and routing table –routing:

35

Route Propagation

• Know a smarter router– hosts know local router– local routers know site routers– site routers know core router– core routers know everything

• Autonomous System (AS)– corresponds to an administrative domain– examples: University, company, backbone network– assign each AS a 16-bit number

• Two-level route propagation hierarchy– interior gateway protocol (each AS selects its own)– exterior gateway protocol (Internet-wide standard)