Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 5 Network Layer.

Similar presentations


Presentation on theme: "Chapter 5 Network Layer."— Presentation transcript:

1 Chapter 5 Network Layer

2 Network layer Physical layer: move bit sequence between two adjacent nodes Data link: reliable transmission between two adjacent nodes Network: guides packets from the source to destination, along a path that may comprise a number of routers and links. Application network Data link physical transport

3 Network layer transport segment from sending to receiving host
application transport network data link physical transport segment from sending to receiving host on sending side encapsulate segments into datagrams on receving side, deliver segments to transport layer network layer protocols in every host, router router examines header fields in all IP datagrams passing through it network data link physical application transport network data link physical

4 Network layer A router is a box with input and output links. It has access to the routing table When a packet arrives at a router, the router examines header fields of the packets and forwards the packets according to its routing table Routing: determine the best route/path from source to destination. After that, routing tables can be constructed routing algorithm routing table header value output link 0100 0101 0111 1001 3 2 1 application transport network data link physical application transport network data link physical 1 0111 0111 2 3 value in arriving packet’s header Source Destination

5 Routing Algorithm The routing problem can be represented using a graph. u y x w v z 2 1 3 5 Graph: G = (N,E) N = set of routers = { u, v, w, x, y, z } A set of link lengths/costs between these nodes: {di,j, i, j ϵ S}, di,j= ∞ if there is no link from i to j. Cost/distance of path (x1, x2, x3,…, xp) = dx1,x2 + dx2,x3 + … + dxp-1,xp 0 Question: What’s the least-cost/shortest distance path between u and z ? Routing algorithm: algorithm that finds least-cost/shortest path

6 Routing Algorithm "Good" routing algorithm: 1. simplicity
2. robustness to node/link failures 3. stability (fast adaptation to topology and traffic changes) 4. optimality (low delay and high throughput) 5. fairness. Most of routing algorithms are distributed algorithms: routing decisions are made at each node in a cooperative manner. Information is exchanged with neighbors. Bellman-Ford algorithm is a distributed algorithm.

7 Bellman-Ford Algorithm
Initial condition: At step h=0, node i has the estimate d0(i)= , for all i S with i D and that d0(D)=0. The nodes advertise these estimates to their neighbors. At step h 1: Node j updates its estimate of its distance to D to some value dh(j) and advertises that value to its neighbors. At step h+1: Node i examines the message that it just received from its neighbors at the previous step h, e.g., j might be a neighbor of i, that is d(i,j)< and j informs i at step h that the shortest estimated distance from j to D is equal to dh(j). Node i gets similar messages from all its neighbors. Node i then know that if it chooses to send a packet to D by first sending it to its neighbor j, then the distance that the packet will travel to reach D is estimated to be d(i,j)+dh(j). Since node i can choose the neighbor to which it sends the message destined to D, node i estimates the shortest distance to D as dh+1(i) = min{d(i,j)+dh(j), j S}.

8

9 Bellman-Ford Algorithm
The shortest path length from node i to the destination node is the sum of the length of the arc to the node following i and the shortest path length from that node to the destination node. Algorithm: ( =1)

10 Bellman-Ford Algorithm
Example: Given a digraph G(N,A) with the following specifications. N={1,2,3,4,5,6} A={(2,1)=1, (2,3)=2, (3,1)=5, (3,2)=1, (4,2)=6, (4,5)=2, (5,3)=2, (5,4)=3, (6,4)=1, (6,5)=2} Draw and label the arcs of the digraph. Discuss how the Bellman-Ford algorithm can be used to determine the shortest path from any node to a destination node on the digraph. Find the shortest paths from each of the other nodes to destination node 1 on this digraph using the Bellman-Ford algorithm.

11 Bellman-Ford Algorithm
Solution: (a) The labeled digraph is as follows:

12 Bellman-Ford Algorithm
(b) The Bellman-Ford algorithm can be implemented on the above diagram. Label each node i with (di, j) where di (the first element of the label) is the distance from node i to the destination node through the neighboring node j. Initialization: label node i with (di0,.) where Shortest distance labeling of all nodes: for each successive run h > 0, determine j which minimizes dih+1=d(i,j)+djh, and update label at each node i with (dih+1,j). Repeat step 3 until no change of any di occurs.

13 Bellman-Ford Algorithm
(c) The execution results of Bellman-Ford algorithm on the above digraph is shown in the following table From table, we can get all the shortest paths: 2 -> 1 3 -> 2 -> 1 4 -> 5 -> 3 -> 2 -> 1 5 -> 3 -> 2 -> 1 6 -> 5 -> 3 -> 2 -> 1

14 Link-State Routing Algorithm
Network topology, link costs known to all nodes accomplished via “link state broadcast” all nodes have same info Then each router uses Dijkstra’s algorithm To compute its least cost paths to all other nodes yields forwarding table for that node iterative: after k iterations, know least cost path to k destinations Notation: c(x,y): link cost from node x to y; = ∞ if not direct neighbors D(v): current value of cost of path from source to destination v p(v): predecessor node along path from source to v N': set of nodes whose least cost path definitively known

15 Dijsktra’s Algorithm at node u
Notations: c(x,y): link cost from node x to y D(v): current value of cost of path from source u to destination v p(v): predecessor node along path from source u to v N': set of nodes whose least cost path definitively known 1 Initialization: 2 N' = {u} 3 for all nodes v if v adjacent to u then D(v) = c(u,v) else D(v) = ∞ 7 8 Loop 9 find w not in N' such that D(w) is a minimum 10 add w to N' 11 update D(v) for all v adjacent to w and not in N' : D(v) = min( D(v), D(w) + c(w,v) ) 13 /* new cost to v is either old cost to v or known shortest path cost to w plus cost from w to v */ 15 until all nodes in N'

