Sei sulla pagina 1di 12

IP Forwarding

•  The Story So Far…


•  IP addresses are structured to reflect
15-441 Computer Networking Internet structure
•  IP packet headers carry these addresses
Router"

•  When Packet Arrives at Router


•  Examine header to determine intended
Lecture 11: Intra-Domain Routing destination
•  Look up in table to determine next hop
in path
RIP (Routing Information Protocol) & •  Send packet out appropriate port
OSPF (Open Shortest Path First) •  This/next lecture
•  How to generate the forwarding table

Graph Model Routes from Node A


•  Represent each router as node Forwarding Table for A E! 3! C
•  Direct link between routers represented by edge Dest Cost Next
1!

•  Symmetric links ⇒ undirected graph Hop F! 1!


2!
•  Edge “cost” c(x,y) denotes measure of difficulty of using link A 0 A 6!
B 4 B 1!
•  delay, $ cost, or congestion level
3! D
•  Task C 6 E A 4!

•  Determine least cost path from every node to every other node D 7 B B

•  Path cost d(x,y) = sum of link costs E 2 E


F 5 E
E! 3! C
1!
•  Properties
F! 1!
2! •  Some set of shortest paths forms tree
6!
1! •  Shortest path spanning tree
3! D •  Solution not unique
A 4!
B •  E.g., A-E-F-C-D also has cost 7
3 4

1
Ways to Compute Shortest Paths Outline
•  Centralized
•  Collect graph structure in one place
•  Use standard graph algorithm •  Distance Vector
•  Disseminate routing tables

•  Link-state •  Link State


•  Every node collects complete graph structure
•  Each computes shortest paths from it
•  Each generates own routing table
•  Routing Hierarchy
•  Distance-vector
•  No one has copy of graph
•  Nodes construct their own tables iteratively
•  Each sends information about its table to neighbors

5 6

Distance-Vector Method Distance-Vector Update


Initial Table for A z!
Dest Cost Next E! 3! C d(z,y)!
Hop 1!
c(x,z)!
A 0 A F! 1!
2!
B 4 B 6!
1! y!
C ∞ – x!
3! D d(x,y)!
D ∞ – A 4!

E 2 E B
F 6 F
•  Update(x,y,z)
d ← c(x,z) + d(z,y) # Cost of path from x to y with first hop z
•  Idea if d < d(x,y)
•  At any time, have cost/next hop of best known path to destination
# Found better path
•  Use cost ∞ when no path known
return d,z # Updated cost / next hop
•  Initially else
•  Only have entries for directly connected nodes
return d(x,y), nexthop(x,y) # Existing cost / next hop
7 8

2
Algorithm Start
Optimum 1-hop paths!
•  Bellman-Ford algorithm Table for A Table for B
E! C
Dst Cst Hop Dst Cst Hop 3! 1!
•  Repeat A 0 A A 4 A 1!
F!
For every node x B 4 B B 0 B 2!
6!
C ∞ – C ∞ –
For every neighbor z D ∞ – D 3 D
1!
3! D
A 4!
For every destination y E 2 E E ∞ –
B
F 6 F F 1 F
d(x,y) ← Update(x,y,z) Table for C Table for D Table for E Table for F

•  Until converge Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop
A ∞ – A ∞ – A 2 A A 6 A
B ∞ – B 3 B B ∞ – B 1 B
C 0 C C 1 C C ∞ – C 1 C
D 1 D D 0 D D ∞ – D ∞ –
E ∞ – E ∞ – E 0 E E 3 E
F 1 F F ∞ – F 3 F F 0 F
9 10

Iteration #1 Iteration #2
Optimum 2-hop paths! Optimum 3-hop paths!
Table for A Table for B Table for A Table for B
E! 3! C E! 3! C
Dst Cst Hop Dst Cst Hop 1! Dst Cst Hop Dst Cst Hop 1!
A 0 A A 4 A 1! A 0 A A 4 A 1!
2! F! 2! F!
B 4 B B 0 B B 4 B B 0 B
6! 6!
C 7 F C 2 F 1! C 6 E C 2 F 1!
D 7 B D 3 D 3! D D 7 B D 3 D 3! D
A 4! A 4!
E 2 E E 4 F E 2 E E 4 F
B B
F 5 E F 1 F F 5 E F 1 F
Table for C Table for D Table for E Table for F Table for C Table for D Table for E Table for F
Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop Dst Cst Hop
A 7 F A 7 B A 2 A A 5 B A 6 F A 7 B A 2 A A 5 B
B 2 F B 3 B B 4 F B 1 B B 2 F B 3 B B 4 F B 1 B
C 0 C C 1 C C 4 F C 1 C C 0 C C 1 C C 4 F C 1 C
D 1 D D 0 D D ∞ – D 2 C D 1 D D 0 D D 5 F D 2 C
E 4 F E ∞ – E 0 E E 3 E E 4 F E 5 C E 0 E E 3 E
F 1 F F 2 C F 3 F F 0 F F 1 F F 2 C F 3 F F 0 F
11 12

