Download presentation
Presentation is loading. Please wait.
Published byGiles Harmon Modified over 8 years ago
1
Network Layer (2)
2
Review Physical layer: move bits between physically connected stations Data link layer: move frames between physically connected stations Network layer: move packets from source A to destination B
3
Datagram Packet carries the complete destination information The job of a router is to – Find the output link to send the packet – Forward the packet to that output link Routing table for a node Destination Next Hop B C D B E C F C B E F D C A H
4
Forwarding A fast switch is used to forward the packet to the destination H B C H B C
5
Virtual Circuit Destination information is large and the table is large – Consider 32 bit IP address. A full table will have 1G entries. If an IP packet is 1250 byte long and the link speed is 10Gbps, how much time do you have for this lookup? (1. You don’t have to implement the full table. 2. You can also use pipeline.)
6
Virtual Circuit Circuit means a path between the source and the destination. Real circuit switching has a physical path set up between the source and the destination, like telephone network – When you dial, a request is sent to the network, network finds if there are free links on the path and reserve that link for you. Virtual circuit is different – used in packet switching networks. – No real path set up, because it is packet switching (although link bandwidth can be reserved). – But still has the connection phase. The purpose is to let the routers know how to route the packets of this virtual circuit.
7
Virtual Circuits When setting up the virtual circuit, a VC identifier is picked. The router knows where to forward a packet with a certain VC identifier. Each packet will carry the VC identifier, which is much shorter than the full destination address, so allows more efficient table lookup. Resources can also be reserved. QoS. A practical problem in a distributed environment – different stations may pick the same VC identifier. Labels can be swapped without causing confusion. B E F D C A H1 H2 A’s Table In Out H1, 1 C, 1 H2, 1 C, 2 H3 C’s Table In Out A, 1 E, 1 A, 2 D, 1
8
Shortest Path find the shortest path from the source to all other nodes. Dijkstra algorithm: finding the shortest paths from the source s to all other nodes in the network. 1) Initial set = empty, 2) maintain the distance from s to all other nodes (distance(s, s) = 0, distance(s, t) = infinite) 3) repeat until all nodes are included in the set 4) find a node d currently no in the set with shortest distance 5) include d in the set 6) update the distance from s to all other nodes using 7) if distance(s, m) > distance(s, d) + dist(d, m) then 8) distance(s, m) = distance(s, d) + dist (d, m)
10
Dijkstra’s algorithm: example Step 0 1 2 3 4 5 start N A AD ADE ADEB ADEBC ADEBCF D(B),p(B) 2,A D(C),p(C) 5,A 4,D 3,E D(D),p(D) 1,A D(E),p(E) infinity 2,D D(F),p(F) infinity 4,E A E D CB F 2 2 1 3 1 1 2 5 3 5
11
Shortest Path Why this gives the shortest path? Node added to the set has found its minimum distance to the source. Suppose this is not true. At a step, we add node W to the set. If there is another path s---Z---W with distance shorter than d(W), where Z is the first node in the path currently not in the set. d(Z) must be less than d(W) (why?) and we would have added Z to the set at this step rather than W.
12
Link State Algorithm Each router independently computes optimal paths – From itself to every destination – Routes are guaranteed to be loop free if Each router sees the same cost for each link Uses the same algorithm (shortest path algorithm for OSPF) to compute the best path
13
Topology Dissemination Each router creates a set of link state packets – Describing its links to neighbors – LSP contains Router id, neighbor’s id, and cost to its neighbor Copies of LSPs are distributed to all routers – Using controlled flooding Each router maintains a topology database – Database containing all LSPs
14
Distance Vector Routing Algorithm Distance Table data structure each node has its own row for each possible destination column for each directly-attached neighbor to node example: in node X, for dest. Y via neighbor Z: D (Y,Z) X distance from X to Y, via Z as next hop c(X,Z) + min {D (Y,w)} Z w = =
15
Distance Table of E A E D CB 7 8 1 2 1 2 ABCDABCD A1764A1764 B 14 8 9 11 D5542D5542 cost to destination via destination
16
ABCD ABCD A1764A1764 B 14 8 9 11 D5542D5542 cost to destination via destination ABCD ABCD A,1 D,5 D,4 D,2 Outgoing link to use, cost destination Distance table Routing table Routing Table of E
17
Distance Vector Algorithm Iterative, asynchronous: each iteration caused by: local link cost change message from neighbor: its least cost path change from neighbor Distributed: each node notifies neighbors only when its least cost path to any destination changes – neighbors then notify their neighbors if necessary wait for (change in local link cost or msg from neighbor) recompute distance table if least cost path to any dest has changed, notify neighbors Each node:
18
Example X Z 1 2 7 Y D (Y,Z) X c(X,Z) + min {D (Y,w)} w = = 7+1 = 8 Z D (Z,Y) X c(X,Y) + min {D (Z,w)} w = = 2+1 = 3 Y
19
Example X Z 1 2 7 Y
20
Convergence of the algorithm router detects local link cost change updates distance table if cost change in least cost path, notify neighbors X Z 1 4 50 Y 1 algorithm terminates “good news travels fast”
21
21 Problems with DV Routing Link cost changes: good news travels fast bad news travels slow “count to infinity” problem! X Z 1 4 50 Y 60 algorithm continues on!
22
Zhenhai DuanComputer Science, FSU22 Count-to-Infinity Problem XYZ 11 2
23
23 Link State vs Distance Vector Tells everyone about neighbors Controlled flooding to exchange link state Dijkstra’s algorithm Each router computes its own table May have oscillations Open Shortest Path First (OSPF) Tells neighbors about everyone Exchanges distance vectors with neighbors Bellman-Ford algorithm Each router’s table is used by others May have routing loops Routing Information Protocol (RIP)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.