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.

www.jntuworld.com

www.jntuworld.com

JNTUWORLD

The Network Layer

Once data packets begin following along the path, each gateway relays incoming packets, converting between packet formats and virtual circuit numbers as needed. Clearly, all data packets must traverse the same sequence of gateways, and thus arrive in order.

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. Each gateway maintains tables telling which virtual circuits pass through it, where they are to be routed, and what the new virtual circuit number is.

Datagram Model: In this model, 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. Datagrams from one host to another host travel through different routes through the inter network. A routing decision is made separately for each packet, possibly depending on the traffic at the moment the packet is sent. This strategy can use multiple routes and thus achieve a higher band width than the concatenated virtual circuit model.

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.

www.jntuworld.com

www.jntuworld.com

JNTUWORLD Differences between a Virtual Circuit and a Datagram: s.no 1. 2. 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.

State information Routing

Each virtual circuit requires subnet table space Route chosen when virtual circuit is setup &all packets follow this route Easy, if enough buffers can be allocated in advance for each virtual circuit

4.

5.

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. Each routing algorithm possess certain properties like Correctness Simplicity Stability Optimality Fairness Robustness

Routing algorithms are divided into 2 groups: 1. Non-adaptive Routing Algorithms (static routing). 2. Adaptive Routing Algorithms (dynamic routing).

Non-adaptive routing algorithms are those that do not base their routing decisions on measurements or estimates of the current traffic and topology. The choice of the root to use to get from I to J is computed in advance, off-line and downloaded to routers when N/W is booted . 3

www.jntuworld.com

www.jntuworld.com

JNTUWORLD

The Network Layer

Adaptive routing algorithms are those that base their routing decisions on measurements, or estimates of the current traffic and topology. Non-Adaptive Routing Algorithms: Shortest path routing Flooding

(a). Shortest Path Routing: It is used to build a graph of the subnet, with each node of graph representing a router and each arc of the graph representing a communication line. To choose a route between a given pair of routers, the algorithm just finds the shortest path between them on the graph. Different ways of measuring the path length is the number of Hops, Geographical distance in kmts, Mean Queuing delay, Transmission delay, Functions of distance, Bandwidth, Average traffic, communication cost etc.,

Eg: - To compute shortest path from A to D: -

(i).Node A is permanent and adjacent nodes for A are found in this stage. (ii).Adjacent nodes of A are relabeled with distance from A, and node with minimum value becomes permanent. Here, node B. (iii).Adjacent nodes of B are relabeled with distance from A, and node with minimum value becomes permanent. Here, node E. (iv).Adjacent nodes of E are relabeled with distance from A, and node with minimum value becomes permanent. Here, node G. (v).Adjacent nodes of G are relabeled with distance from A, and node with minimum value becomes permanent. Here, node F.

www.jntuworld.com

www.jntuworld.com

JNTUWORLD

The Network Layer

Finally, Destination D is relabeled as D(10,H). The path is (D-H-F-E-B-A) as follows: D(10,H) = = = = = H(8,F) F(6,E) E(4,B) B(2,A) A

(C). Flooding: If every incoming packet is sent out on every outgoing line except the one it arrived on, it is called Flooding.

Flooding obviously generates vast numbers of duplicate packets. To damp this process, several techniques can be employed: 1. 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. Initially, the hop counter should be initialized to the length of the path from source to destination. 2. To keep track of which packets have been flooded so that they can be avoided sending second time. This is achieved by having the source router put a sequence number in each packet it arrives from its hosts. Each router then needs a list per source router telling which sequence numbers originating at that source have already been seen. If an incoming packet is on the list, it is not flooded.

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. In military, where large number of routers may be blown to bits at any instant. 2. In distributed database applications, it is sometimes necessary to update all the databases concurrently. 3. As a metric against which other routing algorithms can be compared.

www.jntuworld.com

www.jntuworld.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). 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. These tables are updated by exchanging information with the neighbors. This algorithm is also called as BELLMAN- FORD or FORD-FULKERSON algorithm. In this algorithm, each router maintains a routing table indexed by and containing one entry for each router in subnet. This entry contains 2 parts: The preferred outgoing line to use for that destination An estimate of time or distance (no of hops, or time delay or queue length) for that destination

Eg: Consider an example in which delay is used as a metric. Compute a Routing table J from the given subnet.

www.jntuworld.com

