Cn-Unit 4
Cn-Unit 4
Network layer
The network layer is at the level-3 of the OSI reference model. It responses to the
services request of the transport layer and is responsible for N to N i.e. source to destination
packet delivery by taking up efficient path through the network for data transmission.It also
manages options pertaining to host and network addressing, managing sub-networks, and
internetworking.
Network layer takes the responsibility for routing packets from source to destination
within or outside a subnet. Two different subnet may have different addressing schemes or non-
compatible addressing types. Same with protocols, two different subnet may be operating on
different protocols which are not compatible with each other. Network layer has the
responsibility to route the packets from source to destination, mapping different addressing
schemes and protocols.
Devices which work on Network Layer mainly focus on routing. Routing may include
various tasks aimed to achieve a single goal. These can be:
Addressing devices and networks.
Populating routing tables or static routes.
Queuing incoming and outgoing data and then forwarding them according to quality of
service constraints set for those packets.
Internetworking between two different subnets.
Delivering packets to destination with best efforts.
Provides connection oriented and connection less mechanism.
Page | 1
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
2. Service provided to transport layer:
The network layer provides different services to the transport layer. These services have
been designed with the following concepts:-
The services should be independent of the router technology.
The transport layer should be shielded from the number, type and topology of the
router present in the network.
The network addresses made available to the transport layer should be a uniform
numbering format for any type of network.
Page | 2
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
Comparison of Virtual-Circuit and Datagram Subnet
Issue Datagram Subnet Virtual-Circuit Subnet
Circuit Setup Not needed Required
Addressing Each packet contains the full Each packet contains a short
source and destination addressvirtual circuit number
State information Routers do not hold state Each virtual circuit requires
information about connections router table space per
connection
Routing Each packet is routed Route chosen when virtual
independently circuit is set up, all packets
follow it
Effect of router failures None, except for packets lost All virtual circuits that passed
during the crash through the failed route are
terminated
Quality of service Difficult Easy if enough resources can
be allocated in advance for
each virtual circuit.
Congestion control Difficult Easy if enough resourced can
be allocated in advance for
each virtual circuit
Routing Algorithms
The routing algorithm is a part of network layer software which is responsible for
deciding the output line for every incoming data packet for its transmission through the network.
If the network uses datagram, routing decisions are made for every new packet. These packets
when arrived at the routers make the routing decision by looking up the number of outgoing lines
from the router and by looking at the information in the routing table. This process is called as
forwarding.
If the network uses virtual circuit, routing decisions are made only when a new virtual
circuit is been established. All the data packets follow this established route. This process is
called as sessions routing.
Page | 3
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
Properties of routing algorithm :
1. Correctness
2. Simplicity
3. Robustness
4. Stability
5. Fairness
6. Optimality
Optimality Principal:
Before going to any specific algorithm of routing it is necessary to understand the general
statement about optimal routes without regards to the n/w topology or traffic in the n/w. This
statement is called as optimality principal. It states that there exists at least route from one node
to ant other node in the same n/w and if a router A and if a router B is on the optimal path from
A to router C then the optimal path from B to C also lies along the same route.
Step 1 Step 2
Step 4
Step 3
Page | 4
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
Here we want to find the best route between A and E. (You can see that there are six possible
routes between A and E (ABE, ACE, ABDE, ACDE, ABDCE, ACDBE), and it's obvious that
ABDE is the best route because its weight is the lowest. But life is not always so easy, and there
are some complicated cases in which we have to use algorithms to find the best route.
1. As you see in the first image, the source node (A) has been chosen as T-node, and so its
label is permanent (we show permanent nodes with filled circles and T-nodes with the -->
symbol).
2. In the next step, you see that the status record set of tentative nodes directly linked to T-
node (B, C) has been changed. Also, since B has less weight, it has been chosen as T-
node and its label has changed to permanent (see below).
3. In step 3, like in step 2, the status record set of tentative nodes that have a direct link to T-
node (D, E), has been changed. Also, since D has less weight, it has been chosen as T-
node and its label has changed to permanent.
4. In step 4, we don't have any tentative nodes, so we just identify the next T-node. Since E
has the least weight, it has been chosen as T-node.
Flooding:
In this technique every incoming packets is sent out on every outgoing path from that
node except the one from where it is arrived. Flooding generates vast number of duplicate
packets until some measures are taken to avoid this process. One such measure to avoid
receiving of duplicate packets at the destination is identifying each packet with a sequence
number. So that the destination can distinguish between duplicate packets, and if the packet is
reached to the destination it can easily terminate other duplicate packets. The technique of
flooding is also called as broadcast routing or multidestination routing.
Another variation in flooding is selectiveflooding. In this algorithm, the flooding
technique is carried out only by those routers who are sure about reaching to destination
Router
Hierarchical routing:
Because of the global nature of Internet system, it becomes more difficult to centralize
the system management and operation. For this reason, the system must be hierarchical such that
Page | 5
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
it is organized into multiple levels with several group loops connected with one another at each
level. Therefore, hierarchical routing is commonly used for such a system.
This technique is used for very vast networks. Here the routers in the n/w are grouped
into regions then these regions are again grouped into clusters and the clusters into zones. Here
each region will have the information of only those routers which are included into it and
theclusters have the information of only those regions which are included in it and so on. If the
data packet is transmitted, first it will be routed to the proper zone which consists of destination.
Once it is reached to the zone it is directed to the proper region instead of wasting time for
searching of the destination in other regions. From here the packet is transmitted to the proper
router and then to the destination.
Example:
Consider a subnet with 720 routers, if there is no hierarchy each router has to maintain
720 routing tables. To avoid these, the subnet can be divided into 24 regions of 30 routers each.
By this the router needs to have the information of only the 30 local routers and 23 region into
the routing table i.e each router will have only 53 entries.
Page | 6
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
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.
2. Measure the delay or cost to each of its neighbors : The link state router requires
each router to know, or at least have a reasonable estimate of, the delay to each of its
neighbors. ECHO packet 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 the
estimate of the delay.
3. Construct a packet telling all it has just learned :here each router has to build a
packet containing all data like identity of the sender, sequence number, age and list of
neighbors.
4. Send this packet to all other routers :In this part the link state packets are flooded to
allover the network. To keep the flood check, each packet contains a sequence number
that is incremented for each new packet sent.
5. Compute the shortest path to every other router :Once a router has accumulated a full
set of link state packets, it can construct the entire subnet graph because every link is
represented. Shortest path routing algorithm can be run locally to construct the
shortest path to all possible destinations.
This contrasts with distance-vector routing protocols, which work by having each node
share its routing table with its neighbors. In a link-state protocol the only information passed
between nodes is connectivity related.
Page | 7
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
Multicast Routing:
Sending a message or data packet to specific group of nodes in the n/w is called as
multicast routing.
Multicasting requires group management. Some way is needed to create and destroy
groups, and it also allows processes for a member to join or leave the group. These tasks are
accomplished without the concern of routing algorithm. Here it is very important that the routers
should know which of their host belong to which group. Either the host must inform their routers
about the changes or the router must query their host periodically. To perform multicast routing
each router computes a spanning tree of the n/w covering all the routers.
Example:
Page | 9
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
In this algorithm when a process sends a multicast packet to a group the first router
examines its spanning tree, removing all the lines that do not lead to any member of the groups.
And then the broadcasting takes place only within the group with which the data packet is
addressed.
Congestion
Congestion is a situation that occur when the number of packets being transmitted
through the network approaches the packet handling capacity of the network i.e. when the
number of packets are dumped into the subnet by a host, if the number of packet is within the
carrying capacity of the channel, all the packets will be delivered to the destination but if the n/w
gets overloaded it leads to congestion in the n/w and starts dropping the packets.
Page | 10
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
Reasons for congestion:
Sudden arrival of packets on a particular output lines by a multiple input lines. Here
the memory of the router becomes inefficient and the packets are dropped.
Slow processor can also cause congestion.
Low bandwidth channel can also cause congestions.
1) Open loop:
Open loop solution attempt to solve the problem by taking good decisions at the
initial stage, it ensures that the congestion does not occur in the n/w.
Admission control.
Resource reservation.
Retransmission policy.
Window policy.
Acknowledgement policy.
Discarding policy, etc.
2) Close loop:
In contrast close loop solutions are based on the concept of feedback. Close loop
algorithm follows a dynamic approach i.e. it reacts during the congestion occurrence
period according to the situation. The congestion control is managed by observation of
queue length, number of retransmitted packets, routers memory, and average packet
delay.
Back pressure
Choke packet
Implicit signalling
Explicit signalling
2. Retransmission Policy :
If the sender feels that a sent packet is lost or corrupted, the packet needs to be
retransmitted. Retransmission in general may increase congestion in the network. However, a
good retransmission policy can prevent congestion. The retransmission policy and the
Page | 11
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
retransmission timer must be designed to optimize efficiency and at the same time prevent
congestion. For example, the retransmission policy used by TCP is designed to prevent
congestion.
3. Window Policy :
The type of window at the sender may also affect congestion. The Selective Repeat
window is better than the Go-Back-N window for congestion control.
4. Acknowledgment Policy :
The acknowledgment policy imposed by the receiver may also affect congestion. A
receiver may decide to acknowledge only N packets at a time. We need to know that the
acknowledgments are also part of the load in a network. Sending less number of
acknowledgments means imposing less load on the network.
5. Discarding Policy :
A good discarding policy by the routers may prevent congestion.
6. Resource Reservation :
Once we have a specific route for a flow, it becomes possible to reserve resources along
that route to make sure the needed capacity is available. Three different kinds of resources can
potentially be reserved are
Bandwidth
Buffer space
CPU cycle
2. Choke Packet :
A choke packet is a packet sent by a node to the source to inform it of congestion. In this
method, the warning is from the router, which has encountered congestion, to the source station
directly. The intermediate nodes through which the packet has travelled are not warned.
3. Implicit Signalling :
In implicit signalling, there is no communication between the congested node and the
source. The source guesses that there is a congestion somewhere in the network from other
symptoms.
4. Explicit Signalling :
The node that experiences congestion can explicitly send a signal to the source or
destination. Backward SignallingA bit can be set in a packet moving in the direction opposite to
the congestion. This bit can warn the source that there is congestion. Forward Signalling A bit
Page | 12
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
can be set in a packet moving in the direction of the congestion. This can warn the destination
that there is congestion.
2. Choke Packets :
In this approach, the router sends a choke packet back to the source host, giving it
the destination found in the packet. The original packet is tagged so that it will not
generate any more choke packet farther along the path and is then forwarded in the usual
way.
When the source host gets the choke packet, it is required to reduce the traffic sent
to the specified destination by Xpercent. Since other packets aimed at the same
destination are probably already under way and will generate yet more choke packets, the
host should ignore choke packets referring to that destination for a fixed time interval.
After that period has expired, the host listens for more choke packets for another interval.
If one arrives, the line is still congested, so the host reduces the flow still more and begins
ignoring choke packets again. If no choke packets arrive during the listening period, the
host may increase the flow again. The feedback implicit in this protocol can prevent
congestion.
Page | 13
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
3. Hop-by Hop Choke Packet :
An alternative approach is to have the choke packet take effect at every hop it
passes through. Here as soon as the choke packet reaches F, F requires to reduce the flow
to D. Doing so will require F to devote more buffers to the flow, since the source is still
sending away at full blast, but it gives D immediate relief. In the next step, the choke
packet reaches E, which tells E to reduce the flow to F. This action puts a greater demand
on E’s buffers but gives F immediate relief. Finally, the choke packet reaches A and the
flow genuinely slows down.
4. Load Shedding :
Load shedding is a fancy way of saying that when routers are being inundated by
packets that they cannot handle, they just throw them away. This is done to save the
entire grid from collapsing.
It is well known that dealing with congestion after it is first detected is more
effective than letting it gum up the works and then trying to deal with it. This observation
leads to the idea of discarding packets before all the buffer space is really exhausted. A
popular algorithm for doing this is called RED (Random Early Detection).
5. Jitter Control :
For applications such as audio and video streaming, it does not matter much if the
packet take 20 msec or 30 msec to be delivered, as long as the transit time is constant.
The variation in the packet arrival times is called jitter.
Page | 14
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
The jitter can be bounded by computing the expected transit time for each hop
along the path. When a packet arrives at a router, the router checks to see how much the
packet is behind or ahead of its schedule. This information is stored in the packet and
updated at each hop. If the packet is ahead of schedule, it is held just long enough to get it
back on schedule. If it is behind schedule, the router tries to get it out the door quickly.
If it is expected that the traffic flow should be very smooth then the bucket has to be of a shallow
type i.e. if the flow of data is more bursty in nature the bucket should be more deeper.
Page | 15
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
Parameters:
1. Smooth out traffic by passing packets only when there is a token. Does not permit
burstiness.
2. Discards packets for which no tokens are available (no concept of queue)
3. Application: Traffic shaping or traffic policing.
This mechanism is slight different from leaky bucket algorithm in traffic policing. The
bucket in traffic policing is just a counter where as a bucket in traffic shaper is a memory buffer
that stores the packet.
Page | 16
Prof. Snehalata Bandagi, GSS BCA.
COMPUTER NETWORKS - UNIT 4
Token bucket:
Parameters:.
1. Token bucket smoothens traffic too, but permits burstiness which is equivalent to the
number of tokens accumulated in the bucket.
2. Discards tokens when bucket is full, but never discards packets (infinite queue).
3. Application: Network traffic shaping or rate limiting.
Type of Internetworking
Internetworking is implemented in Layer 3 (Network Layer) of this model The most
notable example of internetworking is the Internet (capitalized). There are three variants of
internetwork or Internetworking, depending on who administers and who participates in them :
1. Intranet
2. Extranet
3. Internet
1. Intranet
An intranet is a set of interconnected networks or Internetworking, using the Internet
Protocol and uses IP-based tools such as web browsers and ftp tools, that is under the control
of a single administrative entity. That administrative entity closes the intranet to the rest of
the world, and allows only specific users. Most commonly, an intranet is the internal
network of a company or other enterprise. A large intranet will typically have its own web
server to provide users with browseable information. It allows the employees and collegues
to work with each other in a virtual space.
2. Extranet
An extranet is a network of internetwork or Internetworking that is limited in scope
to a single organisation or entity but which also has limited connections to the networks of
one or more other usually, but not necessarily, trusted organizations or entities . The major
difference between intranet and extranet is that an intranet is typically used internally. While
a extranet allows businesses to communicate with clients and vendors.
3. Internet
A specific Internetworking, consisting of a worldwide interconnection of
governmental, academic, public, and private networks based upon the Advanced Research
Projects Agency Network (ARPANET) developed by ARPA of the U.S. Department of
Defence also home to the World Wide Web (WWW) and referred to as the 'Internet' with a
capital 'I' to distinguish it from other generic internetworks. Participants in the Internet, or
their service providers, use IP Addresses obtained from address registries that control
assignments.
Page | 18
Prof. Snehalata Bandagi, GSS BCA.