1 4.2 routing 4.2.1 network as a graph 4.2.2 distance vector (rip) 4.2.3 link state (ospf) 4.2.4...

67
1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

Upload: samantha-craig

Post on 14-Dec-2015

236 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

1

4.2 Routing

4.2.1 Network as a Graph4.2.2 Distance Vector (RIP)4.2.3 Link State (OSPF)4.2.4 Metrics4.2.5 Routing for Mobile Hosts

Page 2: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

2

Route a way or course taken in getting from a starting point to a

destination send or direct along a specified course

Routing find the path or course of forwarding according to

information contained in packet (destination)

Difference between network-layer and link-layer format of forwarding table way of updating the table

Page 3: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

3

Link-layer Forwarding table

mapping from destination physical address (MAC address) to port of forwarding

Update of the table manually configured

Page 4: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

4

IP (Network) Layer Forwarding table

mapping from destination network id (NetNum) to next-hop (or interface) of forwarding

Update the table manually configured (static route) dynamically learned from routing protocol

Page 5: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

5

Forwarding vs. RoutingForwarding

taking a packet looking at its destination address consulting a table sending the packet in a direction determined by that table

locally done at a nodeRouting

the process by which forwarding tables are builtdepends on a distributed algorithm

Page 6: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

6

Forwarding Table vs. Routing Table Forwarding table

used when a packet is being forwarded and so must contain enough information to accomplish the forwarding function

a row in the forwarding table contains the mapping from a network number to an outgoing interface and some MAC information, such as the Ethernet address of the next hop

Page 7: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

7

Routing table the table that is built up by the routing algorithms as

a precursor to building the forwarding table it contains mappings from network numbers to

next-hops (IP addresses)

Page 8: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

8

Example, in the following tables the routing table tells us that network number 10 is

to be reached by a next hop router with the IP address 171.69.245.10

the forwarding table contains the information about exactly how to forward a packet to that next hop send it out interface number 0 with a MAC address of

8:0:2b:e4:b:l:2 (the last piece of information is provided by the Address Resolution Protocol)

Page 9: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

9

Network Number Next Hop

10 171.69.245.10

Network Number

Interface MAC address

10 if0 8:0:2b:e4:b:1:2

Example rows from (a) routing and (b) forwarding tables

(a) (b)

Page 10: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

10

4.2.1 Network as a Graph

4

3

6

21

9

1

1D

A

FE

B

C

Page 11: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

11

Basic problem of routing find the lowest-cost path between any two nodes, where

the cost of a path equals the sum of the costs of all the edges that make up the path

4

3

6

21

9

1

1D

A

FE

B

C

Page 12: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

12

Solution routing is achieved in most practical networks by running

routing protocols among the nodes these protocols provide a distributed, dynamic way to solve

the problem of finding the lowest-cost path in the presence of node or link failure addition of new node or new link changes of link cost

it is difficult to make centralized solutions scalable, so all the widely used routing protocols use distributed algorithms

Page 13: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

13

4.2.2 Distance Vector (RIP) Distance-Vector Algorithm (Bellman-Ford Algorithm)

each node constructs a one-dimensional array (a vector) containing the "distances" (costs) to all other nodes and distributes that vector to its immediate neighbors

response when receiving an announcement from a neighborfor every entry in the announcement, store it if

the announced distance is shorter than what in the table a better route is found

otherwise discard it

Page 14: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

14

assumption initially, each node knows the cost of the link to each

of its directly connected neighbors broken links are assigned an infinite cost, ∞

Page 15: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

15

Local data structure routing table

destination cost to the destination corresponding next-hop

Page 16: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

16

Distance Vector Algorithm

In this example the cost of each link is set to 1 a least-cost path is simply the one with the fewest

hops

D

G

A

F

E

B

C

Page 17: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

17

Initial State

B

A C

DE

F G

Destination Y

Node X’s Routing Table: Cost / Next-Hop

A’s B’s C’s D’s E’s F’s G’s

A 0 1/A 1/A ∞ 1/A 1/A ∞

B 1/B 0 1/B ∞ ∞ ∞ ∞