www.jntuworld.com

JNTUWORLD

The Network Layer

New routing table for J can be computed from its neighbors as follows:

Similarly.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,E,F,G,H,I,J,K, and L are computed.

Line to be followed A A I H I I H H I K K

(Count to infinity problem ):

Suppose A is down initially, and all other routers know this. When A comes up, other routers learn about it via the vector changes.The Good news spreads at the rate of one hop per exchange.

www.jntuworld.com

www.jntuworld.com

JNTUWORLD Bad news propagation (Count to infinity problem):

The Network Layer

Suppose initially, all the lines and routers are up. Suddenly A goes down.

From the above, it is clear that the bad news travels slowly.

Split Horizon Hack

Initially, if CD goes down. 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. Thus C immediately concludes that D is unreachable and reports this to both A and B. unfortunately, A hears that B has a path of length 2 to D, so it assumes it can get to D via B in 3 hops. Similarly B concludes it can get to D via A in 3 hops. On the next exchange, they each set their distance to 4.

www.jntuworld.com

www.jntuworld.com

JNTUWORLD

The Network Layer

(3). 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.g:

When 2-level hierarchy is considered. One region is considered along with its local routers. All other regions are considered in to a single router.

With 2-level hierarchy, Hierarchical routing has reduced the table form 17to 7 entries Region-1 is considered along with its local routers . Regions-2, 3,4,5 are considered as other routers.

Hierarchical table for 1A:

www.jntuworld.com

www.jntuworld.com

JNTUWORLD

The Network Layer

E.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 hosts home address.

(4). Mobile Routing:


(1) (2) (3) (4) Packet is sent to the mobile hosts home address. Packet is tunneled to foreign agent. Sender is given foreign agents address. Subsequent packets are tunneled to the foreign agent.

Packet transmission to Mobile users: 1. When a packet is sent to a mobile user, it is routed to the users home LAN as in (Step - 1). 2. Packet sent to the mobile user on its home LAN are intercepted by the home agent. The home agent then looks up the mobile users new location and finds the address of the foreign agent handling the mobile user. 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. This mechanism is called Tunneling (Step - 2). (b) After getting the encapsulated packet, the foreign agent removes the original packet from the payload field and sends it to the mobile user as a data link layer. (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, instead of just sending them to the mobile users home address (Step - 3). 3. Subsequent packets can now be routed directly to the user via the foreign agent, by passing the home location entirely (Step - 4).

10

www.jntuworld.com

www.jntuworld.com

JNTUWORLD

The Network Layer The process of sending a packet to all destinations

(5). Broad cast Routing:

simultaneously. Different ways of implementing Broad casting are: Sender maintains multiple destinations address and sends packets to each of them, simultaneously. Flooding. Multi Destination Routing i.e., each packet contains either a list of destinations or a bitmap indicating the desired destinations, and when a packet arrives at a router, the router checks all the destinations to determine the set of opposite lines that will be needed. The router generates a new copy of the packet for each packet only those destinations those are to use the line. Use of sink tree for the router. Reverse path-forwarding algorithm.

A Tree built by Reverse Path Forwarding : -

Working: 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 preferred path to I and is so indicated by a circle around the letter.

11

www.jntuworld.com

www.jntuworld.com

JNTUWORLD

The Network Layer

On the second hop, eight packets are generated, 2 by each of the routers that received a packet on the first hop.

As it turns out, all 8 of these arrive at previously unvisited routers and 5 of these along the preferred line.

Of the six packets generated on the third hop, only 3 arrive on the preferred path. The others are duplicates.

After 5 hops and 23 packets the broadcasting terminates, compared with 4 hops and 14 packets had the sink tree been followed exactly.

(6). Multicast Routing:


Definition: The transmission of a packet from multiple senders to multiple receivers. To do multicasting, group management is required. Routers learn about which of their hosts are in which groups by getting the information from the hosts or by periodically querying their hosts. To do multicasting, each router computes a spanning tree covering all other routers in the subnet. Eg:-

A subnet

A spanning tree for the left most router.

Pruned spanning tree for Group-1

Pruned spanning tree for Group-2

When a process sends a multicast packet to a group, the first router examines its spanning tree and prunes it, removing all lines that do not lead to hosts that are members of the group. Pruning can be done using link state routing or distance vector routing.

12

www.jntuworld.com

You might also like