16 Step 0: Initialization z x u y w v Source = node u
2 1 3 5 Source = node u Routing algorithm is run at node u to find the least cost paths to all the other nodes. Because no direct connection Step 1 2 3 4 5 N' u ux uxy uxyv uxyvw uxyvwz D(v),p(v) 2, u 2,u D(w),p(w) 5, u 4,x 3,y D(x),p(x) 1, u D(y),p(y) 2,x D(z),p(z) 4,y

17 Iteration 1 z x D(v) = min( D(v), D(w) + c(w, v))
u y x w v z 2 1 3 5 D(v) = min( D(v), D(w) + c(w, v)) - Smallest cost in row 0 and node x is not in N’ - Then, add x to N’ Step 1 2 3 4 5 N' u ux uxy uxyv uxyvw uxyvwz D(v),p(v) 2, u D(w),p(w) 5, u D(x),p(x) 1, u D(y),p(y) D(z),p(z) 2, u3,y 3,y 2,u4, x 2, u 4, x 2, x D(x) =1 C(x, v) D(v) = min(2, 1+ 2) = 2 D(w) = min(5, 1+ 3) = 4 D(y) = min(∞, 1+ 1) =2

18 Iteration 2 z x D(v) = min( D(v), D(w) + c(w, v))
u y x w v z 2 1 3 5 Iteration 2 D(v) = min( D(v), D(w) + c(w, v)) Compute for the neighbors of y that are not in N’ D(w) = min(4, 2 + 1)= 3 D(z) = min(∞, 2+ 2) = 4 Lower cost  change Step 1 2 3 4 5 N' u ux uxyv uxyvw uxyvwz D(v),p(v) 2,u D(w),p(w) 5,u 4,x D(x),p(x) 1,u D(y),p(y) 2, x D(z),p(z) uxy 2,u 3,y 4, y

19 Iteration 3 z x D(v) = min( D(v), D(w) + c(w, v))
u y x w v z 2 1 3 5 D(v) = min( D(v), D(w) + c(w, v)) Iteration 3 D(w) = min(3, 2 + 3) =3 Step 1 2 3 4 5 N' u ux uxy uxyvw uxyvwz D(v),p(v) 2,u D(w),p(w) 5,u 4,x 3,y D(x),p(x) 1,u D(y),p(y) 2,x D(z),p(z) 4,y uxyv 3,y 4,y

20 Iteration 4 z x D(v) = min( D(v), D(w) + c(w, v))
u y x w v z 2 1 3 5 D(v) = min( D(v), D(w) + c(w, v)) Iteration 4 D(z) = min(4, 3 + 5) = 4 Step 1 2 3 4 5 N' u ux uxy uxyv D(v),p(v) 2,u D(w),p(w) 5,u 4,x 3,y D(x),p(x) 1,u D(y),p(y) 2,x D(z),p(z) 4,y uxyvw 4,y

21 Iteration 5 z x D(v) = min( D(v), D(w) + c(w, v))
u y x w v z 2 1 3 5 D(v) = min( D(v), D(w) + c(w, v)) Iteration 5 D(z) = min(4, 4 + 0) = 4 Step 1 2 3 4 5 N' u ux uxy uxyv uxyvw D(v),p(v) 2,u D(w),p(w) 5,u 4,x 3,y D(x),p(x) 1,u D(y),p(y) 2,x D(z),p(z) 4,y uxyvwz

22 Resulting shortest-path tree from u:
y x w v z To v: uv To x: ux To y: uxy To w: uxyw To z: uxyz Resulting forwarding table in u: v x y w z destination Next-hop node cost 2 1 2 3 4

23 Dijkstra’s algorithm: example
D(v) p(v) D(w) p(w) D(x) p(x) D(y) p(y) D(z) p(z) v Step N' u 7,u 3,u 5,u u 1 uw 11,w 6,w 5,u w 2 uwx 14,x 11,w 6,w 3 uwxv 14,x 10,v 4 uwxvy 12,y 5 uwxvyz w 3 4 v x u 5 7 y 8 z 2 9 Notes: construct shortest path tree by tracing predecessor nodes

24 Optimal Routing Advantage:
The algorithm is very flexible to the choice of initial estimates dj0. It can be executed at each node i in parallel with every other nodes. Disadvantage: The routing uses only one path per original-destination pair, thereby potentially limiting the throughput; its capability to adapt the changing traffic conditions is limited by its susceptibility to oscillations, which is due to the abrupt traffic shifts resulting when some of the shortest paths change due to changes in link lengths. Example:

25 Optimal Routing Source A is attached to two routers. Initially, A sends all its traffic to D via node R1. The delay along link (R1, D) is equal to 10 and delay along link (R2, D) is equal to 1+e. These routers advertise these delays to node A which then finds out that the preferred path to D starts with R2 and not with R1. Source A then sends all its traffic to R2 and not with R1. As a result, the situation alternates between the two paths. A better routing strategy would consist in source A sending half of its traffic to R1 and the other half to R2. Optimal routing can eliminate both of these disadvantages. It directs traffic exclusively along paths which are shortest with respect to some link lengths that depend on the traffic flows carried by the links.

26 Optimal Routing E.g. The given input r is to be divided into the two path flows 1 & 2, so as to minimize a cost function (based on M|M|1 approximation)

27 Optimal Routing

28 Optimal Routing

29 Optimal Routing

30 Optimal Routing The figure shows the optimal solution for r in the range [0, C1+C2) for possible inputs.


Download ppt "Chapter 5 Network Layer."

Similar presentations


Ads by Google