C 1/C 1/C 0 1/C ∞ ∞ ∞

D ∞ ∞ 1/D 0 ∞ ∞ 1/D

E 1/E ∞ ∞ ∞ 0 ∞ ∞

F 1/F ∞ ∞ ∞ ∞ 0 1/F

G ∞ ∞ ∞ 1/G ∞ 1/G 0

Page 18: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

18

Destination Y

Cost/Next-Hop

A

B

C

D

E

F

G

0/

1/B

1/C

2/C

1/E

1/F

2/F

A’s routing table

B

A C

DE

F G

Distance Vector sent by A

Page 19: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

19

After One Step

B

A C

DE

F G

Destination Y

Node X’s Routing Table: Cost / Next-Hop

A’s B’s C’s D’s E’s F’s G’s

A 0 1/A 1/A 2/C 1/A 1/A 2/F

B 1/B 0 1/B 2/C 2/A 2/A ∞

C 1/C 1/C 0 1/C 2/A 2/A 2/D

D 2/C 2/C 1/D 0 ∞ 2/G 1/D

E 1/E 2/A 2/A ∞ 0 2/A ∞

F 1/F 2/A 2/A 2/G 2/A 0 1/F

G 2/F ∞ 2/D 1/G ∞ 1/G 0

Page 20: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

20

After Two Steps

B

A C

DE

F G

Destination Y

Node X’s Routing Table: Cost / Next-Hop

A’s B’s C’s D’s E’s F’s G’s

A 0 1/A 1/A 2/C 1/A 1/A 2/F

B 1/B 0 1/B 2/C 2/A 2/A 3/F

C 1/C 1/C 0 1/C 2/A 2/A 2/D

D 2/C 2/C 1/D 0 3/A 2/G 1/D

E 1/E 2/A 2/A 3/C 0 2/A 3/F

F 1/F 2/A 2/A 2/G 2/A 0 1/F

G 2/F 3/C 2/D 1/G 3/A 1/G 0

convergence: no more changes when getting further announcement

Page 21: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

21

Two different circumstances for a node to send a routing update to its neighbors periodic update

each node automatically sends an update message every so often, even if nothing has changed

triggered update happens whenever a node receives an update from one of its

neighbors that causes it to change one of the routes in its routing table

i.e., whenever a node's routing table changes, it sends an update to its neighbors, which may lead to a change in their tables, causing them to send an update to their neighbors

Page 22: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

22

Link Failures

Example 1 (stable) F detects that link to G has failed F sets distance to G to infinity and sends update to A

[F : (G, ∞, G)] A sets distance to G to infinity since it uses F to reach G

[A : (G, ∞, F)]

------------------------------------------------------------------------- A receives periodic update from C with 2-hop path to G A sets distance to G to 3 and sends update to F

[A : (G, 3, C)] F decides it can reach G in 4 hops via A

[F : (G, 4, A)]

Pattern : (Dest, Cost, NextHop)

Page 23: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

23

Example 2 (count to infinity) link from A to E fails A advertises distance of infinity to E [A : (E, ∞, E)] B and C advertise a distance of 2 to E

[B : (E, 2, A)] , [C : (E, 2, A)] B hears that E can be reached in 2 hops from C B decides it can reach E in 3 hops; advertises this to A

[B : (E, 3, C)] A decides it can reach E in 4 hops; advertises this to C

[A : (E, 4, B)] C decides that it can reach E in 5 hops… [C : (E, 5, A)]

Page 24: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

24

Loop-breaking heuristics (partial solutions)

set infinity to 16

split horizon

split horizon with poison reverse

Page 25: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

25

Solution-1 (set infinity to 16) use some relatively small number as an approximation

of infinity, which at least bounds the amount of time that it takes to count to infinity

example, set the maximum number of hops to get across a certain network is never going to be more than 16 (set 16 to be infinity value)

drawback problem occurs if our network grew to a point where

some nodes were separated by more than 16 hops

Page 26: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

26

Solution-2 (split horizon) when a node sends a routing update to its neighbors, it

does not send those routes it learned from each neighbor back to that neighbor