3
Distance Vector: Link Cost Distance Vector: Link Cost
Changes Changes
Link cost changes: Link cost changes:
1 60
•  Node detects local link cost change Y •  Good news travels fast Y
•  Updates distance table 4 1 4 1
X •  Bad news travels slow - X
•  If cost change in least cost path, notify Z Z
50 “count to infinity” problem! 50
neighbors

algorithm algorithm
terminates continues
“good on!
news
travels
fast”

13 14

Distance Vector: Split Horizon Distance Vector: Poison Reverse

If Z routes through Y to get to X : 60 If Z routes through Y to get to X : 60


Y Y
•  Z does not advertise its route to X back to Y 4 1 •  Z tells Y its (Z’s) distance to X is infinite (so Y won’t 4 1
X Z route to X via Z) X Z
50 •  Immediate notification of unreachability, rather than 50
split horizon timeout waiting for advertisement
algorithm •  Will this completely solve count to infinity problem?
algorithm
terminates terminates

? ? ?

15 16

4
Poison Reverse Failures Routing Information Protocol (RIP)

Dst
Table for A
Cst Hop Dst
Table for B
Cst Hop Dst
Table for D
Cst Hop Dst
Table for F
Cst Hop
•  Earliest IP routing protocol (1982 BSD)
C 7 F C 8 A C 9 B C 1 C
∞!
1!
•  Current standard is version 2 (RFC 1723)
Dst
Table for A
Cst Hop Forced! Forced!
Dst
Table for F
Cst Hop
6!
F! C •  Features
Update! Update!
C ∞ – C ∞ – A •  Every link has cost 1
1!
Table for A
Better! 4!
•  “Infinity” = 16
Dst Cst Hop 1!
C 13 D
Route!
D
B •  Limits to networks where everything reachable within
Table for B
15 hops
Forced!
Update! Dst Cst Hop •  Iterations don’t converge •  Sending Updates
C 14 A •  “Count to infinity”
•  Every router listens for updates on UDP port 520
Forced!
Table for D
•  Solution
Update! Dst Cst Hop
•  Make “infinity” smaller
•  RIP message can contain entries for up to 25 table
C 15 B
•  What is upper bound on
entries
Table for A
•!
Dst Cst Hop Forced! •! maximum path length?
Update!
C 19 D •!
17 18

RIP Updates RIP Staleness / Oscillation Control

•  Initial •  Small Infinity


