Presentation is loading. Please wait.

Presentation is loading. Please wait.

BY Dr. Alaa Sagheer Computer Networks South Valley University Faculty of Science, Aswan Mathematics Department.

Similar presentations


Presentation on theme: "BY Dr. Alaa Sagheer Computer Networks South Valley University Faculty of Science, Aswan Mathematics Department."— Presentation transcript:

1 BY Dr. Alaa Sagheer Computer Networks South Valley University Faculty of Science, Aswan Mathematics Department

2 The Network Layer Chapter 5

3 The Network Layer -The network layer is concerned with getting packets from the source all the way to the destination. -It knows about the topology of the communication subnet (i.e., the set of all routers) and choose appropriate paths through it. -It must also choose routes “carefully” to avoid overloading some of the communication lines and routers while leaving others idle. -Finally, when the source and destination are in different networks, it is up to the network layer to deal with them.

4 Network Layer Design Issues Store-and-Forward Packet Switching Services Provided to the Transport Layer Implementation of Connectionless Service Implementation of Connection-Oriented Service

5 Store-and-Forward Packet Switching (1) This figure shows the context in which the network layer protocols operate. -The major components of the system are the carrier's equipment (routers connected by transmission lines), shown inside the shaded oval, and the customers' equipment, shown outside the oval. Host H1 is directly connected to one of the carrier's routers, A, by a leased line. In contrast, H2 is on a LAN with a router, F, owned and operated by the customer. This router also has a leased line to the carrier's equipment. -Routers on customer side are considered part of the subnet.

6 Store-and-Forward Packet Switching (2) A host with a packet to send transmits it to the nearest router, either on its own LAN or over a point-to-point link to the carrier. The packet is stored there until it has fully arrived so the checksum can be verified. Then it is forwarded to the next router along the path until it reaches the destination host, where it is delivered. This mechanism is called store-and-forward packet switching

7 Services to the Transport Layer (1) The network layer provides services to the transport layer at the network layer/transport layer interface. The designer should consider the following goals when design it: 1.The services should be independent of the router technology, 2.The transport layer should be shielded from the number, type, and topology of the routers present. 3.The network addresses made available to the transport layer should use a uniform numbering plan, even across LANs and WANs.

8 -O-One camp argues that the routers' job is just moving packets around and nothing else. In their view, the subnet is inherently unreliable, no matter how it is designed. -T-Therefore, the hosts should accept the fact that the network is unreliable and do error control and flow control themselves. i.e. -T-The network service should be connectionless, with just SEND PACKET and RECEIVE PACKET, -N-No packet ordering and flow control should be done, -E-Each packet must carry the full destination address. Services to the Transport Layer (2) The service should be connection-oriented or connectionless? Two Camps:

9 -The other camp argues that the subnet should provide a reliable, connection-oriented service (telephone system is an excellent guide) -In this view, quality of service is the dominant factor, and without connections in the subnet, quality of service is very difficult to achieve, especially for real-time traffic such as voice and video.  EXAMPLES: Services to the Transport Layer (2) - The Internet offers connectionless network-layer service; - ATM offer connection-oriented network-layer service.  Please note that - Quality-of-service is becoming more and more important, -The Internet is evolving, it is starting to acquire properties normally associated with connection-oriented service.

10 How Network Layer works? -If connectionless service is offered, packets are injected into the subnet individually and routed independently of each other. No advance setup is needed. The packets are frequently called datagrams and the subnet is called datagram subnet. -If connection-oriented service is offered, a path from the source router to the destination router must be established before any data packets can be sent. This connection is called a VC (virtual circuit), in analogy with the physical circuits set up by the telephone system, and the subnet is called a virtual-circuit subnet. According to the provided service:

11 How Datagram Works? (1) -Suppose that the process P1 has a long message for P2. It hands the message to the transport layer with instructions to deliver it to process P2 on host H2, -The transport layer code runs on H1, typically within the operating system. It prepends a transport header to the front of the message and hands the result to the network layer, -The network layer breaks it into four packets, 1, 2, 3, and 4 and sends each of them in turn to router A using some kind of point-to-point protocol, -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