example, if B has the route (E, 2, A) in its table, then it knows it must have learned this route from A, and so whenever B sends a routing update to A, it does not include the route (E, 2, A) in that update

Page 27: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

27

Solution-3 (split horizon with poison reverse) (B actually sends that route back to A, but it puts

negative information in the route to ensure that A will not eventually use B to get to E)

Let B be a neighbor of A if in the routing table of B, the next hop entry for

destination Z is A, B informs A that its distance to Z is infinite[B : (Z, cost, A) → A : (Z, ∞, B)]

Page 28: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

28

Solution 2 & 3 only work for routing loops that involve two nodes example, for larger routing loops

if B and C had waited for a while after hearing of the link failure from A before advertising routes to E

they would have found that neither of them really had a route to E

Page 29: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

29

Routing Information Protocol (RIP)

One of the most widely used routing protocols in IP networks A DV (Distance Vector) routing protocol Rather than advertising the cost of reaching other routers, the

routers advertise the cost of reaching networks example, in the following figure, router C would advertise

to router A the fact that it can reach networks 2 and 3 at cost 0

[C : (Net2, 0, Net2) , C : (Net3, 0, Net3)] networks 5 and 6 at cost 1

[C : (Net5, 1, Net3) , C : (Net6, 1, Net3)] network 4 at cost 2

[C : (Net4, 2, Net3)]

Page 30: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

30

A

C

1

2

3

B

D

4

5

6

Example network running RIP

Page 31: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

31

RIP packet format the majority of the packets is taken up with

(network-address, distance) pairs example

if router A learns from router B that network X can be reached at a lower cost via B than via the existing next hop in the routing table

A updates the cost and next hop information for the network number accordingly

Address of net 2

Distance to net 2

Command Must be zero

Family of net 2 Address of net 2

Family of net 1 Address of net 1

Address of net 1

Distance to net 1

Version

0 8 16 31

Page 32: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

32

Address of net 2

Distance to net 2

Command Must be zero

Family of net 2 Address of net 2

Family of net 1 Address of net 1

Address of net 1

Distance to net 1

Version

0 8 16 31

RIP packet format

Page 33: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

33

RIP a fairly straightforward implementation of distance-

vector routing routers running RIP send their advertisements every 30

seconds a router also sends an update message whenever an

update from another router causes it to change its routing table

Page 34: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

34

metrics or costs for routing all link costs being equal to 1 always tries to find the minimum hop route valid distances are 1 through 15, with 16 representing

infinity (this limits RIP to running on fairly small networks-those with no paths longer than 15 hops)

Page 35: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

35

4.2.3 Link State (OSPF) Distance-Vector approach

“tell neighbors where I can go, and how far” Link-State approach

“tell all which neighbors I have”

Page 36: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

36

Link-state routing the second major class of intradomain routing protocol assumptions

each node is assumed to be capable of finding out the state of the link to its neighbors (up or down) and the cost of each link

Intradomain An internetwork in which all the routers are under the

same administrative control (e.g., a single university campus, or the network of a single Internet service provider)

Page 37: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

37

basic idea every node knows how to reach its directly

connected neighbors, and if we make sure that the totality of this knowledge is disseminated to every node, then every node will have enough knowledge of the network to build a complete map of the network

link-state routing protocols rely on two mechanisms reliable dissemination of link-state information calculation of routes from the sum of all the

accumulated link-state knowledge

Page 38: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

38

Link-State Message Data Structure

LSP (Link-State Packet) an update packet created by each node information for route calculation

the ID of the node that created the LSP a list of directly connected neighbors of the node, with

the cost of the link to each one

Page 39: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

39

information for reliability a sequence number

ensure having the most recent copy reset to zero when routing process restarted

a time to live (TTL) for this packet Too old packets are discarded

Page 40: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

40

Reliable Flooding

Send local LSP out on all of its directly connected links

Each node receiving the LSP forwards it out on all of its links stores each node’s recent LSP forwards LSP to neighbors except the sender

itself

Page 41: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

41

The following figure shows an LSP being flooded in a small network each node becomes shaded as it stores the new LSP

(a) the LSP arrives at node X, which sends it to neighbors A and C

