Presentation is loading. Please wait.

Presentation is loading. Please wait.

Network Layer4-1 Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 IP: Internet Protocol Datagram format IPv4 addressing.

Similar presentations


Presentation on theme: "Network Layer4-1 Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 IP: Internet Protocol Datagram format IPv4 addressing."— Presentation transcript:

1 Network Layer4-1 Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 IP: Internet Protocol Datagram format IPv4 addressing 4.4 Routing: Concepts and Algorithms Introduction Math Detour – Graph Theory Routing via Broadcast – PI, PIF Connectivity Test – CT Distributed Routing Bellman – Ford – Distance Vector Link State Optimal Routing Network Model Math Detour – Convexity Flow Deviation Math Detour – Inequality Constraints Optimal Routing – Necessary and Sufficient Conditions 4.5 Routing in the Internet Hierarchical Routing RIP OSPF BGP 4.6 Broadcast and multicast routing

2 Routing Definition: selection of path(s) between source and destination over which data will travel from source to destination Routing process is complicated because: requires cooperation between a large number of nodes ( not only neighbors ) needs to cope with a large number of situations, sometimes unpredictable performance requirements may be strict because it is a basic part of the operation of the network Two aspects: path selection transfer of data over the path (data forwarding) Normally second part is simpler than the first. Second operation may be performed using tables in the nodes (to be seen shortly) or description of the entire path in the header of the message (Source Routing).

3 Routing Algorithm classification Global or decentralized information? Global: all routers have complete topology, link cost info “link state” algorithms Decentralized: router knows physically- connected neighbors, link costs to neighbors iterative process of computation, exchange of info with neighbors “distance vector” algorithms Static or dynamic? Static: routes change slowly over time Dynamic: routes change more quickly periodic update in response to link cost changes

4 Routing Protocol Requirements Performance: delay, throughtput, etc. Correctness: messages should reach destination Reliability Stability and Convergence Fairness: in the enclosed example, maximum traffic will not allow traffic from X to X’ Performance Criteria Throughput, i.e. amount of traffic Low Delay Network point of view User point of view Cost Other network-specific criteria

5 How does the Routing Protocol affect Network Performance ? The network should apply procedures to limit the amount of traffic that enters the network, thus better routing will allow more traffic to traverse the network On the other hand, given the throughput, better routing will provide lower delay (as we shall see shortly) and more throughput. Example for throughput: all links have 10 units capacity Low load: 5 units from 1 to 6 and from 2 to 6 via 3 and 5 respectively: good routing both via 4 : bad routing (more congestion – higher delay) High load: 5 units from 1 to 6, 15 units from 2 to 6 if no flow splitting is allowed, ( at least ) 5 units are rejected if splitting is allowed, we can handle all requirements, e.g. by sending the traffic from 1 via 3, half of the traffic from 2 via 4 and the other half via 5 Maximum Load: both flows via 4, max. flow = 10, bad choice no splitting, max. =20, better routing with splitting, max = 30

6 u y x wv z 2 2 1 3 1 1 2 5 3 5 Graph: G = (N,E) N = set of routers = { u, v, w, x, y, z } E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) } Graph abstraction Remark: Graph abstraction is useful in other network contexts Example: P2P, where N is set of peers and E is set of TCP connections

7 Graph abstraction: costs u y x wv z 2 2 1 3 1 1 2 5 3 5 c(x,x’) = cost of link (x,x’) - e.g., c(w,z) = 5 cost could always be 1, or proportional to delay or inversely related to bandwidth, or inversely related to congestion Cost of path (x 1, x 2, x 3,…, x p ) = c(x 1,x 2 ) + c(x 2,x 3 ) + … + c(x p-1,x p ) Question: What’s the least-cost path between u and z ? The most obvious routing algorithm: algorithm that finds least-cost path

8 Network Layer4-8 Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 IP: Internet Protocol Datagram format IPv4 addressing 4.4 Routing: Concepts and Algorithms Introduction Math Detour – Graph Theory Routing via Broadcast – PI, PIF Connectivity Test – CT Distributed Routing Bellman – Ford – Distance Vector Link State Optimal Routing Network Model Math Detour – Convexity Flow Deviation Math Detour – Inequality Constraints Optimal Routing – Necessary and Sufficient Conditions 4.5 Routing in the Internet Hierarchical Routing RIP OSPF BGP 4.6 Broadcast and multicast routing