12 How Datagram Works? (2) -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…Example! -Note that packets 1,2 and 3 follow the same route! -Packet 4 changes the route!..Why? …….May be Traffic Jam The algorithm that manages the tables and makes the routing decisions is called the Routing Algorithm.

13 How VC Works? (1) For connection-oriented service, we need a virtual-circuit subnet. -The idea behind virtual circuits is to avoid having to choose a new route for every packet sent, -Instead, 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, -That route is used for all traffic flowing over the connection, exactly the same way that the telephone system works, -When the connection is released, the virtual circuit is also terminated, -With connection-oriented service, each packet carries an identifier telling which virtual circuit it belongs to.

14 Here, host H1 has established connection 1 with host H2. It is remembered as the first entry in each of the routing tables. The first line of A's table says that if a packet bearing connection identifier 1 comes in from H1, it is to be sent to router C and given connection identifier 1. Similarly, the first entry at C routes the packet to E, also with connection identifier 1. How VC Works? (2) Consider that H3 also wants to establish a connection to H2. It chooses connection identifier 1 (because it is initiating the connection and this is its only connection) and tells the subnet to establish the virtual circuit. Note that we have a conflict here because although A can easily distinguish connection 1 packets from H1 from connection 1 packets from H3, C cannot do this. For this reason, A assigns a different connection identifier to the outgoing traffic for the second connection.

15 Comparison between Datagrams and VCs? Left to YOU!

16 Routing Algorithms Shortest Path Routing Flooding Hierarchical Routing Broadcast Routing

17 Routing Algorithm- Intro (1) The routing algorithm is that part of the network layer software responsible for deciding which output line an incoming packet should be transmitted on. -If the subnet uses datagrams, 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, routing decisions are made only when a new virtual circuit is being set up. Thereafter, data packets just follow the previously-established route. The latter case is sometimes called session routing because a route remains in force for an entire user session.

18 Routing Algorithm-Intro (2) Router having two processes inside it. -One of them handles each packet as it arrives, looking up the outgoing line to use for it in the routing tables, ………This process is forwarding. -The other process is responsible for filling in and updating the routing tables. -Certain properties are desirable in a routing algorithm: correctness, simplicity, robustness, stability, fairness, and optimality. We should distinguish between Routing and Forwarding?

19 Routing Algorithm-Intro (3) -Correctness..Simplicity..Robustness..Stability..Fairness..Opt imality. -“Robustness”: The routing algorithm should be able to cope with changes in the topology and traffic without requiring all jobs in all hosts to be aborted and the network to be rebooted every time some router crashes. -“Stability” is also an important goal for the routing algorithm to be equilibrium, Certain properties are desirable in a routing algorithm

20 Routing Algorithms-Intro (4) - Nonadaptive algorithms 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 is computed in advance, off-line, and downloaded to the routers when the network is booted. This procedure is sometimes called static routing. - Adaptive algorithms change their routing decisions to reflect changes in the topology, and usually the traffic as well. Adaptive algorithms differ in where they get their information, when they change the routes and what metric is used for optimization.. This procedure is called dynamic routing. Two kinds of RAs:

21 Shortest Path Routing (1) -The idea is to build a graph of the subnet, with each node of the graph representing a router and each arc of the graph representing a communication line (called link). -To choose a route between a given pair of routers, the algorithm just finds the shortest path between them on the graph. -One way of measuring path length is the number of hops (ABC and ABE are equally long) -Another metric is the geographic distance in kilometers, (ABC much longer than ABE)

