You are on page 1of 12

www.jntuworld.

com

JNTUWORLD

The Network Layer

5. THE NETWORK LAYER
Services provided to the transport layer: 1. The services are independent of subnet technology. 2. The transport layer is shielded from the number, type and topology of subnets present. 3. The network addresses made available to transport layer uses a uniform numbering plan . Virtual Circuit Data gram A connection of the subnet. Independent packets of a connection-less organization.

Internetworking Styles: • • Concatenated Virtual Circuit Subnets Datagram Model (Connection-Oriented) (Connection-Less)

Concatenated Virtual Circuit Subnets: A connection to a host in a distant network is set up in a way similar to the way connections are normally established. The subnet sees that the destination is remote and builds a virtual circuit to the router nearest the destination network. Then it constructs a virtual circuit from that router to an external gateway, which records the existence of virtual circuit in its tables and proceeds to build another virtual circuit to a router in next subnet. This process continues until the destination host has been reached.

1

www.jntuworld.com

converting between packet formats and virtual circuit numbers as needed. Each gateway maintains tables telling which virtual circuits pass through it. all data packets must traverse the same sequence of gateways. This strategy can use multiple routes and thus achieve a higher band width than the concatenated virtual circuit model. The essential feature of this approach is that a sequence of virtual circuits is set up from the source through one or more gateways to the destination. and what the new virtual circuit number is.www. Datagrams from one host to another host travel through different routes through the inter network.com . each gateway relays incoming packets. where they are to be routed. A routing decision is made separately for each packet. Error! A major disadvantage of datagram model to internet working is that it can be used over the subnets that do not use virtual circuits inside. Clearly. 2 www. Datagram Model: In this model.jntuworld. the only service the n/w layer offers to the transport layer is the ability to inject datagrams into the subnet and hope for the best.jntuworld.com JNTUWORLD The Network Layer Once data packets begin following along the path. possibly depending on the traffic at the moment the packet is sent. and thus arrive in order.

www. Each routing algorithm possess certain properties like • • • Correctness Simplicity Stability • • • Optimality Fairness Robustness Routing algorithms are divided into 2 groups: 1. 5.no 1. The choice of the root to use to get from I to J is computed in advance.jntuworld.com JNTUWORLD Differences between a Virtual Circuit and a Datagram: s. Issue Circuit setup Addressing Data gram subnet Not required Each packet contains the full source and destination address Subnet does not hold state information Each packet is routed independently The Network Layer Virtual circuit subnet Required Each packet contains a short virtual circuit number 3. 3 www. off-line and downloaded to routers when N/W is booted . State information Routing Each virtual circuit requires subnet table space Route chosen when virtual circuit is setup &all packets follow this route Easy. 2. if enough buffers can be allocated in advance for each virtual circuit 4. Adaptive Routing Algorithms (dynamic routing). Non-adaptive Routing Algorithms (static routing). 2. Congestion control Difficult Routing algorithms: A routing algorithm is that part of the network layer software responsible for deciding which output line an incoming packet should be transmitted on.com .jntuworld. Non-adaptive routing algorithms are those that do not base their routing decisions on measurements or estimates of the current traffic and topology.

com . (ii). (iv).Node ‘A’ is permanent and adjacent nodes for ‘A’ are found in this stage. Geographical distance in kmts. Here. Here. and node with minimum value becomes permanent. (iii).jntuworld. Bandwidth. Average traffic. and node with minimum value becomes permanent.Adjacent nodes of ‘A’ are relabeled with distance from ‘A’.www..Adjacent nodes of ‘G’ are relabeled with distance from ‘A’.com JNTUWORLD The Network Layer Adaptive routing algorithms are those that base their routing decisions on measurements. Mean Queuing delay. Here.jntuworld.Adjacent nodes of ‘E’ are relabeled with distance from ‘A’. and node with minimum value becomes permanent. or estimates of the current traffic and topology. To choose a route between a given pair of routers. Functions of distance. Non-Adaptive Routing Algorithms: • • Shortest path routing Flooding (a). 4 www. Shortest Path Routing: It is used to build a graph of the subnet. Different ways of measuring the path length is the number of Hops. node ‘G’. with each node of graph representing a router and each arc of the graph representing a communication line. Here. (v).To compute shortest path from ‘A’ to ‘D’: - (i). the algorithm just finds the shortest path between them on the graph. and node with minimum value becomes permanent. node ‘B’. Eg: . node ‘F’. communication cost etc. node ‘E’. Transmission delay.Adjacent nodes of ‘B’ are relabeled with distance from ‘A’.

