Presentation is loading. Please wait.

Presentation is loading. Please wait.

Network Layer (part 1) CPSC 363 Computer Networks Ellen Walker Hiram College (Includes figures from Computer Networking by Kurose & Ross, © Addison Wesley.

Similar presentations


Presentation on theme: "Network Layer (part 1) CPSC 363 Computer Networks Ellen Walker Hiram College (Includes figures from Computer Networking by Kurose & Ross, © Addison Wesley."— Presentation transcript:

1 Network Layer (part 1) CPSC 363 Computer Networks Ellen Walker Hiram College (Includes figures from Computer Networking by Kurose & Ross, © Addison Wesley 2002)

2 Network Layer Implements host-to-host communication Distributed throughout hosts and routers –No central routing mechanism! Network layer functions –Path determination (routing) –Forwarding (to appropriate output link) –Call setup (ATM, not IP)

3 Routing vs. Forwarding Routing is a network-wide process that determines end-to-end paths –Even though it is not done in a centralized way! Forwarding is a router-only algorithm that sends each packet out the “right” interface –Uses tables determined by routing algorithm –Reads addresses in datagram headers

4 Virtual Circuit Setup: Build routing information tables (including unique VC numbers) in each router Data transfer: look at each packet, determine output interface and VC number based on input interface and VC number Teardown: inform both ends and all internal routers that the VC is no longer needed; routers remove information from their tables Setup & teardown done by “signaling messages” that cause VC tables to be modified Used by ATM networks (basis in telephony) -- guaranteed bandwidth (constant or min) and ordering

5 Datagram Every packet contains entire address (sufficient information to be routed to destination) No signaling messages needed Each router maintains a forwarding table to indicate the “direction” to each destination –Forwarding tables can change at any time –Therefore no guarantee all packets in message take the same route! Today’s Internet provides (only) Datagram service - also called “best effort”

6 Advantages of Internet Model We can build more reliable transfer models (e.g. TCP) on top of it Easy to interconnect networks with different link-layer technologies (satellite vs. copper vs. radio, etc.) Network doesn’t need to understand application packets to route them; new applications can always be added on hosts

7 Routing Each host attached directly to a “first-hop” router (e.g. in the network card) Goal is to find the “least cost” path from source (router) to destination (router) –Assume every link has a numerical cost –Add up all link costs to get a path cost

8 Find Least Cost Path from A to F

9 Routing Algorithms Dynamic –Results change as network connectivity changes Global –Works with complete information about all nodes and link costs –Also called link state algorithms Decentralized –Each router makes its decisions based on partial information about nodes and link costs –More complete routing information evolves by information exchange between neighbors –Example: distance vector algorithm

10 Link State Algorithm Initialization: All nodes broadcast the identities and costs of their neighboring links until every node has an identical table, then every node can run its own copy of the algorithm Dijkstra’s Algorithm (all shortest paths) –Builds a list of shortest (known) distance to every (other) node –When complete, all links have been considered

11 Dijkstra’s Algorithm Initialization N = {A} // the only node we know is the source For every node v –If v is adjacent to A, then – D(v) = link cost from A to v – Prev(v) = A –Else D(v) = infinity

12 Dijkstra’s Algorithm Loop Find a node w (not in N) such that D(w) is a minimum Add w to N For each v adjacent to w and not in N –//update distance to be distance through w if it’s less –D(v) = min(D(v), D(w)+ link cost from w to v –If D(w)+link cost is shorter, set Prev(v)=w (This loop is repeated until all nodes are in N)

13 Dijkstra’s Algorithm Example Source node is A – A:0 B:3 C:x D:2 E:4 F:x Choose node D –A:0 B:3 C:x D:2 E:3 F:x Choose node B –A:0 B:3 C:4 D:2 E:3 F:7 Choose node E –A:0 B:3 C:4 D:2 E:3 F:4 Choose node C –A:0 B:3 C:4 D:2 E:3 F:4 Choose node F –A:0 B:3 C:4 D:2 E:3 F:4 A D E B C F 3 4 2 11 4 1 3 Final “Previous” table A:A B:A C:B D:A E:D F:E (Node chosen when v got its final value to the left)

14 Result of Dijkstra’s Algorithm Each node knows its previous node along the least cost path from A Example –Previous table is [ A:A B:A C:B D:A E:D F:E ] –Path from A to F A … E F(prev of F is E) A… D E F(prev of E is D) A D E F(prev of D is A) Use this information to make a “next hop” table

15 Result of Dijkstra’s Algorithm Example Example –Previous table is [ A:A B:A C:B D:A E:D F:E ] –Path from A to F A … E F(prev of F is E) A… D E F(prev of E is D) A D E F(prev of D is A) In node A, next-hop(F) is D In node D, next-hop(F) is E In node E, next-hop(F) is F

16 Comments on Dijkstra’s Algorithm Time cost is O(N 2 ) –Roughly N searches through N possible next nodes each time –Note that the number of links is also O(N 2 ) for most networks! Traffic considerations can cause oscillation –Make costs not depend on traffic (not practical) –Avoid running algorithm simultaneously in all nodes (add random delay)

17 Distance Vector Algorithm Each node… –Receives information from its neighbors –Calculates –Distributes new information to its neighbors … until no new information is received This algorithm is.. –Asynchronous –Distributed –Iterative

18 Distance Table Each row represents a destination Each column represents a “next hop” Thus a cell indicates the current best estimate cost from “me” to “row” via “column” Example (in node A): –Row B, col C = c(A,C)+ C’s estimate of (C,B)

19 Example Distance Table In A: B D E B 3 7 9 C 4 7 8 D 9 2 5 E 8 3 4 F 7 4 5 Red (minimum) indicates which next-hop to take A D E B C F 3 4 2 11 4 1 3

20 Distance Algorithm Initialize all values where row=col to direct distance to that col. (e.g. B,B=3 and D,D=2) Initialize all other values to infinity Send min distance for each destination to all neighbors Wait for a change (either message or link cost) –If cost to neighbor v changes by d, add d to each value in column v –If update from v (cost from v to Y has changed), recalculate distance to y (link to v + cost from v to Y) –If change caused a new min, send new D value for that min to all neighbors

21 Example: Assuming no initial knowledge, generate distance table (and next hop) Set AD to 5 and let network re-adjust Set AB to 100 and try again A D E B C F 3 4 2 11 4 1 3

22 Comments on Distance Vector Algorithm With no changes, settles fairly quickly –As soon as information propagates from one edge of the network to the other (network diameter) “Good news” spreads quickly –Reduction in link distance “Bad news” takes longer (“count to infinity”) –When a link is broken –Because the higher entry in the table might reflect old info “Poisoned reverse” –If Z goes through Y to get to X, then Z tells Y that Z’s distance to X is infinite –This prevents routes with short (but not long) loops

23 Link State vs. Distance Vector Routing Algorithms LS requires enough messages that every node knows the cost of every link, before the algorithm starts. DV sends messages as needed. When a link cost changes, LS informs every node, DV only sends messages where it matters (new least cost paths) LS is guaranteed to converge in O(N 2 ) DV can be faster, but can also “count to infinity” Bad cost table in LS hurts only the node; bad cost table in DV can hurt the whole network (broadcasting incorrect information)

24 Networks Are Hierarchical Total number of nodes is too big to keep track of all of them Organizations like to keep track of their own networks, presenting only one gateway to the “outside world” Result: –Networks divided into Autonomous Systems (AS) –Gateway router responsible for routing all packets to/from outside world –Most routing is Gateway to Gateway (think local roads & interstates)

25 Inter and Intra-AS Routing Host h2 a b b a a C A B d c A.a A.c C.b B.a c b Host h1 Intra-AS routing within AS A Inter-AS routing between A and B Intra-AS routing within AS B

26 Necessary Routing Information Non-gateway router (intra-AS only) –Holds complete routing information within AS –Sends all extra-AS packets to gateway router (as if that were their address) –“Hot potato” routing – get packet to “closest” gateway Gateway router (inter-AS and intra-AS) –Holds complete routing information within AS –Also hold routing information to other gateways –Routing protocols include BGP (later)

27 Summary so far (Sec. 4.5) Every router has a “next hop” table to route packets to the right interface (output) Routing algorithms determine these tables –Global –Distributed In the Internet, hosts are arranged hierarchically, and inter-gateway routing is separated from intra-gateway routing Next look at network-layer transmission units (datagrams) and their headers, then return to routing


Download ppt "Network Layer (part 1) CPSC 363 Computer Networks Ellen Walker Hiram College (Includes figures from Computer Networking by Kurose & Ross, © Addison Wesley."

Similar presentations


Ads by Google