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  A connection of the subnet.
Data gram  Independent packets of a connection-less organization.

Internetworking Styles:

Concatenated Virtual Circuit Subnets

(Connection-Oriented)

Datagram Model

(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

The Network Layer

Differences between a Virtual Circuit and a Datagram:


s.no

Issue

1.

Circuit setup

Not required

Required

2.

Addressing

Each packet contains the


full source and
destination address

Each packet contains a


short virtual circuit
number

3.

State
information

Subnet does not hold


state information

Routing

Each packet is routed


independently

4.

5.

Congestion
control

Data gram subnet

Virtual circuit subnet

Each virtual circuit


requires subnet table space
Route chosen when virtual
circuit is setup &all
packets follow this route

Difficult
Easy, if enough buffers
can be allocated in
advance for each virtual
circuit

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)

(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

The Network Layer

Adaptive Routing Algorithms


Distance Vector Routing
Link state Routing
Hierarchical Routing
Routing for Mobile hosts
Broad cast Routing
Multicast Routing

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


New routing table for J:
To
A
B
C
D
E
F
G
H
I
J
K
L

From J
8
20
28
20
17
30
18
12
10
0
6
15

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

Draw backs:
It reacts Rapidly to Good News
Leisurely to Bad News
Good news propagation

(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

The Network Layer

Bad news propagation

(Count to infinity problem):

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

Routers

Level 2

Regions

Level 3

Clusters

Level 4

Zones

Level 5

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) Packet is sent to the mobile hosts home address.
(2) Packet is tunneled to foreign agent.
(3) Sender is given foreign agents address.
(4) 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

(5). Broad cast Routing:

The Network Layer


The process of sending a packet to all destinations

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 spanning tree for the left most router.

A subnet

Pruned spanning tree for Group-2

Pruned spanning tree for Group-1

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