1 / 131

UNIT 3

UNIT 3. NETWORK LAYER. Network Layer. It is responsible for end to end (source to destination) packet delivery, whereas the data link layer is responsible for node to node (hop to hop) packet delivery.

cid
Download Presentation

UNIT 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. UNIT 3 NETWORK LAYER www.techstudent.co.cc

  2. Network Layer • It is responsible for end to end (source to destination) packet delivery, whereas the data link layer is responsible for node to node (hop to hop) packet delivery. • The network layer provides the functional and procedural means of transferring variable length data sequences from a source to a destination via one or more networks while maintaining the quality of service, and error control functions. • The network layer deals with transmitting information all the way from its source to its destination - transmitting from anywhere, to anywhere. www.techstudent.co.cc

  3. Network Layer Design Issues • Services Provided to the Transport Layer • Internal organization of the n/w layer www.techstudent.co.cc

  4. Services Provided to Transport Layer • Provides services at n/w layer/transport layer interface. • It is the i/f betwn carrier and customer • i.e., the subnet boundary. • Its job is to deliver packets given to it by customers. N/w layer services are designed with the following goals: 1. The service should be independent of the subnet technology. 2. The transport layer should be shielded from the number, type and topology of subnets present. 3. The n/w addrs made available to the transport layer should use a uniform numbering plan, across LANs and WANs www.techstudent.co.cc

  5. Divided into 2 groups based on whether n/w layer should provide connection-oriented or connectionless service • 1st group –subnet unreliable so host should do flow ctrl & error ctrl • repn by internet community • Connectionless • Primitives SEND PACKET & RECEIVE PACKET • No ordering & flow ctrl • Each pkt must carry full destn addrs • 2nd grp-subnet should provide reliable connection-oriented service • Repn by telephone companies • Sending side must set up connection • 2 process can enter into negotiation abt parameters, quality, cost of service • Commn in both direction & pkts delivered in sequence • Flow ctrl provided automatically www.techstudent.co.cc

  6. Internal Organization of Network Layer Two different organizations are possible, depending on the type of service offered • Virtual circuit • Used in subnets whose primary service is connection-oriented • Its idea is to avoid to choose a new route for every packet sent. • i.e., when a connection is established ,a route from the src to destn is chosen as part of the connection setup and remembered. • The route is used for all traffic flowing over the connection (like telephone s/m) • When the connection is released the VC is also terminated • Datagrams • No routes are worked out in advance. • Each packet is routed independently of its predecessors. • Successive packet may follow different routes. • More robust and adapt to failures and congestion more easily than VC subnets www.techstudent.co.cc

  7. Implementation of Connectionless Service • Packets are injected into the subnet individually • Routed independently of each other. • Packets are called datagrams (in analogy with telegrams) and the subnet is called a datagram subnet. . • Each datagram contains full destination addrs • Every router has an internal table telling it where to send packets for each possible destination. • Each table entry is a pair consisting of a destination and the outgoing line to use for that destination. Only directly-connected lines can be used. • For example, A has only two outgoing lines—to B and C—so every incoming packet must be sent to one of these routers, even if the ultimate destination is some other router. A's initial routing table is shown in the figure under the label ''initially.'' www.techstudent.co.cc

  8. Figure. Routing within a datagram subnet. www.techstudent.co.cc

  9. Implementation of Connection-Oriented Service • When a connection is established, a route from the source machine to the destination machine is chosen as part of the connection setup and stored in tables inside the routers. • Same route is used for all traffic flowing over the connection • When the connection is released, the virtual circuit is also terminated. • Each router should remember where to forward packets • Each packet carries an identifier (virtual circuit number) telling which virtual circuit it belongs to • Every router maintain a table with one entry per open virtual ckt passing through it www.techstudent.co.cc

  10. Comparison of Virtual-Circuit and Datagram Subnets www.techstudent.co.cc

  11. ROUTING ALGORITHMS • Major function of the n/w layer is routing packets from src m/c to dest m/c. • Routing algorithm is the part of the n/w layer s/w responsible for deciding which output line an incoming packet should be txed on. • If the subnet uses datagram internally ,this decision must be made anew for every arriving data packet since the best route may have changed since last time. • If the subnet uses VC internally, routing decisions are made only when a new VC is being setup. • Then data packets follow the previously established route. • This is also called session routing ,because a route remains in force for an entire user session www.techstudent.co.cc

  12. Properties of Routing Algorithm • Correctness • Simplicity • Robustness –able to cope with changes in topology & traffic • Stability • Fairness and • Optimality www.techstudent.co.cc

  13. Routing algorithms Major categories: Categorized into 2: • Non adaptive and Adaptive: Non adaptive: • Do not base their routing decisions on measurements or estimates of the current traffic and topology. • Instead the choice of the route to use to get from I to J (for all I and J) is computed in advance, off-line and downloaded to the routers when the n/w is booted. • This procedure is called static routing. Adaptive algorithms: • Change their routing decisions to reflect changes in the topology and the traffic as well. • Called dynamic routing. • Adaptive algorithms differ in where they get infrmn (eg: locally from near by routers, or from all routers) ,when they change the route, and what metric is used for optimization (eg: distance). www.techstudent.co.cc

  14. Optimality Principle • This is a general stmnt about optimal routes without regard to n/w topology or traffic. • If router J is on the optimal path from router I to router K, then the optimal path from J to K also falls along the same route • Optimal routes from all sources to given destn form a tree rooted at the destination. tree is called a sink tree • The distance metric is the number of hops • A sink tree is not necessarily unique • The goal of all routing algorithms is to discover and use the sink trees for all routers. • It does not contain any loops, so each packet will be delivered within a finite number of hops www.techstudent.co.cc

  15. A subnet. A sink tree for router B. www.techstudent.co.cc

  16. Static Routing Algorithms • Shortest Path Routing • Flooding • Flow-Based Routing www.techstudent.co.cc

  17. Shortest Path Routing Concept: • Build a graph of the subnet • node of the graph represents a router • arc of the graph represents a communication line (link). • To choose a route betwn a given pair of routers ,the algorithm finds the shortest path betwn them on the graph. • Also called Dijkstra’s algorithm. • Each node is labeled with its distance from the src node along the best known path. • Initially, no paths are known , so all nodes are labeled with dot. • As the algorithm proceeds and paths are found ,labels may change, reflecting better paths. • A label may either be tentative or permanent. • Initially all labels are tentative. • When it is discovered that a label represents the shortest possible path from the src to that node , it is made permanent and never changed thereafter. www.techstudent.co.cc

  18. The first 5 steps used in computing the shortest path from A to D. The arrows indicate the working node www.techstudent.co.cc

  19. Flooding Concept: • Every incoming packet is sent out on every outgoing line expect the one it arrived on. Problem: • It generates duplicate packets. Solution: • Some measures are used ,like hop counter contained in the header of each packet. • Which is decremented at each hop, with the packet is being discarded when counter reaches 0. • The hop counter is initialized to the length of the path from src to destn. • An alternative soln for damming the flood is to keep track of which packets have been flooded, to avoid sending them out a second time. • For this a source router put a seq. no. in each packet it rxes from its hosts. www.techstudent.co.cc

  20. Each router then needs a list per source router telling which seq. nos. originating at that source have already been seen. • If an oncoming packet is on the list, it is not flooded • A more practical one is selective flooding. • In this algorithm the routers send every incoming packet only on those lines that r approximately in the right direction. Application: It is not so practical but useful in • 1)Military applications • 2)Distributed database-to update all dbs concurrently • 3)As a metric for comparing other routing algorithms www.techstudent.co.cc

  21. Flow-Based Routing • This algorithm uses both topology and load for routing. • In some n/ws , the mean data flow betwn each pair of nodes is relatively stable and predictable. • Under conditions in which the avg traffic from i to j is known in advance and ,to a reasonable approximation ,constant in time, it is possible to analyze the flows mathematically to optimize the routing. • Idea is: if the capacity and average flow of a line r known , it is possible to compute the mean packet delay on that line from queuing theory. • From the mean delay of all the lines it is easy to calculate a flow-weighted avg to get the mean packet delay of the whole subnet. • To use this, first- subnet topology must known, second- traffic matrixFij must b given third- line capacity matrix Cij must b available and finally a routing algorithm must b chosen. www.techstudent.co.cc

  22. Routing www.techstudent.co.cc

  23. Flow-Based Routing • This algorithm uses both topology and load for routing. • In some n/ws , the mean data flow betwn each pair of nodes is relatively stable and predictable. • Under conditions in which the avg traffic from i to j is known in advance and ,to a reasonable approximation ,constant in time, it is possible to analyze the flows mathematically to optimize the routing. • Idea is: if the capacity and average flow of a line are known , it is possible to compute the mean packet delay on that line from queuing theory. • From the mean delay of all the lines it is easy to calculate a flow-weighted avg to get the mean packet delay of the whole subnet. • To use this, first- subnet topology must known, second- traffic matrixFij must b given third- line capacity matrix Cij must be available and finally a routing algorithm must be chosen. www.techstudent.co.cc

  24. a) Subnet with line capacities shown b) The traffic in packets/sec and the routing matrix www.techstudent.co.cc

  25. Frm fig a, the weight on the arcs give the capacities Cij. • fig b has an entry for each source-destn pair. • Eg: 3 packets/sec go from B to D and they use route BFD to get there. • By this infrmn, it is easy to calculate the total in line i, λi. • Eg: the B-D traffic gives 3 packets/sec to the BF line and also 3 packets/sec to FD line. • The mean number of packets /sec on each line is given by μCi. • The mean delay for the each line is derived from the queuing theory formula: T=1/ μC- λ www.techstudent.co.cc

  26. Dynamic Routing Algorithms • Distance Vector Routing • Link State Routing www.techstudent.co.cc

  27. Distance Vector Routing • Each router maintain a table (i.e, a vector) giving the best known distance to each destination and which line to use to get there. • These tables are updated by exchanging information with the neighbors. • Also called Bellman-Ford routing algorithm and the Ford-Fulkerson algorithm • Each router maintains a routing table containing one entry for each router in the subnet. • This entry contains two parts: • preferred outgoing line to use for that destination • estimate of the time or distance to that destination. • The metric used might be: number of hops, timedelay in ms etc. www.techstudent.co.cc

  28. Router is assumed to know the distance to each of its neighbors. Eg: • Assume that the delay is used as a metric and the router knows the delay to each of its neighbors. • Once every T ms each router sends to each neighbor a list of its estimated delay to each destn. • It also receives a similar list from each neighbor. • By performing this calculation for each neighbor ,a router can find out which estimate seems the best and use that estimate and the corresponding line in its new routing table. www.techstudent.co.cc

  29. (a)A subnet. (b) Input from A, I, H, K, and the new routing table for J. www.techstudent.co.cc

  30. Suppose that J measured its delay to its neighbors A,I H and K as 8,10,12 and 6 msec respectively. • How J computes its new route to router G? • It knows that it can reach A in 8 ms and A claims to be delay of 26 msec. • Similarly , it computes the delay to G via I,H, and K as 41(31+10), 18(16+2) and 37(31+6) msec respectively. • The best of these value is 18 msec, and that the route to use is via H. www.techstudent.co.cc

  31. Count-to-Infinity Problem • Distance vector routing has a serious drawback in practice: although it may converges to the correct answer, it may do so slowly. • In particular, it reacts rapidly to good news but slowly to bad news. Eg: • Suppose A is down initially and all other routers know this. i.e., they all have recorded the delay to A as infinity. • When A comes up ,the other routers learn about it via the vector exchanges. • At the time of first exchange ,B learns that its left neighbor has a 0 delay to A. • B now makes an entry into its routing table that A is 1 hop away to the left. • On the second exchange ,C learns that B has a path of length 1 to A, so it updates its routing table to indicate a path of length 2. • This process continues and after 4th exchange E also get infrmn that A is up and have a distance of 4 hops. www.techstudent.co.cc

  32. Consider the case in which all the lines and routers are initially up. • Routers B,C D and E have distances to A of 1,2,3 and 4 respectively. • Suddenly A goes down ,or the line betn A and B is cut . • At the first packet xchg B does not hear anything from A. • Then C says “ don’t worry I have a path to A of length 2”. • B now thinks that it can reach A via C, with a path length of 3. • D and E do not update their entries for a on the first exchg. • On the second xchg C notices that each of its neighbors claims to have a path to A of length 3. • It picks one of them at random and makes its new distance to A 4. • Gradually all the routers work their way up to infinity • This problem is known as count-to-infinity www.techstudent.co.cc

  33. Count-to-Infinity Problem www.techstudent.co.cc

  34. Split Horizon Hack • Is the solution for count-to-infinity problem. • This algorithm works the same way as distance vector routing, except that the distance to X is not reported on the line that packets for r sent on. • i.e., C tells D the truth but C tells B that its distance to A is infinite. • Similarly D tells the truth to E but lies to C. • So when A goes down , on the first xchg ,B discovers that the direct line is gone ,and C is reporting an infinite distance to A. • Since neither of its neighbors can get to A, B sets its distance also infinity. • On the next xchg .C hears that A is unreachable from both of its neighbors ,so it makes A unreachable too. • Using split horizon the bad news propagates one hop per exchange. www.techstudent.co.cc

  35. Link State Routing Each router must do the following: 1)Discover its neighbors, and learn their network addresses. 2)Measure the delay or cost to each of its neighbors. 3)Construct a packet telling all it has just learned. 4)Send this packet to all other routers. 5)Compute the shortest path to every other router. www.techstudent.co.cc

  36. 1.Learning about the Neighbors • When a router is booted its first task is to learn who its neighbors are. • By sending a special. HELLO packet on each point-to-point line. • The router on the other end is expected to send back a reply telling who it is. • These names must be globally unique. www.techstudent.co.cc

  37. 2. Measuring Line Cost • The LSR algrthm requires each router to know the delay to each of its neighbors. • The most direct way is to send a spl. ECHO packet over the line that the other side is required to send back immediately. • By measuring the round trip time and dividing it by two , the sending router can get a reasonable estimate of the delay. www.techstudent.co.cc

  38. 3. Building Link State Packets • Once the infrmn needed for the xchg has been collected, the next step is for each router to build a packet containing all the data. • The packet starts with the identity of the sender , followed by a seq. no. , age and a list of neighbors. • For each neighbor the delay to that neighbor is given. www.techstudent.co.cc

  39. Building Link State Packets (a) A subnet. (b) The link state packets for this subnet. www.techstudent.co.cc

  40. 4. Distributing the Link state packets • The basic idea is to use flooding to distribute the link state packets. • To keep the flood in check, each packet contains a seq no. that is incremented for each new packet sent. www.techstudent.co.cc The packet buffer for router B

  41. Each row here corresponds to a recently arrived ,but not yet fully processed ,link state packet. • In fig, the link state packet from A arrived directly ,so it must b sent to C and F and acknowledged to A, shown by flag bytes. • Similarly packets from F has to b forwarded to A and C and acknowledged to F. www.techstudent.co.cc

  42. 5. Computing the new Route • Once router has accumulated a full set of link state packets ,it can construct the entire subnet graph. • Every link is ,in fact represented twice, once for each direction. • Then Dijkstra’s algorithm can b run locally to construct the shortest path to all possible destinations. • The result of this algorithm can be installed in the routing tables and normal operation resumed. • 2 widely used LSR protocols are OSPF (OpenShortestPathFirst) and IS-IS (IntermediateSystem-IntermediateSystem) www.techstudent.co.cc

  43. Link State Routing www.techstudent.co.cc

  44. Link State Routing Each router must do the following: 1)Discover its neighbors, and learn their network addresses. 2)Measure the delay or cost to each of its neighbors. 3)Construct a packet telling all it has just learned. 4)Send this packet to all other routers. 5)Compute the shortest path to every other router. www.techstudent.co.cc

  45. 1.Learning about the Neighbors • When a router is booted its first task is to learn who its neighbors are. • By sending a special HELLO packet on each point-to-point line. • The router on the other end is expected to send back a reply telling who it is. • These names must be globally unique. www.techstudent.co.cc

  46. 2. Measuring Line Cost • The LSR algorithm requires each router to know the delay to each of its neighbors. • The most direct way is to send a spl. ECHO packet over the line that the other side is required to send back immediately. • By measuring the round trip time and dividing it by two , the sending router can get a reasonable estimate of the delay. www.techstudent.co.cc

  47. 3. Building Link State Packets • Once the infrmn needed for the xchg has been collected, the next step is for each router to build a packet containing all the data. • The packet starts with the identity of the sender , followed by a seq. no. , age and a list of neighbors. • For each neighbor the delay to that neighbor is given. www.techstudent.co.cc

  48. 4.Building Link State Packets (a) A subnet. (b) The link state packets for this subnet. www.techstudent.co.cc

  49. 4. Distributing the Link state packets • The basic idea is to use flooding to distribute the link state packets. • To keep the flood in check, each packet contains a seq no. that is incremented for each new packet sent. • When a new link state packet comes in, it is checked against the list of packets already seen • If it is new, it is forwarded on all lines except the one it arrived on. • If it is a duplicate, it is discarded. • If a packet with a sequence number lower than the highest one seen so far ever arrives, it is rejected as being obsolete since the router has more recent data www.techstudent.co.cc

  50. Problems of algorithm • Seq no: wrap around –causes confusion • Soln:- use 32 bit seq no: • Router crash –lose track of seq no: • Seq no: corrupted • Soln:- include age of each pkt & decrement it 1/sec • When age becomes 0,info is discarded from router • Age also decremented by each router during initial flooding process www.techstudent.co.cc

More Related