B) B(2. To keep track of which packets have been flooded so that they can be avoided sending second time.www. 5 www. it is sometimes necessary to update all the databases concurrently. several techniques can be employed: 1. The path is (D-H-F-E-B-A) as follows: D(10.A) A (C). where large number of routers may be blown to bits at any instant. it is not flooded. with the packet being discarded when the counter reaches ‘zero’.com . In military. 2. To damp this process. Destination ‘D’ is relabeled as D(10. Flooding: If every incoming packet is sent out on every outgoing line except the one it arrived on. Selective Flooding: The algorithm in which the routers do not send every incoming packet out on every line but only on those lines that are going approximately in the right direction Uses of Flooding: 1. which is decremented at each hop. Each router then needs a list per source router telling which sequence numbers originating at that source have already been seen. 2. As a metric against which other routing algorithms can be compared. it is called Flooding.E) E(4. Initially.H) = = = = = H(8. If an incoming packet is on the list.jntuworld. In distributed database applications. Flooding obviously generates vast numbers of duplicate packets.F) F(6. the hop counter should be initialized to the length of the path from source to destination. 3. To have a hop counter contained in the header of each packet.com JNTUWORLD The Network Layer Finally.H). This is achieved by having the source router put a sequence number in each packet it arrives from its hosts.jntuworld.

Distance Vector Routing: This algorithm operates by having each router maintain a table giving the best known distance to each destination and which line to use to get there. This entry contains 2 parts: • • The preferred outgoing line to use for that destination An estimate of time or distance (no of hops.jntuworld. Compute a Routing table ‘J’ from the given subnet. 6 www.www.jntuworld. In this algorithm. These tables are updated by exchanging information with the neighbors. This algorithm is also called as BELLMAN.com . each router maintains a routing table indexed by and containing one entry for each router in subnet. or time delay or queue length) for that destination Eg: Consider an example in which delay is used as a metric.FORD or FORD-FULKERSON algorithm.com JNTUWORLD Adaptive Routing Algorithms Distance Vector Routing Link state Routing Hierarchical Routing Routing for Mobile hosts Broad cast Routing Multicast Routing The Network Layer (1).

E.F.jntuworld.H.jntuworld.G. Line to be followed A A I H I I H H I K K (Count to infinity problem ): Suppose ‘A’ is down initially.I. When ‘A’ comes up. and L are computed.www.The Good news spreads at the rate of one hop per exchange.com JNTUWORLD The Network Layer New routing table for ‘J’ can be computed from its neighbors as follows: Similarly…. other routers learn about it via the vector changes.com .the routing tables for J New routing table for ‘J’: To A B C D E F G H I J K L Draw backs: It reacts… Rapidly to Good News Leisurely to Bad News Good news propagation From ‘J’ 8 20 28 20 17 30 18 12 10 0 6 15 D. 7 www. and all other routers know this.K.J.

com JNTUWORLD Bad news propagation (Count to infinity problem): The Network Layer Suppose initially.www. so it assumes it can get to ‘D’ via ‘B’ in 3 hops. it is clear that the bad news travels slowly. Thus ‘C’ immediately concludes that ‘D’ is unreachable and reports this to both A and B.jntuworld. all the lines and routers are up. 8 www. ‘A’ hears that B has a path of length 2 to D. Suddenly ‘A’ goes down. Split Horizon Hack : Initially. On the next exchange. unfortunately.jntuworld.com . if ‘CD’ goes down. Similarly ‘B’ concludes it can get to D via ‘A’ in 3 hops. From the above. they each set their distance to 4. This bad news is propagated at a rate of one hop per exchange using split-horizon hack. Both A and B tell ‘C’ that they cannot get to D.

All other regions are considered in to a single router.com . Hierarchical routing has reduced the table form 17to 7 entries… Region-1 is considered along with its local routers . Regions-2.4.5 are considered as other routers.jntuworld.com JNTUWORLD The Network Layer (3). One region is considered along with its local routers. 3.jntuworld. Hierarchical Routing : Different levels are used to compute the routes: • • • • • Level 1 Level 2 Level 3 Level 4 Level 5 Routers Regions Clusters Zones Zonal regions E.www.g: • When 2-level hierarchy is considered…. • With 2-level hierarchy. Hierarchical table for 1A: 9 www.

The home agent then looks up the mobile user’s new location and finds the address of the foreign agent handling the mobile user. Packet transmission to Mobile users: 1. Mobile Routing: (1) (2) (3) (4) Packet is sent to the mobile host’s home address.com JNTUWORLD The Network Layer E. When a packet is sent to a mobile user. the foreign agent removes the original packet from the payload field and sends it to the mobile user as a data link layer. Sender is given foreign agent’s address.jntuworld. Packet sent to the mobile user on its home LAN are intercepted by the home agent. it is routed to the user’s home LAN as in (Step . instead of just sending them to the mobile user’s home address (Step . 3.3).1). Subsequent packets can now be routed directly to the user via the foreign agent.g: Consider a subnet with 720 routers ( Routing table entries can be reduced using higher levels in Hierarchical Routing) (1) Packet is sent to the mobile host’s home address. (4). Packet is tunneled to foreign agent. by passing the home location entirely (Step .4).www.2). 2. 10 www. The home agent then does 2 things: (a) It encapsulates the packet in the payload field of an outer packet and sends this packet to the foreign agent. (b) After getting the encapsulated packet.jntuworld. This mechanism is called “Tunneling” (Step . Subsequent packets are tunneled to the foreign agent.com . (c) The home agent tells the sender to henceforth send packets to the mobile host by encapsulating them in the payload of packets explicitly addressed to the foreign agent.

• • Use of sink tree for the router. The router generates a new copy of the packet for each packet only those destinations those are to use the line. the router checks all the destinations to determine the set of opposite lines that will be needed. • • Flooding.com . each packet contains either a list of destinations or a bitmap indicating the desired destinations. Reverse path-forwarding algorithm. J and N as indicated by the second row of the tree. ‘I’ sends packets to F.. and when a packet arrives at a router. simultaneously. Different ways of implementing Broad casting are: Sender maintains multiple destinations address and sends packets to each of them. 11 www.jntuworld. Multi Destination Routing i. H. Broad cast Routing: • simultaneously. A Tree built by Reverse Path Forwarding : - Working: • • On the first hop.com JNTUWORLD The Network Layer The process of sending a packet to all destinations (5).e.www. Each of these packets arrives on preferred path to I and is so indicated by a circle around the letter.jntuworld.

group management is required. The others are duplicates. all 8 of these arrive at previously unvisited routers and 5 of these along the preferred line.jntuworld. only 3 arrive on the preferred path. • Of the six packets generated on the third hop. • To do multicasting. • After 5 hops and 23 packets the broadcasting terminates.com JNTUWORLD • The Network Layer On the second hop.jntuworld. Pruned spanning tree for Group-1 Pruned spanning tree for Group-2 When a process sends a multicast packet to a group. • As it turns out. Pruning can be done using link state routing or distance vector routing. compared with 4 hops and 14 packets had the sink tree been followed exactly. the first router examines its spanning tree and prunes it. 12 www. Eg:- A subnet A spanning tree for the left most router. each router computes a spanning tree covering all other routers in the subnet. removing all lines that do not lead to hosts that are members of the group. eight packets are generated.com . 2 by each of the routers that received a packet on the first hop. (6). • To do multicasting.www. Routers learn about which of their hosts are in which groups by getting the information from the hosts or by periodically querying their hosts. Multicast Routing: Definition: The transmission of a packet from multiple senders to multiple receivers.