Successfully reported this slideshow.
Upcoming SlideShare
×

# Week13 lec2

471 views

Published on

Computer Networks

Published in: Education, Technology
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

### Week13 lec2

1. 1. Chapter 4 Network Layer Computer Networking: A Top Down Approach 4th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007.
2. 2. Routing Algorithm Classification Global Routing Algorithm Decentralized Routing Algorithm  Computes least cost path  No node has complete     using complete global knowledge about the network. Takes connectivity between all nodes and all link costs as input. All routers have complete topology, link cost information Also called “Link State” Algorithms Open Shortest Path First Protocol (OSPF)     information about the cost of all links. In the beginning knowledge of its own directly attached links. Computes least cost path by an iterative process of calculation and exchange of information. Also called Distance Vector (DV) Algorithm Routing Information Protocol (RIP)
3. 3. Distance Vector Algorithm Distributed:  Receives info from the neighbors  Performs calculation  Distributes the results to neighbors Iterative:  Process continues until no more information is exchanged between neighbours.  Asynchronous:  Does not require all the nodes to operate in lockstep with each other
4. 4. Distance Vector Algorithm Bellman-Ford Equation Define dx(y) := cost of least-cost path from x to y Then dx(y) = min {c(x,v) + dv(y) } v where min is taken over all neighbors v of x
5. 5. Bellman-Ford example 5 2 u v 2 1 x 3 w 3 1 5 z 1 y Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3 2 B-F equation says: du(z) = min { c(u,v) + dv(z), c(u,x) + dx(z),c(u,w) + dw(z) } = min {2 + 5, 1+ 3, 5 + 3} =4 Node that achieves minimum is next hop in shortest path ➜ forwarding table
6. 6. Distance Vector Algorithm Basic idea:  From time-to-time, each node sends its own distance vector estimate to neighbors  When a node x receives new DV estimate from neighbor, it updates its own DV using B-F equation: Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N  All the nodes continue to exchange their distance vectors until the estimate Dx(y) converges to the actual least cost dx(y)
7. 7. Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2 node x table cost to x y z = min{2+1 , 7+0} = 3 cost to x y z from from x 0 2 7 y ∞∞ ∞ z ∞∞ ∞ node y table cost to x y z Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)} x 0 2 3 y 2 0 1 z 7 1 0 x ∞ ∞ ∞ y 2 0 1 z ∞∞ ∞ node z table cost to x y z from from x x ∞∞ ∞ y ∞∞ ∞ z 71 0 time 2 y 7 1 z
8. 8. Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2 node x table cost to x y z x ∞∞ ∞ y ∞∞ ∞ z 71 0 from from from from x 0 2 7 y 2 0 1 z 7 1 0 cost to x y z x 0 2 7 y 2 0 1 z 3 1 0 x 0 2 3 y 2 0 1 z 3 1 0 cost to x y z x 0 2 3 y 2 0 1 z 3 1 0 cost to x y z from from from x ∞ ∞ ∞ y 2 0 1 z ∞∞ ∞ node z table cost to x y z x 0 2 3 y 2 0 1 z 7 1 0 = min{2+1 , 7+0} = 3 cost to x y z cost to x y z from from x 0 2 7 y ∞∞ ∞ z ∞∞ ∞ node y table cost to x y z cost to x y z Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)} x 0 2 3 y 2 0 1 z 3 1 0 time x 2 y 7 1 z
9. 9. Example v 5 z 10 7 2 1 y x Using DV algorithm show the table entries at node z?
10. 10. From Solution z z 0 y 3 x 2 v 5 Cost to y x 3 2 0 1 1 0 7 7 v 5 7 7 0
11. 11. RIP ( Routing Information Protocol)  Distance Vector Algorithm  Hop Count as cost metric  Each link has cost 1  Cost are actually from source router to a destination subnet  RIP uses the term hop, which is the number of subnets traversed along the shortest path from source router to destination subnet. u v A z C B w x D y From router A to subnets: destination hops u 1 v 2 w 2 x 3 y 3 z 2
12. 12. RIP ( Routing Information Protocol)  The maximum cost of a path is limited to 15  Limits the use of RIP to networks that have fewer than 15 hops.  Neighboring routers exchange information after every 30 sec via RIP Response message (also called RIP advertisements)  Known as Periodic timer.  A Router can also request information about its neighbor’s cost to a given destination using RIP’s Request message.
13. 13. RIP: Link Failure and Recovery  If no advertisement heard after 180 sec --> neighbor /link declared dead  RIP modifies local routing table  Propagates this information by sending this advertisements to its neighboring routers.  Called as Expiration timer.
14. 14. Limitations of RIP Network span limited by maximum hop count of 15 Note that actual number of networks can be > 15! Slow convergence DV Algorithm
15. 15. RIP Implementation  Router send RIP request and Response message over UDP port no 520.  RIP routing tables managed by application-level process called routed.  Routed executes RIP i.e. maintains routing information and exchanges messages with other routed processes in neighbors. routed routed Transprt (UDP) network (IP) link physical Transprt (UDP) forwarding table forwarding table network (IP) link physical
16. 16. IPv4 Datagram Format IP protocol version number header length (bytes) “type” of data max number remaining hops (decremented at each router) upper layer protocol to deliver payload to type of ver head. len service length fragment 16-bit identifier flgs offset time to header protocol live checksum total datagram length (bytes) for fragmentation/ reassembly 32 bit source IP address 32 bit destination IP address Options (if any) data (variable length, a TCP or UDP segment) e.g. timestamp, record route taken etc Find other use?
17. 17. IP Fragmentation & Reassembly  Network links have MTU (Maximum Transmission Unit) - largest possible link-level data that can be encapsulated in a frame. o Different link between sender and destination • Use different MTUs  Large IP datagram is divided (“fragmented”) o One datagram becomes several datagrams o Referred as Fragments o “Reassembled” only at final destination o IP header bits used to identify, order related fragments fragmentation: in: one large datagram out: 3 smaller datagrams reassembly
18. 18. IP Fragmentation & Reassembly  Identification Number, Flag and Offset fields in the datagram header  Identification Number o o Sending Host stamps the datagram with an identification number Destination receives datagram o Examines the identification number  Flag Bit o o All fragments set to 1 Last fragment set to 0  Offset Field o Use to specify where fragment fits in the within the original IP datagram
19. 19. IP Fragmentation & Reassembly Example  Datagram of 4000 bytes o 20 bytes of IP header, 3980 bytes of payload o MTU is 1500 bytes Fragment Bytes ID Offset 0 (beginning) Flag 1st Fragment 1480 bytes 777 1 (there is more) 2nd Fragment 1480 bytes 777 185 1 (there is more) 3rd Fragment 1020 bytes 777 370 0 (Last )
20. 20. Hierarchical Routing  All routers run the same routing Algorithm? … not true in practice Scale: With millions of destinations:  Can’t store all destinations in routing tables  Exchange of Routing updates would swamp links! Administrative Autonomy  Internet = network of networks  Each network administrator may want to control routing in its own network
21. 21. Hierarchical Routing  Routers are organized into “Autonomous Systems” (ASs).    Routers in same administrative domain The routing algorithm within an autonomous system is called an “intra-AS” routing protocol Routers in different AS can run different intraAS routing protocol Gateway Routers  One or more of the routers in an AS will have the added task of forwarding packets to destinations outside the AS. 1c 1a 1d 1b AS1
22. 22. Interconnected ASs 3c 3b 3a 2a AS3 1c 1a 1d 2c 2b AS2 1b AS1 1b, 1c, 2a and 3a are Gateway Routers
23. 23. Inter-AS tasks AS1 must: 1. Learn which destinations are reachable through AS2, which through AS3 2. Propagate this reachability information to all routers in AS1.  Configure Forwarding table Job of inter-AS routing protocol!  Suppose router in AS1 receives datagram destined outside of AS1:  Router should forward packet to gateway router, but which one? 3c 3a 3b AS3 1a 2a 1c 1d 1b Intra-AS Routing algorithm AS1 Inter-AS Routing algorithm Forwarding table 2c AS2 2b
24. 24. Example: Setting forwarding table in router 1d  Suppose AS1 learns (via inter-AS protocol) that network x reachable via AS3 (gateway 1c) but not via AS2.  Inter-AS protocol propagates reachability info to all internal routers.  Router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1c.  installs forwarding table entry (x,I) x 3c 3a 3b AS3 1a 2a 1c 1d 1b AS1 2c 2b AS2
25. 25. Example: Choosing among multiple ASs  Now suppose AS1 learns from inter-AS protocol that a network x is reachable from AS3 and from AS2.  To configure forwarding table, router 1d must determine towards which gateway it should forward packets for dest x.  Hot Potato Routing: Send packet towards closest of two routers. x 3c 3a 3b AS3 1a 2a 1c 1d 1b 2c AS2 AS1 2b
26. 26. Example: Choosing among multiple ASs Learn from inter-AS protocol that network x is reachable via multiple gateways Use routing info from intra-AS protocol to determine costs of least-cost paths to each of the gateways Hot potato routing: Choose the gateway that has the smallest least cost Determine the interface I that leads to least-cost gateway. Enter (x,I) in forwarding table Steps in adding an outside AS destination in a routers forwarding Table