22 Shortest Path Routing (2) -Using a test packet, each arc could be labeled with the mean queuing and transmission delay..Then, the shortest path is the fastest path rather than the path with the fewest arcs or kilometers. -In the general case, the labels on the arcs could be computed as a function of the distance, bandwidth, average traffic, communication cost, mean queue length, measured delay, and other factors. -Several algorithms for computing the shortest path between two nodes of a graph are known. e.g. Dijkstra (1959)…see the book!

23 Flooding- Static Algorithm -Every incoming packet is sent out on every outgoing line except the one it arrived on. -Flooding generates infinite numbers of duplicate packets unless some measures are taken to damp the process. -One such measure is to have a hop counter contained in the header of each packet, which is decremented at each hop, with the packet being discarded when the counter reaches zero. -Ideally, the hop counter should be initialized to the length of the path from source to destination. If the sender does not know how long the path is, it can initialize the counter to the worst case, namely, the full diameter of the subnet.

24 Selective flooding, the routers do not send every incoming packet out on every line, only on those lines that are going approximately in the right direction. Flooding is not practical in most applications, but it does have some uses. For example, in military applications, in distributed database applications, in wireless networks, Flooding- Static Algorithm

25 Broadcast Routing Sending a packet to all destinations simultaneously is called broadcasting. One broadcasting method that requires no special features from the subnet is for the source to simply send a distinct packet to each destination. Flooding is another obvious candidate. Although flooding is ill-suited for ordinary point-to-point communication. A third algorithm is multidestination routing. If this method is used, each packet contains either a list of destinations or a bit map indicating the desired destinations.

26 Broadcast Routing A fourth broadcast algorithm makes explicit use of the sink tree for the router initiating the broadcast—or any other convenient spanning tree for that matter. A spanning tree is a subset of the subnet that includes all the routers but contains no loops. Our last broadcast algorithm is an attempt to approximate the behavior of the previous one, even when the routers do not know anything at all about spanning trees. The idea, called reverse path forwarding, is remarkably simple once it has been pointed out.

27 Broadcast Routing Reverse path forwarding. (a) A subnet. (b) a Sink tree. (c) The tree built by reverse path forwarding. An example of reverse path forwarding is shown in this figure. Part (a) shows a subnet, part (b) shows a sink tree for router I of that subnet, and part (c) shows how the reverse path algorithm works.

28 Broadcast Routing On the first hop, I sends packets to F, H, J, and N, as indicated by the second row of the tree. Each of these packets arrives on the preferred path to I and is so indicated by a circle around the letter. On the second hop, eight packets are generated, two by each of the routers that received a packet on the first hop. As it turns out, all eight of these arrive at previously unvisited routers, and five of these arrive along the preferred line. Of the six packets generated on the third hop, only three arrive on the preferred path (at C, E, and K); the others are duplicates. After five hops and 24 packets, the broadcasting terminates, compared with four hops and 14 packets had the sink tree been followed exactly.

29 The Network Layer in the Internet At the network layer, the Internet can be viewed as a collection of subnetworks or Autonomous Systems (ASes) that are interconnected.

30 The Network Layer in the Internet - The glue that holds the whole Internet together is the network layer protocol, IP (Internet Protocol). - Its job is to provide a best-efforts way to transport datagrams from source to destination, without regard to whether these machines are on the same network or whether there are other networks in between them.

31 The Network Layer in the Internet Communication in the Internet works as follows: The transport layer takes data streams and breaks them up into datagrams, Each datagram is transmitted through the Internet, When all the pieces finally get to the destination machine, they are reassembled by the network layer into the original datagram, This datagram is then handed to the transport layer, which inserts it into the receiving process' input stream.

32 The IP Protocol(1) An IP datagram consists of a header part and a text part. The header format is transmitted in big-endian order: from left to right, with the high-order bit of the Version field going first.

33 The IP Protocol(1) - The Version field keeps track of which version of the protocol the datagram belongs to. By including the version in each datagram, it becomes possible to have the transition between versions take years, with some machines running the old version and others running the new one. - Since the header length is not constant, a field in the header, IHL, is provided to tell how long the header is, in 32-bit words. - The Type of service field is one of the few fields that has changed its meaning over the years. It was and is still intended to distinguish between different classes of service. Various combinations of reliability and speed are possible: For digitized voice, fast delivery beats accurate delivery, For file transfer, error-free transmission is more important than fast transmission.