(b) A and C do not send it back to X, but send it on to B(c) B receives two identical copies of the LSP, it will

accept whichever arrived first and ignore the second as a duplicate

(d) B passes the LSP onto D, who has no neighbors to flood it to, and the process is complete

Page 42: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

42

(a)

X A

C B D

(b)

X A

C B D

(c)

X A

C B D

(d)

X A

C B D

Page 43: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

43

New LSP Generation

Two circumstances to generate new LSP expiry of a periodic timer

change in topology directly connected links go down

detected by link-layer protocols immediate neighbors go down

detected by periodic “hello” message

Page 44: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

44

Calculation of Route

Dijkstra’s Shortest Path Algorithm Notations

N: vertex set of the graph l: l(i, j) is the (non-negative) cost of the edge (i, j) s: current vertex M: set of ever calculated vertices C(n): cost of path from s to n

D

A

B

C

5 3

211

10

Page 45: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

45

Calculate a minimum-cost tree from s

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))

D

A

B

C

5 3

211

10

Page 46: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

46

In practice, each switch computes its routing table directly from the LSPs it has collected using a forward search approach for Dijkstris algorithm each switch maintains two lists, known as Tentative

and Confirmed. each of these lists contains a set of entries of the form

(Destination, Cost, NextHop)

D

A

B

C

5 3

211

10

Page 47: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

47

Forward Search Approach for Dijkstra Algorithm

1. Initialize the Confirmed list with an entry for myself; this entry has a cost of 0.2. For the node just added to the Confirmed list in the previous step, call it node

Next, select its LSP.3. For each neighbor (Neighbor) of Next, calculate the cost (Cost) to reach this

Neighbor as the sum of the cost from myself to Next and from Next to Neighbor. (a) If Neighbor is currently not on either the Confirmed or the

Tentative list, then add (Neighbor, Cost, NextHop) to the Tentative list, where NextHop is the direction I go to reach Next.

(b) If Neighbor is currently on the Tentative list, and the Cost is less than the currently listed cost for Neighbor, then replace the current entry with (Neighbor, Cost, NextHop), where NextHop is the direction I go to reach Next.

4. If the Tentative list is empty, stop. Otherwise, pick the entry from the Tentative list with the lowest cost, move it to the Confirmed list, and return to step 2.

D

A

B

C

5 3

211

10

Page 48: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

48

Example

D

A

B

C

5 3

211

10

Link-state routing: an example network

Page 49: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

D

A

B

C

5 3

211

10

(B, 11, B) → (C, 2, C)

(B, 5, C) → (A, 12, C)

(A, 10, C)

Page 50: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

50

Open Shortest Path First Protocol (OSPF)

OSPF one of the most widely used link-state routing protocols

Open: refers to the fact that it is an open, nonproprietary standard, created under the auspices of the IETF

SPF: comes from an alternative name for link-state routing

Page 51: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

51

OSPF adds the following features to the basic link-state algorithm authentication of routing messages additional hierarchy

OSPF introduces another layer of hierarchy into routing by allowing a domain to be partitioned into areas

a router within a domain does not necessarily need to know how to reach every network within that domain, but know only how to get to the right area

this reduces the amount of information that must be transmitted to and stored in each node

Page 52: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

52

load balancing OSPF allows multiple routes to the same place to be

assigned the same cost and will cause traffic to be distributed evenly over those routes

Page 53: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

53

There are several different types of OSPF messages, but all begin with the same header

OSPF header format Version: 2 Type: 1 through 5 SourceAddr: identifies the sender of the message AreaId: a 32-bit identifier of the area in which the node is

located

Authentication

Version Type Message length

Checksum Authentication type

SourceAddr

AreaId

0 8 16 31

Page 54: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

Authentication type the entire packet, except the authentication data, is

protected by a 16-bit checksum using the same algorithm as the IP header

0: no authentication is used 1: a simple password is used 2: a cryptographic authentication checksum is used

54Authentication

Version Type Message length

Checksum Authentication type

SourceAddr

AreaId

0 8 16 31

Page 55: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

55

Authentication

Version Type Message length

Checksum Authentication type