9 Graphs - definitions Graph (N,A) A - collection of links N - collection of nodes link is denoted by (n 1, n 2 ) or by a i Walk - Arbitrary collection of successive links Path - Loop-less walk ( no node appears more than once ) Cycle - walk that starts and ends at the same node Connected graph - there is a path between every pair of nodes Non-connected graph Sub-graph - Part of a given graph Tree - Connected loop-less graph Spanning Tree for graph G is a tree that is a sub-graph of G and contains all nodes of G

10 Spanning Tree Algorithm Given a connected graph G = ( N,A) 1. Select an arbitrary node V, N’={V}, A’={} 2. If N=N’, stop. A’ is the Spanning Tree. 3. Select a link (i,j), such that. Update 4. Go to 2 Proof: there always exists a link in 3. ( since G is connected ) A’ is always a tree the final A’ is spanning Properties Any connected graph G = (N,A) has a spanning tree in any graph G holds holds

11 Routing in Networks of LAN’s Here the LAN’s are the “Network Nodes” and the bridges are the “Network Links” The routing is done on a Spanning Tree, because: Need to be able to reach each LAN from each LAN difficult to split traffic ( each LAN is a broadcast medium )

12 Minimum Spanning Tree (MST) If Network links are not the same, different Spanning Trees have different properties, we want to select the Spanning Tree with the “best performance” Assumption: The “quality” of each link can be measured and expressed as a strictly positive number ( e.g. delay, load, etc.) Definition: “tree weight” = sum of tree link weights. Problem: Given a graph G=(N,A), with link weights {w ij }, select an MST, i.e. the Spanning Tree with minimum weight among all Spanning Trees Definitions: segment = sub-graph of a MST outgoing link = link with one end in the segment and the other outside the segment

13 Minimum Spanning Tree - continued Lemma: Given a segment F, let be the outgoing link from F, with minimum weight. Then is also a segment. Proof: Let M be the MST that F belongs to. If then qed. Suppose We shall show that there is another MST M’ for which is a segment. Since M is a Spanning Tree, generates a loop, with all links, except, in M. Since, there exists an additional link that belongs to the loop and that is outgoing from F. This is because traveling along the loop, we leave F when we cross. The link that takes us back to F is. Let M’ be the graph that we get when we delete from M and add, M’ is connected, has |N|-1 links and no loops, hence it is a Spanning Tree. Since, M’ is a MST that includes F and thus is a segment. i j F M

14 MST algorithms Prim-Dijkstra Select any node as a first segment. Keep enlarging the segment, by selecting the minimum outgoing edge. Kruskal start with |N| segments, each composed of one node. Select a minimum weight link and combine two segments. Convenient for distributed computation.

15 Example MST algorithms Kruskal Topology Prim Dijkstra A B