•  When router first starts, asks for copy of table for every neighbor •  Count to infinity doesn’t take very long
•  Uses it to iteratively generate own table •  See… Chuck Norris isn’t the only one that can count to
•  Periodic infinity (twice!) J (http://www.count-to-infinity.com/)
•  Every 30 seconds, router sends copy of its table to each neighbor •  Route Timer
•  Neighbors use it to iteratively update their tables •  Every route has timeout limit of 180 seconds
•  Triggered •  Reached when haven’t received update from next hop for
6 periods
•  When every entry changes, send copy of entry to neighbors
•  If not updated, set to infinity
•  Except for one causing update (split horizon rule)
•  Soft-state refresh à important concept!
•  Neighbors use it to update their tables
•  Behavior
•  When router or link fails, can take minutes to stabilize

19 20

5
Outline Link State Protocol Concept

•  Every node gets complete copy of graph


•  Distance Vector •  Every node “floods” network with data about its
outgoing links
•  Every node computes routes to every other node
•  Link State
•  Using single-source, shortest-path algorithm
•  Process performed whenever needed
•  Routing Hierarchy •  When connections die / reappear

21 22

Sending Link States by Flooding Dijkstra’s Algorithm

•  X Wants to Send X A X A
•  Given
Information •  Graph with source node s and edge costs c(u,v)
C B D C B D
•  Sends on all outgoing •  Determine least cost path from s to every node v
(a) (b)
links •  Shortest Path First Algorithm
•  When Node Y Receives X A X A •  Traverse graph in order of least cost from source
Information from Z C B D C B D
•  Send on all links other (c) (d)
than Z

23 24

6
Dijkstra’s Algorithm: Concept Dijkstra’s Algorithm: Initially
∞! ∞!
2! E! C ∞! E! 3! C
3! 1! ∞! 1!
5!
Current Path Costs! ! Current Path Costs!
2! F! 2!
2! F! 2!
6! 6!
1! 1!
Source! 0! ∞! Source! 0! ∞!
3! 3! D ∞! 3! D
Node! A 3! Node! A 3!
B Horizon! B
Done!
Unseen! Done! Unseen!
Horizon!
• Node Sets
•  Done •  Label
• Already have least cost path to it •  d(v) = path cost from s to v
•  No nodes done
•  Horizon: •  Path
• Reachable in 1 hop from node in •  Keep track of last link in path
•  Source in horizon
Done
•  Unseen:
• Cannot reach directly from node in
Done
25 26

Dijkstra’s Algorithm: Initially Dijkstra’s Algorithm


∞!
2! E! 3! C ∞!
6! 1! 2! E! C
3! 1!
! Current Path Costs! 5! 6!
F! 2! Current Path Costs!
2! 2!
2! F!
6!
1! 6!
Source! 0! ∞! 1!
3! 3! D Source! 0! ∞!
Node! A 3! 3! D
Node! 3!
A 3!
B
Done! B
Horizon! Unseen! Done!
Unseen!
Horizon!

•  d(v) to node A shown in red


•  Only consider links from done nodes •  Select node v in horizon with minimum d(v)
•  Add link used to add node to shortest path tree
•  Update d(v) information
27 28

7
Dijkstra’s Algorithm Dijkstra’s Algorithm

∞! Unseen!
Horizon! ∞! 2! E! 3! C
2! E! 3! C 4! 1!
5! 1!
Current Path Costs!
Current Path Costs! F! 2!
2! 2!
2! F!
6!
6! 1!
1! Source! 0! 6!
Source! 0! ∞! 3! 3! D
3! 3! D Node! A 3!
Node! A 3!
B Horizon!
B Done!
Done!
Unseen!

•  Repeat… •  Update d(v) values


•  Can cause addition of new nodes to horizon

29 30

Dijkstra’s Algorithm Link State Characteristics

5!
2! E! 3!
4! 1!
C •  With consistent
F! 2! LSDBs*, all nodes B
2!
6! compute consistent 1
X
1
Source!
Node!
0! 1!
3! 3! D
6! loop-free paths A 3
C
A 3!
B •  Can still have 5 2
D
transient loops
Packet from CàA
* Link State Data Base may loop around BDC
if B knows about failure
•  Final tree shown in green and C & D do not

31 32

8
OSPF Routing Protocol OSPF Reliable Flooding

•  Open •  Transmit link state advertisements


•  Open standard created by IETF •  Originating router
•  Typically, minimum IP address for router
•  Shortest-path first •  Link ID
•  Another name for Dijkstra’s algorithm •  ID of router at other end of link
•  More prevalent than RIP •  Metric
•  Cost of link
•  Link-state age
•  Incremented each second
•  Packet expires when reaches 3600
•  Sequence number
•  Incremented each time sending new link information

33 34

OSPF Flooding Operation Flooding Issues

•  Node X Receives LSA from Node Y •  When should it be performed


•  With Sequence Number q •  Periodically
•  Looks for entry with same origin/link ID •  When status of link changes
•  Cases •  Detected by connected node
•  No entry present
•  What happens when router goes down & back up
•  Add entry, propagate to all neighbors other than Y
•  Sequence number reset to 0
•  Entry present with sequence number p < q
•  Update entry, propagate to all neighbors other than Y
•  Other routers may have entries with higher sequence
numbers
•  Entry present with sequence number p > q
•  Send entry back to Y
•  Router will send out LSAs with number 0
•  To tell Y that it has out-of-date information •  Will get back LSAs with last valid sequence number p
•  Entry present with sequence number p = q •  Router sets sequence number to p+1 & resends
•  Ignore it
35 36

9
Adoption of OSPF Comparison of LS and DV
Algorithms
•  RIP viewed as outmoded Message complexity Space requirements:
•  LS: with n nodes, E links, •  LS maintains entire topology
•  Good when networks small and routers had limited O(nE) messages
•  DV maintains only neighbor
memory & computational power •  DV: exchange between
state
neighbors only
•  OSPF Advantages Robustness: router
•  Fast convergence when configuration changes Speed of Convergence malfunctions
•  LS: Relatively fast
•  LS: Node can advertise
•  Complex computation, but can
forward before computation incorrect link cost
•  may have transient loops •  Each node computes its
•  DV: convergence time varies own table
•  may have routing loops •  DV: Node can advertise
•  count-to-infinity problem incorrect path cost
•  faster with triggered •  Each node’s table used by
updates others (error propagates)
37 38

Outline Routing Hierarchies

•  Flat routing doesn’t scale


•  Distance Vector •  Storage à Each node cannot be expected to store
routes to every destination (or destination network)
•  Convergence times increase
•  Link State
•  Communication à Total message count increases
•  Key observation
•  Routing Hierarchy •  Need less information with increasing distance to
destination
•  Need lower diameters networks
•  Solution: area hierarchy

39 40

10
Areas Routing Hierarchy

•  Divide network into areas Area-Border!


Router!
Backbone Areas!

•  Areas can have nested sub-areas


•  Hierarchically address nodes in a network
Lower-level Areas!
•  Sequentially number top-level areas
•  Sub-areas of area are labeled relative to that area
•  Nodes are numbered relative to the smallest containing
area •  Partition Network into “Areas”
•  Within area
•  Each node has routes to every other node
•  Outside area
•  Each node has routes for other top-level areas only
•  Inter-area packets are routed to nearest appropriate border router
•  Constraint: no path between two sub-areas of an area can exit that
area
41 42

Area Hierarchy Addressing Path Sub-optimality

1 2
•  Can result in sub-optimal paths
2.2
1.1 2.1
2.2.2 1 2
2.1 2.2

1.2 2.2.1
1.1
1.2.1 1.2 2.2.1
1.2.1
1.2.2
start
3
end
3.2.1
3

3.1 3.2 3 hop red path


vs. 3.1 3.2
2 hop green path

43 44

11
Next Lecture: BGP

•  How to connect together different ISPs

45

12

Potrebbero piacerti anche