SourceAddr

AreaId

0 8 16 31

OSPF header format

Page 56: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

56

Five OSPF message types Type 1: "hello" message, which a router sends to its

peers to notify them that it is still alive and connected Type 2~5: used to request, send, and acknowledge the

receipt of link-state messages Basic building block of link-state messages in OSPF is

link-state advertisement (LSA) one message may contain many LSAs

Authentication

Version Type Message length

Checksum Authentication type

SourceAddr

AreaId

0 8 16 31

Page 57: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

57

LS Age Options Type=1

0 Flags 0 Number of links

Link type Num_TOS Metric

Link-state ID

Advertising router

LS sequence number

Link ID

Link data

Optional TOS information

More links

LS checksum Length

OSPF packet format for link-state advertisement (Type 1)

Page 58: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

58

OSPF link-state advertisement Type 1 LSAs: advertise the cost of links between

routers Type 2 LSAs: advertise networks to which the

advertising router is connected LS Age

the equivalent of a time to live, except that it counts up and the LSA expires when the age reaches a defined maximum value

Type tells us that this is a type 1 LSA

LS Age Options Type=1

0 Flags 0 Number of links

Link type Num_TOS Metric

Link-state ID

Advertising router

LS sequence number

Link ID

Link data

Optional TOS information

More links

LS checksum Length

Page 59: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

59

Link-state ID & Advertising router in a type 1 LSA, these two fields are identical each carries a 32-bit identifier for the router that

created this LSA

LS sequence number detect old or duplicate LSAs

LS checksum verify that data has not been corrupted it covers all fields in the packet except LS Age

LS Age Options Type=1

0 Flags 0 Number of links

Link type Num_TOS Metric

Link-state ID

Advertising router

LS sequence number

Link ID

Link data

Optional TOS information

More links

LS checksum Length

Page 60: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

60

Length the length in bytes of the complete LSA

Link ID, Link Data, & metric each link in the LSA is represented by a Link ID,

some Link Data, and a metric TOS

allow OSPF to choose different routes for IP packets based on the value in their TOS field

LS Age Options Type=1

0 Flags 0 Number of links

Link type Num_TOS Metric

Link-state ID

Advertising router

LS sequence number

Link ID

Link data

Optional TOS information

More links

LS checksum Length

Page 61: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

61

Metrics

Original ARPANET metric measures number of packets queued on each link took neither latency nor bandwidth into consideration

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

delay Delay = (DT-AT) + Transmit + Latency

if timeout (ACK did not arrive), DT is reset to the time the packet was retransmitted

link cost = average delay over some time period

Page 62: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

62

4.2.5 Routing for Mobile Hosts

Mobility issues in IP Networks once a mobile terminal moves to a new subnet, a

correspondent node needs to use the mobile’s new IP address it is difficult to force every possible

correspondent node to keep track when a mobile terminal may change its IP address and what the mobile’s new address will be

Page 63: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

63

Mobile IPv4

Internetwork

Foreign agent(12.0.0.6)

Mobile host(10.0.0.9)

Home agent(10.0.0.3)

Home network(network 10)

Sending host

Page 64: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

64

Page 65: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

Home Network

Home address a globally unique and routable IP address preconfigured or dynamically assigned

Home network the network whose network address prefix matches that of the

mobile terminal’s home address

Home agent (HA) maintain up-to-date location information for the mobile intercept packets addressed to the mobile’s home address tunnel packets to the mobile’s current location

Page 66: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

Foreign Network

Care-of Address (CoA) assigned to the mobile by the foreign network a mobile uses its CoA to receive IP packets in the

foreign network

Page 67: 1 4.2 Routing 4.2.1 Network as a Graph 4.2.2 Distance Vector (RIP) 4.2.3 Link State (OSPF) 4.2.4 Metrics 4.2.5 Routing for Mobile Hosts

Foreign agent (FA) provides CoAs and other necessary configuration

information (e.g., address of default IP router) to visiting mobiles

de-tunnels packets from the tunnel sent from a visiting mobile’s HA and then delivers the packets to the visiting mobile

acts as the IP default router for packets sent by visiting mobile terminals