16 Shortest Path Routing Routing along MST doesn’t always make sense: does not make use of all routes there are shorter routes ( e.g. between nodes A and B on previous slide ) Therefore, there is need to find shortest paths between all source- destination pairs Problem: Given a weighted graph, find Minimum Weight Path between all source- destination pairs Notes: Path Length = sum of link weights ; this is often a good measure, but not always. E.g. if we want to find bottleneck, then we look for min(link weights) All weights are strictly positive Every Shortest Path is loop-free (easy to see, since if there were loops we could delete them and get shorter paths.

17 Bellman-Ford method Find Shortest Paths to a given destination by classifying the paths according to their physical lengths ( one link, two links, etc.) Notations and definitions: h-path = path from i to dest with at most h links = weight of link (i,j), if link is nonexistent,. = estimated weight of shortest h-path from i to dest = weight of actual shortest h-path from i to dest Algorithm: initialization: ; in each step, for each and for each i, do:, link for which minimum is achieved is the link on the shortest (h+1)-path to dest completion: when Reason: In each step, concatenate the h-hop path with the (h+1)- st hop to minimize the sum. http://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm

18 Example of Bellman-Ford dest

19 Proof of Bellman-Ford Theorem: after step h, holds. The algorithm completes after at most |N| steps, and then is the length of the shortest path from i to dest. Proof: induction on h for h=1:, and indeed is the length of the shortest 1- path assume statement is true for, prove it’s true for from definition, since collection of paths with at most k links includes collection of paths with at most k-1 links: thus from induction hypothesis if shortest (k+1)-path from i to dest contains links, then its length is if shortest (k+1)-path from i to dest contains k+1 links, then it is composed of some link (i,j) and then from j to dest with exactly k links. Therefore its length is: since shortest path contains no loops, it can contain at most |N|-1 links, thus the algorithm terminates after at most |N| steps.

20 Bellman-Ford ( continued) Number of calculations: number of steps |N| each step for |N|-1 nodes, for each node |N|-1 comparisons total : O(|N| 3 ) calculations Determining shortest path from i to dest : after sufficient number of steps holds the Bellman equation to determine the shortest path, select node k such that Node k is the next node on the shortest path from i to dest repeat from k in this way we can find all shortest paths to dest Note: Collection of shortest paths to dest is a Spanning Tree ( normally different from the MST).

21 Dijkstra’s algorithm Algorithm for finding shortest paths : Determine shortest paths in order of node distance from dest closest node to dest is the neighbor of dest with smallest link weight second closest node is neighbor of dest with second smallest link weight, or a node two hops away, when the last hop is the previously selected link Method: each node gets a temporary label that estimates its distance from dest. When the estimate is validated, the label becomes final. Notations: P = set of nodes with final label D i = label of node i

22 Dijkstra ( continued) Initialization: 1. Find node for which and 2. If stop. 3. For all, do and return to step 1. Lemma: For every, holds Proof: easy by induction. Step 1. Ensures that the statement holds for each iteration. Lemma: For each, the label gives the shortest path from i to dest on a path whose links, except for the first, have edges that belong to P. Proof: easy by induction. Step 3. ensures that the statement holds for a node that enters P. Number of calculations: |N|-1 iterations, operations/iteration proportional to |N|, therefore total O(|N| 2 ) : better than Bellman-Ford

23 Example of Dijkstra 3 2 3

24 Distributed Algorithms In Networks, nodes are usually “smart” and we want to take advantage of this. A Distributed Algorithm is an algorithm performed, normally asynchronously by all nodes while performing computations and exchanging messages, so that together they achieve a common task. We will start with the simplest Distributed Algorithm and build our way up to more complicated ones.

25 Network Layer4-25 Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 IP: Internet Protocol Datagram format IPv4 addressing 4.4 Routing: Concepts and Algorithms Introduction Math Detour – Graph Theory Routing via Broadcast – PI, PIF Connectivity Test – CT Distributed Routing Bellman – Ford – Distance Vector Link State Optimal Routing Network Model Math Detour – Convexity Flow Deviation Math Detour – Inequality Constraints Optimal Routing – Necessary and Sufficient Conditions 4.5 Routing in the Internet Hierarchical Routing RIP OSPF BGP 4.6 Broadcast and multicast routing

26 Routing via Broadcast Problem: Source node wants to transmit same information to all nodes in the network (broadcast) Best performance: on Spanning Tree, if one is available, if not, easiest to “flood” Flooding: each node sends information to all its neighbors Advantages: No need to know network structure No need to know network current topology Reliable and fast: every connected node will get the information at the earliest possible time. Assumptions and notations: every node knows its adjacent topology every node assigns local id’s to its adjacent links MSG(info) - message carrying the information info

27 Routing via Broadcast (continued) Protocol PI ( Propagation of Information ) Every node i performs the following algorithm ( the source node receives START): initialization : upon START or receipt of MSG(info) if m=0 then accept info send MSG(info) to all neighbors Notes: Protocol is completely distributed; every node works independently and upon its own schedule The variable m makes sure that nodes will transfer and accept information no more than once. Last line can be changed to: send MSG(info) to all neighbors except the one MSG was received from

28 Properties of PI During the operation of the protocol, exactly one message travels on each link in each direction All nodes connected to the source will accept the info, exactly once For each node i, let p i be the neighbor from which node i receives the first MSG: The collection {(i,p i )} forms a Spanning Tree If w ij is the delay on link (i,j), then the above is the tree of shortest paths from source to all other node If several nodes have the same info and start PI asynchronously, their PI’s converge and all properties above hold, except that the collection {(i,p i )} will form a Spanning Forest ( collection of non-overlapping trees whose union spans all nodes) The source does not know the termination time, i.e. some time when it can be sure that all nodes have received the information. It knows the information will be received and accepted by all nodes, but it doesn’t know when.

29 Broadcast with termination indication (feedback) (PIF) Protocol: Use PI-type to broadcast information and to form Spanning Tree Use Spanning Tree to collect termination information Method: node that accepts info, forwards it to all neighbors, except p i ( the neighbor it has received the info from ) upon receipt of MSG from all neighbors, send info backwards on the Spanning Tree ( towards source ). Termination indication = source receives MSG from all its neighbors Notations: m = flag that indicates participation in protocol N(l) = flag that indicates that the node has received MSG from neighbor l p = neighbor from which first MSG was received first receive MSG from nil = START Above notations are for each node i and each source s to distinguish between nodes: to distinguish between sources:

30 PIF algorithm Every node i performs the following algorithm ( the source node receives START): initialization : upon receipt of from if then(propagation phase) accept info send to all neighbors except l if then(feedback phase) send to Properties: –all connected nodes will accept message exactly once –one MSG on each link in each direction –collection form a spanning tree –all nodes perform and complete protocol –each node i completes protocol before its preferred neighbor –source node completes protocol last, and thus this is the termination indication

31 source Example PIF 1 2 3 6 3 1 1 2 4 0 0 3 3 3 5 5 5 4 4 566 6 6 8 7 8 1 1

32 Example source

33 Network Layer4-33 Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 IP: Internet Protocol Datagram format IPv4 addressing 4.4 Routing: Concepts and Algorithms Introduction Math Detour – Graph Theory Routing via Broadcast – PI, PIF Connectivity Test – CT Distributed Routing Bellman – Ford – Distance Vector Link State Optimal Routing Network Model Math Detour – Convexity Flow Deviation Math Detour – Inequality Constraints Optimal Routing – Necessary and Sufficient Conditions 4.5 Routing in the Internet Hierarchical Routing RIP OSPF BGP 4.6 Broadcast and multicast routing

34 Connectivity Test Goal: every node wants to learn what are the nodes in its connected network Protocol CT1: every node sends its id in PI nodes wake up when they get the first message, at which time they start their own PI Properties: can be started asynchronously at several nodes every node will receive the identity of every other connected node disconnected nodes will not know of each other a node cannot determine a termination time, i.e. a time when it knows for sure the identities of all connected nodes

35 CT2 Idea: use PIF’s instead of PI’s Protocol CT2: A node starts its own PIF when: gets a START upon receiving the first message ( of some PIF started by another node ) A node participates in every PIF started by other nodes and registers every source of such a PIF Properties: can be started asynchronously at several nodes every node will receive the identity of every other connected node disconnected nodes will not know of each other a node i can determine a termination time, i.e. a time when it knows for sure the identities of all connected nodes. This time is the time when i completes its own PIF. This property follows from the fact that the broadcast phase of reaches node i before the feedback phase of.

36 CT3 Idea: same as CT1, except that nodes broadcast their neighbors’ identities along with their own identity Properties: all “good” properties of CT1 termination signal: when a arrives, it also indicates that PI’s from all neighbors of j will also arrive. Termination when all expected identities have arrived. each node needs to know or find out neighbors’ identities. Additional variations on CT1, CT2, CT3: encoded information to reduce MSG contents reduction of number of messages pruning of MSG contents

37 Network Layer4-37 Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 IP: Internet Protocol Datagram format IPv4 addressing 4.4 Routing: Concepts and Algorithms Introduction Math Detour – Graph Theory Routing via Broadcast – PI, PIF Connectivity Test – CT Distributed Routing Bellman – Ford – Distance Vector Link State Optimal Routing Network Model Math Detour – Convexity Flow Deviation Math Detour – Inequality Constraints Optimal Routing – Necessary and Sufficient Conditions 4.5 Routing in the Internet Hierarchical Routing RIP OSPF BGP 4.6 Broadcast and multicast routing

38 Distributed Calculation of Shortest Paths Motivation: Since network conditions change, there is need to periodically re- calculate the routing tables. Reasons for preferring distributed calculation: congestion at central node survivability ( what if central node fails ) Goal: Distributed calculation of shortest paths. In fact a node needs to know only the next hop to each destination, not necessarily the entire path, nor the length of the path. Basis: a node knows the information about its neighborhood.

39 Distributed Bellman-Ford Assumptions: every node knows the weights of its adjacent outgoing links network remains connected (failures treated separately) the protocol calculates paths from all nodes to some node dest (separate calculations for each destination). Bellman-Ford algorithm equations: Initialization: After |N|-1 steps, the equations converge to: where N(i) is the set of neighbors of i

40 Synchronous Distributed Bellman-Ford This is a direct implementation of the Bellman-Ford algorithm: At step h, every node i calculates from received from neighbors and sends to all neighbors. Then h is incremented. Drawbacks: needs synchronization between nodes - hard to do. needs mechanism for early end of the protocol, if some link weight changes during its operation restart needs reset ( inefficient use of previous information)

41 Asynchronous Distributed Bellman-Ford (Distance Vector Routing Protocol ) Protocol: every node i performs from time to time from time to time, every node i sends calculated to all its neighbors. Assumptions: nodes do not postpone forever update of D i nodes do not postpone forever sending update to neighbors on each link there is a DLC that ensures that messages sent on each link arrive and preserve order Variables at node i : D i = estimate of distance from i to dest D i (j) = estimate of distance from neighbor j to dest as received in the last message from j Algorithm for node i : whenever there is a change in some w ij or in D i (j), perform and update neighbors by sending them D i ; select the neighbor that provides the minimum as your next-hop preferred neighbor towards dest.

42 Asynchronous Distributed Bellman-Ford (continued) Theorem (not easy to prove): For any given initial condition, if changes in {w ij } cease, the protocol converges in finite time to a state where all D i reflect the shortest distances to dest. Note: the protocol should be performed separately for each dest. Update messages can contain estimated distances for several or all destinations.

43 Example of update step Table at node J

44 stability unbounded number of steps the “number” should be redefined as a bounded large number to overcome the problem : run in parallel a protocol with weights=1 and stop when variables reach |N|

45 Loops 1 1100 S a b 2 1 7 5 3 6 4 8 Problem: Detecting Situations when old information is irrelevant and should not be used

46 Loops 3 1100 S a b c 1 1

47 Poisoned reverse If Z routes through Y to get to X then: Z sends to all neighbors, except Y, the true estimated distance to X ( as usual), but Z sends to Y an infinite distance (so Y won’t route to X via Z) Obviously, this solves only 2-node loops

48 Distance Vector Protocol Distributed Asynchronous Bellman-Ford is also called Distance Vector Protocol The Distributed Asynchronous Bellman-Ford forms the basis for the Routing Information Protocol (RIP) used in Internet and other Networks

49 Network Layer4-49 Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 IP: Internet Protocol Datagram format IPv4 addressing 4.4 Routing: Concepts and Algorithms Introduction Math Detour – Graph Theory Routing via Broadcast – PI, PIF Connectivity Test – CT Distributed Routing Bellman – Ford – Distance Vector Link State Optimal Routing Network Model Math Detour – Convexity Flow Deviation Math Detour – Inequality Constraints Optimal Routing – Necessary and Sufficient Conditions 4.5 Routing in the Internet Hierarchical Routing RIP OSPF BGP 4.6 Broadcast and multicast routing

50 Link State Routing Protocol Protocol: every node broadcasts from time to time, like in CT3: sequence number, its identity, the identity of its neighbors, the “weights” of its adjacent links every node uses the received information to maintain an updated picture of the network topology and weights every node performs a Dijkstra algorithm to find shortest path to each node first link of the resulting shortest path provides the forwarding table entry to that destination This is the basis for the OSPF ( Open Shortest Path First) algorithm used in Internet and other networks The protocol is distributed in the sense that the information is disseminated in a distributed manner and each node makes its own calculation ( Dijkstra)

51 Comparison of LS and DV algorithms Message complexity LS: with n nodes, E links, O(nE) msgs sent DV: exchange between neighbors only convergence time varies Speed of Convergence LS: O(n 2 ) algorithm requires O(nE) msgs may have oscillations DV: convergence time varies may be routing loops count-to-infinity problem Robustness: what happens if node malfunctions? LS: node can advertise incorrect link cost each node computes only its own table DV: DV node can advertise incorrect path cost each node’s table used by others error propagate thru network


Download ppt "Network Layer4-1 Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 IP: Internet Protocol Datagram format IPv4 addressing."

Similar presentations


Ads by Google