34 The IP Protocol(1) - The Total length includes everything in the datagram—both header and data. - The Identification field is needed to allow the destination host to determine which datagram a newly arrived fragment belongs to. All the fragments of a datagram contain the same Identification value. - DF stands for (Don't Fragment). It is an order to the routers not to fragment the datagram because the destination is incapable of putting the pieces back together again. - MF stands for (More Fragments). It is needed to know when all fragments of a datagram have arrived. - The Fragment offset tells where in the current datagram this fragment belongs.

35 The IP Protocol(1) - The Time to live field is a counter used to limit packet lifetimes. It is supposed to count time in seconds, allowing a maximum lifetime of 255 sec. - When the network layer has assembled a complete datagram, it needs to know what to do with it. The Protocol field tells it which transport process to give it to. - The Header checksum verifies the header only. Such a checksum is useful for detecting errors generated by bad memory words inside a router. - The Source address and Destination address indicate the network number and host number.

36 The IP Protocol(1) - The Time to live field is a counter used to limit packet lifetimes. It is supposed to count time in seconds, allowing a maximum lifetime of 255 sec. - When the network layer has assembled a complete datagram, it needs to know what to do with it. The Protocol field tells it which transport process to give it to. - The Header checksum verifies the header only. Such a checksum is useful for detecting errors generated by bad memory words inside a router. - The Source address and Destination address indicate the network number and host number.

37 The IP Protocol (2) - The Options field was designed to provide an escape to allow subsequent versions of the protocol to include information not present in the original design, to permit experimenters to try out new ideas, and to avoid allocating header bits to information that is rarely needed. Originally, five options were defined, as follows:

38 The IP Protocol (2) 1. The Security option tells how secret the information is. 2. The Strict source routing option gives the complete path from source to destination as a sequence of IP addresses. 3. The Loose source routing option requires the packet to traverse the list of routers specified, and in the order specified, but it is allowed to pass through other routers on the way. 4. The Record route option tells the routers along the path to append their IP address to the option field. 5. Finally, the Timestamp option is like the Record route option, except that in addition to recording its 32-bit IP address, each router also records a 32-bit timestamp. This option, too, is mostly for debugging routing algorithms.

39 IP Addresses - Every host and router on the Internet has an IP address, which encodes its network number and host number. - No two machines on the Internet have the same IP address. - IP addresses were divided into the five categories, this allocation has come to be called classful addressing.

40 IP Addresses Here, the class A, B, C, and D formats allow for up to 128 networks with 16 million hosts each, 16,384 networks with up to 64K hosts, and 2 million networks with up to 256 hosts each. Addresses beginning with 1111 are reserved for future use. Network numbers are managed by a nonprofit corporation called ICANN (Internet Corporation for Assigned Names and Numbers) to avoid conflicts.

41 IP Addresses (2) The lowest IP address is 0.0.0.0 and the highest is 255.255.255.255. The values 0 and -1 have special meanings, The value 0 means this network or this host. The value of -1 is used as a broadcast address to mean all hosts on the indicated network.

42 IP Addresses (2) -The IP address 0.0.0.0 is used by hosts when they are being booted. - IP addresses with 0 as network number refer to the current network. These addresses allow machines to refer to their own network without knowing its number. - The address consisting of all 1s allows broadcasting on the local network. - The addresses with a proper network number and all 1s in the host field allow machines to send broadcast packets to distant LANs anywhere in the Internet. - Finally, all addresses of the form 127.xx.yy.zz are reserved for loopback testing.


Download ppt "BY Dr. Alaa Sagheer Computer Networks South Valley University Faculty of Science, Aswan Mathematics Department."

Similar presentations


Ads by Google