0% found this document useful (0 votes)
19 views39 pages

Class notes

These are the class notes prepared by me.

Uploaded by

voshit2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views39 pages

Class notes

These are the class notes prepared by me.

Uploaded by

voshit2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

UNIT-III

NETWORK LAYER

Network Layer:
The network Layer is the third layer in the OSI model of computer
networks. Its main function is to transfer network packets from the
source to the destination. It involves both the source host and the
destination host.
Key among these services are packetizing, routing, and forwarding.
Packetizing involves encapsulating data into packets suitable for
transmission. Routing determines the optimal path for these packets
through the network, ensuring they navigate through multiple nodes
and networks efficiently. Forwarding is the process of directing these
packets to their next hop along the selected path.
In this article, we will discuss these topics in detail, along with the
services provided by the network layer, etc.

Network:

A network is a group of two or more connected computers or devices.


These devices usually connect to a central hub, like a router. Networks
can also have subnetworks, which are smaller sections of the main
network. Subnetworks help large networks, such as those used by
Internet Service Providers (ISPs), manage many IP addresses and
devices.
The Internet is like a network of networks. Computers connect within
their own networks and then connect to other networks. This allows
computers to communicate with each other, no matter where they are.

Features of Network Layer:


 The main responsibility of the Network layer is to carry the data
packets from the source to the destination without changing or using
them.
 If the packets are too large for delivery, they are fragmented i.e.,
broken down into smaller packets.
 It decides the route to be taken by the packets to travel from the
source to the destination among the multiple routes available in a
network (also called routing).
 The source and destination addresses are added to the data packets
inside the network layer.

Services Offered by Network Layer:


The services which are offered by the network layer protocol are as
follows:
 Packetizing
 Routing
 Forwarding

1. Packetizing
The process of encapsulating the data received from the upper layers of
the network (also called payload) in a network layer packet at the source
and encapsulating the payload from the network layer packet at the
destination is known as packetizing.
The source host adds a header that contains the source and destination
address and some other relevant information required by the network
layer protocol to the payload received from the upper layer protocol and
delivers the packet to the data link layer.
The destination host receives the network layer packet from its data link
layer, encapsulates the packet, and delivers the payload to the
corresponding upper layer protocol. The routers in the path are not
allowed to change either the source or the destination address. The
routers in the path are not allowed to encapsulate the packets they
receive unless they need to be fragmented.
Packetizing
2. Routing
Routing is the process of moving data from one device to another device.
These are two other services offered by the network layer. In a network,
there are a number of routes available from the source to the
destination. The network layer specifies some strategies which find out
the best possible route. This process is referred to as routing. There are a
number of routing protocols that are used in this process and they
should be run to help the routers coordinate with each other and help in
establishing communication throughout the network.
Routing
3. Forwarding
Forwarding is simply defined as the action applied by each router when
a packet arrives at one of its interfaces. When a router receives a packet
from one of its attached networks, it needs to forward the packet to
another attached network (unicast routing) or to some attached
networks (in the case of multicast routing). Routers are used on the
network for forwarding a packet from the local network to the remote
network. So, the process of routing involves packet forwarding from an
entry interface out to an exit interface.
Forwarding

Differences Between Routing and Forwarding


Routing Forwarding

Forwarding is simply
defined as the action applied
Routing is the process of moving data from
by each router when a
one device to another device.
packet arrives at one of its
interfaces.

Operates on the Network


Operates on the Network Layer.
Layer.

Checks the forwarding table


Work is based on Forwarding Table.
and work according to that.

Works on protocols like


Works on protocols like Routing
UDP Encapsulating Security
Information Protocol (RIP) for Routing.
Payloads

Other Services Expected from Network Layer


 Error Control
 Flow Control
 Congestion Control

1. Error Control
Although it can be implemented in the network layer, it is usually not
preferred because the data packet in a network layer may be fragmented
at each router, which makes error-checking inefficient in the network
layer.

2. Flow Control
It regulates the amount of data a source can send without overloading
the receiver. If the source produces data at a very faster rate than the
receiver can consume it, the receiver will be overloaded with data. To
control the flow of data, the receiver should send feedback to the sender
to inform the latter that it is overloaded with data.
There is a lack of flow control in the design of the network layer. It does
not directly provide any flow control. The datagrams are sent by the
sender when they are ready, without any attention to the readiness of
the receiver.

3. Congestion Control
Congestion occurs when the number of datagrams sent by the source is
beyond the capacity of the network or routers. This is another issue in
the network layer protocol. If congestion continues, sometimes a
situation may arrive where the system collapses and no datagrams are
delivered. Although congestion control is indirectly implemented in the
network layer, still there is a lack of congestion control in the network
layer.

Advantages of Network Layer Services


 Packetization service in the network layer provides ease of
transportation of the data packets.
 Packetization also eliminates single points of failure in data
communication systems.
 Routers present in the network layer reduce network traffic by
creating collision and broadcast domains.
 With the help of Forwarding, data packets are transferred from one
place to another in the network.

Disadvantages of Network Layer Services


 There is a lack of flow control in the design of the network layer.
 Congestion occurs sometimes due to the presence of too many
datagrams in a network that is beyond the capacity of the network or
the routers. Due to this, some routers may drop some of the
datagrams, and some important pieces of information may be lost.
 Although indirect error control is present in the network layer, there
is a lack of proper error control mechanisms as due to the presence of
fragmented data packets, error control becomes difficult to
implement.

Functions Performed by the Network Layer:

The network layer performs several functions to facilitate data


transmission in a network. Some of the functions performed are as
follows:

1. Routing: It is the process to determine the most effective route for


data transmission in the network. When a data packet arrives at the
router's input link, it determines the ideal route for data
transmission in the network. It determines the path that will be
used to transfer the packet further in the network.
2. Logical Addressing: There are two types of addressing
performed in the network: logical addressing and physical
addressing. The data link layer performs the physical addressing,
while the network layer does the logical addressing in the OSI
model. Logical addressing is also used to distinguish between the
source and destination system. The network layer adds a header to
the packet, which includes the logical addresses of both the sender
and the receiver.
3. Internetworking: This is the most important function performed
by the network layer of the OSI model. It establishes the logical
connection between nodes in the same or different networks.
4. Fragmentation:It is the conversion of data packets into the
smallest individual data units capable of being transmitted in the
network.

Routing:

Routing refers to the process of directing a data packet from one node to
another. It is an autonomous process handled by the network devices to
direct a data packet to its intended destination. Note that, the node here
refers to a network device called - 'Router'.
Routing is a crucial mechanism that transmits data from one location to
another across a network (Network type could be any like LAN, WAN, or
MAN). The process of routing involves making various routing decisions
to ensure reliable & efficient delivery of the data packet by finding the
shortest path using various routing metrics

Routing of a data packet is done by analyzing the destination IP Address


of the packet. Look at the below image:
 The Source Node (Sender) sends the data packet on the network,
embedding the IP in the header of the data packet.
 The nearest router receives the data packet, and based on some
metrics, further routes the data packet to other routers.
 Step 2 occurs recursively till the data packet reaches its intended
destination.

Routing is typically of 3 types, each serving its purpose and offering


different functionalities.

Types of Routing
1. Static Routing
Static routing is also called as "non-adaptive routing". In this, routing
configuration is done manually by the network administrator. Let's say
for example, we have 5 different routes to transmit data from one node
to another, so the network administrator will have to manually enter the
routing information by assessing all the routes.
 A network administrator has full control over the network, routing
the data packets to their concerned destinations
 Routers will route packets to the destination configured manually by
the network administrator.
 Although this type of routing gives fine-grained control over the
routes, it may not be suitable for large-scale enterprise networks.
2. Dynamic Routing
Dynamic Routing is another type of routing in which routing is an
autonomous procedure without any human intervention. Packets are
transmitted over a network using various shortest-path algorithms and
pre-determined metrics. This type of routing is majorly preferred in
modern networks as it offers more flexibility and versatile functionality.
 It is also known as adaptive routing.
 In this, the router adds new routes to the routing table based on any
changes made in the topology of the network.
 The autonomous procedure of routing helps in automating every
routing operation from adding to removing a route upon updates or
any changes made to the network.
3. Default Routing
Default Routing is a routing technique in which a router is configured to
transmit packets to a default route that is, a gateway or next-hop device
if no specific path is defined or found. It is commonly used when the
network has a single exit point. The IP Router has the following address
as the default route: 0.0.0.0/0.

Routing Protocols
Routing protocols are essential for determining how data packets are
transferred across networks. They help routers communicate with each
other to find the most efficient paths for data to travel.
IGP and EGP Routing Protocols

An autonomous system (AS) is a collection of routers under a


common administration such as a company or an organization. An AS is
also known as a routing domain. Typical examples of an AS are a
company’s internal network and an ISP’s network.

The Internet is based on the AS concept; therefore, two types of routing


protocols are required:

 Interior Gateway Protocols (IGP): Used for routing within an


AS. It is also referred to as intra-AS routing. Companies,
organizations, and even service providers use an IGP on their
internal networks. IGPs include RIP, EIGRP, OSPF, and IS-IS.
 Exterior Gateway Protocols (EGP): Used for routing between
autonomous systems. It is also referred to as inter-AS routing.
Service providers and large companies may interconnect using an
EGP. The Border Gateway Protocol (BGP) is the only currently
viable EGP and is the official routing protocol used by the Internet.
Routing protocols are typically divided into categories like distance
vector, link-state, and hybrid protocols. Distance vector protocols,
such as RIP, determine routes based on the number of hops. Link-state
protocols, like OSPF, rely on a more detailed understanding of the entire
network topology. Hybrid protocols, such as EIGRP, incorporate
elements from both approaches to balance efficiency and accuracy.

1. Distance Vector Routing Protocol


These protocols select the best path based on hop counts to reach a
destination network in a particular direction. Dynamic protocol
like RIP(Routing Internet Protocol) is an example of a distance vector
routing protocol. Hop count is each router that occurs between the
source and the destination network. The path with the least hop count
will be chosen as the best.
Features
 Updates of the network are exchanged periodically.
 Updates (routing information) are not broadcasted but shared to
neighbouring nodes only.
 Full routing tables are not sent in updates; only the distance vector is
shared.
 Routers always trust routing information received from neighbor
routers. This is also known as routing rumors.

Advantages
 Simple to Use: Easy setup and operation.
 Low Resource Usage: Requires minimal CPU and memory.
 Automatic Updates: Handles network changes automatically.
 Good for Small Networks: Works well in simple setups.

Disadvantages
 Slow Convergence: Takes time to update routes after a network
change.
 Limited Scalability: Not efficient for large networks.
 High Bandwidth Use: Frequent updates may consume more
network bandwidth.
 Less Accurate: Routes may not always be optimal.

2. Link State Routing Protocol


These protocols know more about Internetwork than any other distance
vector routing protocol. These are also known as SPF (Shortest Path
First) protocol. OSPF is an example of link-state routing protocol.
Features
 Hello, messages, also known as keep-alive messages are used for
neighbor discovery and recovery.
 The concept of triggered updates is used i.e. updates are triggered
only when there is a topology change.
 Only that many updates are exchanged which is requested by the
neighbor router.
Tables Used in Link State Routing
Link state routing protocol maintains three tables namely:
 Neighbor table: the table which contains information about the
neighbors of the router only, i.e, to which adjacency has been formed.
 Topology table: This table contains information about the whole
topology i.e contains both best and backup routes to a particular
advertised networks.
 Routing table: The Routing table contains all the best routes to the
advertised network.

Advantages
 Faster Updates: Quickly adapts to network changes.
 Accurate Routing: Provides optimal routes with a complete
network view.
 Works for Large Networks: Suitable for big, complex networks.
 Prevents Routing Loops: Avoids errors in route calculations.
 More Reliable: Less prone to mistakes in routing.
Disadvanatges
 High Resource Usage: Requires more memory and processing
power.
 Complex Setup: More difficult to configure and maintain.
 Increased Bandwidth: Uses more bandwidth for network updates.
 Not Ideal for Small Networks: Overhead is unnecessary in small
setups.

3. Hybrid Protocol
It is also known as hybrid routing protocol which uses the concept of
both distance vector and link-state routing protocol. Enhanced Interior
Gateway Routing Protocol (EIGRP) is an example of this class of routing
protocol. EIGRP acts as a link-state routing protocol as it uses the
concept of Hello protocol for neighbor discovery and forming an
adjacency. Also, partial updates are triggered when a change occurs.
EIGRP acts as a distance-vector routing protocol as it learned routes
from directly connected neighbors.
Advanatages
 Combines Strengths: Mixes benefits of distance vector and link
state routing.
 Scalable: Works well in both small and large networks.
 Quick Updates: Adapts fast to network changes.
 Efficient Bandwidth: Uses less bandwidth than pure link state.
 Better for Larger Networks: More suitable for bigger networks.

Disadvanatges
 Complex Setup: Harder to configure and manage.
 Higher Resource Use: Requires more memory and CPU.
 Inconsistent Updates: Can sometimes lead to slower updates.

Virtual Circuit:
Virtual Circuit is the computer network providing connection-oriented
service. It is a connection-oriented network. In virtual circuit resource
are reserve for the time interval of data transmission between two
nodes. This network is a highly reliable medium of transfer. Virtual
circuits are costly to implement.

Working of Virtual Circuit:


 In the first step a medium is set up between the two end nodes.
 Resources are reserved for the transmission of packets.
 Then a signal is sent to sender to tell the medium is set up and
transmission can be started.
 It ensures the transmission of all packets.
 A global header is used in the first packet of the connection.
 Whenever data is to be transmitted a new connection is set up.

Congestion Control in Virtual Circuit:


Once the congestion is detected in virtual circuit network, closed-loop
techniques is used. There are different approaches in this technique:
 No new connection –
No new connections are established when the congestion is detected.
This approach is used in telephone networks where no new calls are
established when the exchange is overloaded.
 Participation of congested router invalid –
Another approach to control congestion is allow all new connections
but route these new connections in such a way that congested router
is not part of this route.
 Negotiation –
To negotiate different parameters between sender and receiver of the
network, when the connection is established. During the set up time,
host specifies the shape and volume of the traffic, quality of service
and other parameters.

Advantages of Virtual Circuit:


1. Packets are delivered to the receiver in the same order sent by the
sender.
2. Virtual circuit is a reliable network circuit.
3. There is no need for overhead in each packet.
4. Single global packet overhead is used in virtual circuit.

Disadvantages of Virtual Circuit:


1. Virtual circuit is costly to implement.
2. It provides only connection-oriented service.
3. Always a new connection set up is required for transmission.

Datagram Networks
 It is a connection-less service. There is no need for reservation of
resources as there is no dedicated path for a connection session.
 All packets are free to use any available path. As a result,
intermediate routers calculate routes on the go due to dynamically
changing routing tables on routers.
 Since every packet is free to choose any path, all packets must be
associated with a header with proper information about the source
and the upper layer data.
 The connection-less property makes data packets reach the
destination in any order, which means that they can potentially be
received out of order at the receiver’s end.
 Datagram networks are not as reliable as Virtual Circuits.
 The major drawback of Datagram Packet switching is that a packet
can only be forwarded if resources such as the buffer, CPU, and
bandwidth are available. Otherwise, the packet will be discarded.
 But it is always easy and cost-efficient to implement datagram
networks as there is no extra headache of reserving resources and
making a dedicated each time an application has to communicate.
 It is generally used by the IP network, which is used for Data services
like the Internet.

Benefits of Datagram Networks


 The flexibility of datagram networks is one of its main benefits.
 They are better at managing network congestion. Datagram networks
are able to adjust to variations in network traffic and identify several
paths for packets to take in order to reach their intended destination
because every packet is handled separately.
 In big and complicated networks in particular, this can lead to
decreased latency and increased network performance.
 In addition, datagram networks scale more easily than other kinds of
networks. Datagram networks are the ideal option for contemporary
communication systems, such as the Internet of Things (IoT) and
real-time data streaming applications, due to their scalability.
Drawbacks of Datagram Networks
 The lack of assured delivery in datagram networks is one of their
primary disadvantages. There is no assurance that all packets will
arrive at their destination or in the right order because they are sent
separately.
 Datagram networks also have the drawback of being vulnerable to
security breaches. Datagram networks are particularly susceptible to
network assaults including spoofing, eavesdropping, and denial of
service (DoS) attacks since they don’t create a dedicated connection
between the sender and the recipient.
 Moreover, datagram networks may not always support guarantees of
quality of service (QoS). While certain applications may benefit from
QoS capabilities provided by some protocols, like the Real-time
Transport Protocol (RTP), datagram networks as a whole do not
provide a centralised method for allocating priorities and controlling
network traffic.

Routing Algorithms
The main function of NL (Network Layer) is routing packets from
the source machine to the destination machine.
There are two processes inside router:
a) One of them handles each packet as it arrives, looking up the
outgoing line to use for it in the routing table. This process is
forwarding.
b) The other process is responsible for filling in and updating the
routing tables. That is where the routing algorithm comes
into play. This process is routing.

Regardless of whether routes are chosen independently for each


packet or only when new connections are established, certain
properties are desirable in a routing algorithm correctness,
simplicity, robustness, stability, fairness, optimality
Routing algorithms can be grouped into two major classes:
1) Non-adaptive (Static Routing)
2) adaptive. (Dynamic Routing)

Non-adaptive algorithm: They 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 algorithm: Adaptive algorithms in contrast, change


their routing decisions to reflect changes in the topology, and
usually the traffic as well.
Adaptive algorithms differ in:
1) Where they get their information (e.g., locally, from adjacent
routers, or from all routers),
2) When they change the routes (e.g., every ∆T sec, when the load
changes or when the
topology changes), and
3) What metric is used for optimization (e.g., distance, number
of hops, or estimated transit time).
This procedure is called dynamic routing

Different Routing Algorithms:


• Optimality principle
• Shortest path algorithm
• Flooding
• Distance vector routing
• Link state routing
• Hierarchical Routing
The Optimality Principle
One can make a general statement about optimal routes without
regard to network topology or traffic. This statement is known
as the optimality principle.
It states that if router J is on the optimal path from router I to
router K, then the optimal path from J to K also falls along the
same
As a direct consequence of the optimality principle, we can see
that the set of optimal routes from all sources to a given
destination form a tree rooted at the destination. Such a tree is
called a sink tree. The goal of all routing algorithms is to
discover and use the sink trees for all routers

(a) A network. (b) A sink tree for


router B.
Shortest Path Routing (Dijkstra’s)
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 or link.
To choose a route between a given pair of routers, the algorithm
just finds the shortest path between them on the graph
1. Start with the local node (router) as the root of the tree.
Assign a cost of 0 to this node and make it the first permanent
node.
2. Examine each neighbor of the node that was the last permanent
node.
3. Assign a cumulative cost to each node and make it tentative
4. Among the list of tentative nodes
a. Find the node with the smallest cost and make it Permanent
b. If a node can be reached from more than one route
then select the route with the shortest cumulative cost.
5. Repeat steps 2 to 4 until every node becomes permanent
Flooding:
• Another static algorithm is flooding, in which every incoming
packet is sent out on every outgoing line except the one it
arrived on.
• Flooding obviously generates vast numbers of duplicate
packets, in fact, an infinite number 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.
• A variation of flooding that is slightly more practical is
selective flooding. In this algorithm 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.

Intra- and Inter Domain Routing


An autonomous system (AS) is a group of networks and routers under
the authority of a single administration.
Routing inside an autonomous system is referred to as intra
domain routing. (DISTANCE VECTOR, LINK STATE)
Routing between autonomous systems is referred to as inter
domain routing. (PATH VECTOR) Each autonomous system can
choose one or more intra domain routing protocols to handle
routing inside the autonomous system. However, only one
inter domain routing protocol handles routing between
autonomous systems.
Distance Vector Routing

In distance vector routing, the least-cost route between any two


nodes is the route with minimum distance. In this protocol, as
the name implies, each node maintains a vector (table) of
minimum distances to every node.
Mainly 3 things in this
 Initialization
 Sharing
 Updating

Initialization
Each node can know only the distance between itself and its
immediate neighbours, those directly connected to it. So for the
moment, we assume that each node can send a message to the
immediate neighbours and find the distance between itself and
these neighbours. Below fig shows the initial tables for each
node. The distance for any entry that is not a neighbour is
marked as infinite (unreachable).
Initialization of tables in distance vector routing
Sharing
The whole idea of distance vector routing is the sharing of
information between neighbours. Although node A does not
know about node E, node C does. So if node C shares its routing
table with A, node A can also know how to reach node E. On the
other hand, node C does not know how to reach node D, but
node A does. If node A shares its routing table with node C, node
C also knows how to reach node D. In other words, nodes A and
C, as immediate neighbors, can improve their routing tables if
they help each other.
NOTE: In distance vector routing, each node shares its routing
table with its immediate neighbors periodically and when there
is a change

Updating
When a node receives a two-column table from a neighbour, it
needs to update its routing table. Updating takes three steps:
1. The receiving node needs to add the cost between itself and
the sending node to each value in the second column. (x+y)
2. If the receiving node uses information from any row. The
sending node is the next node in the route.
3. The receiving node needs to compare each row of its old table
with the corresponding row of the modified version of the
received table.
a. If the next-node entry is different, the receiving node
chooses the row with the smaller cost. If there is a tie, the
old one is kept.
b. If the next-node entry is the same, the receiving node chooses
the new row.

Updating in distance vector routing

Final Diagram
Link State Routing
Link state routing is based on the assumption that, although the
global knowledge about the topology is not clear, each node has
partial knowledge: it knows the state (type, condition, and cost) of
its links. In other words, the whole topology can be
compiled from the partial knowledge of each node

Building Routing Tables


1. Creation of the states of the links by each node, called the link state
packet (LSP).
2. Dissemination of LSPs to every other router, called flooding, in an
efficient and reliable way.
3. Formation of a shortest path tree for each node.
4. Calculation of a routing table based on the shortest path tree

I. Creation of Link State Packet (LSP) A link state packet


can carry a large amount of information. For the moment, we
assume that it carries a minimum amount of data: the node
identity, the list of links, a sequence number, and age. The
first two, node identity and the list of links, are needed to
make the topology. The third, sequence number, facilitates
flooding and distinguishes new LSPs from old ones. The
fourth, age, prevents old LSPs from remaining in the domain
for a long time.
LSPs are generated on two occasions:
1. When there is a change in the topology of the domain
2. on a periodic basis: The period in this case is much longer
compared to distance vector. The timer set for periodic
dissemination is normally in the range of 60 min or 2 h
based on the implementation. A longer period ensures that
flooding does not create too much traffic on the network.

II. Flooding of LSPs: After a node has prepared an LSP, it


must be disseminated to all other nodes, not only to its
neighbors. The process is called flooding and based on the
following
1. The creating node sends a copy of the LSP out of each
interface
2. A node that receives an LSP compares it with the copy it
may already have. If the newly arrived LSP is older than
the one it has (found by checking the sequence number), it
discards the LSP. If it is newer, the node does the
following:
a. It discards the old LSP and keeps the new one.
b. It sends a copy of it out of each interface except the one
from which the packet arrived. This guarantees that
flooding stops somewhere in the domain (where a node
has only one interface).

III. Formation of Shortest Path Tree: (Dijkstra Algorithm)


A shortest path tree is a tree in which the path between the root
and every other node is the shortest.
The Dijkstra algorithm creates a shortest path tree from a graph.
The algorithm divides the nodes into two sets: tentative and
permanent. It finds the neighbors of a current node, makes
them tentative, examines them, and if they pass the criteria,
makes them permanent.
IV. Calculation of a routing table
routing table for node A

Path Vector Routing


Distance vector and link state routing are both intra domain
routing protocols. They can be used inside an autonomous
system, but not between autonomous systems. These two
protocols are not suitable for inter domain routing mostly
because of scalability. Both of these routing protocols become
intractable when the domain of operation becomes large.
Distance vector routing is subject to instability in the
domain of operation. Link state routing needs a
huge amount of resources to calculate routing tables. It also
creates heavy traffic because of flooding. There is a need for a
third routing protocol which we call path vector routing.

Path vector routing proved to be useful for inter domain routing.


The principle of path vector routing is similar to that of distance
vector routing. In path vector routing, we assume that
there is one node (there can be more, but one is enough for
our conceptual discussion) in each AS that acts on behalf of
the entire AS. Let us call it the speaker node. The speaker
node in an AS creates a routing table and advertises it to speaker
nodes in the neighboring ASs. The idea is the same as for
distance vector routing except that only speaker nodes in each
AS can communicate with each other. However, what is
advertised is different. A speaker node advertises the path, not
the metric of the nodes, in its autonomous system or other
autonomous systems

Initialization
Initial routing tables in path vector routing

Hierarchical Routing
As networks grow in size, the router routing tables grow
proportionally. Not only is router memory consumed by ever-
increasing tables, but more CPU time is needed to scan them
and more bandwidth is needed to send status reports about
them.
At a certain point, the network may grow to the point where it is
no longer feasible for every router to have an entry for every
other router, so the routing will have to be done hierarchically,
as it is in the telephone network.
When hierarchical routing is used, the routers are divided into
what we will call regions. Each router knows all the details about
how to route packets to destinations within its own region but
knows nothing about the internal structure of other regions.
For huge networks, a two-level hierarchy may be insufficient; it
may be necessary to group the regions into clusters, the clusters
into zones, the zones into groups, and so on, until we run out of
names for aggregations

CONGESTION CONTROL ALGORITHMS


Too many packets present in (a part of) the network causes
packet delay and loss that degrades performance. This situation
is called congestion.
The network and transport layers share the responsibility for
handling congestion. Since congestion occurs within the
network, it is the network layer that directly experiences it and
must ultimately determine what to do with the excess packets.
However, the most effective way to control congestion is to
reduce the load that the transport layer is placing on the
network. This requires the network and transport layers to work
together. In this chapter we will look at the network aspects of
congestion.
When too much traffic is offered, congestion sets in and performance
degrades sharply

Above Figure depicts the onset of congestion. When the number


of packets hosts send into the network is well within its carrying
capacity, the number delivered is proportional to the number
sent. If twice as many are sent, twice as many are delivered.
However, as the offered load approaches the carrying capacity,
bursts of traffic occasionally fill up the buffers inside routers and
some packets are lost. These lost packets consume some of the
capacity, so the number of delivered packets falls below the ideal
curve. The network is now congested. Unless the network is well
designed, it may experience a congestion collapse
Difference between congestion control and flow
control.
Congestion control has to do with making sure the network is
able to carry the offered traffic. It is a global issue, involving the
behaviour of all the hosts and routers.
Flow control, in contrast, relates to the traffic between a
particular sender and a particular receiver. Its job is to make
sure that a fast sender cannot continually transmit data faster
than the receiver is able to absorb it.
To see the difference between these two concepts, consider a
network made up of 100-Gbps fiber optic links on which a
supercomputer is trying to force feed a large file to a personal
computer that is capable of handling only 1 Gbps. Although
there is no congestion (the network itself is not in trouble), flow
control is needed to force the supercomputer to stop frequently
to give the personal computer a chance to breathe.
At the other extreme, consider a network with 1-Mbps lines and
1000 large computers, half of which are trying to transfer files at
100 kbps to the other half. Here, the problem is not that of fast
senders overpowering slow receivers, but that the total offered
traffic exceeds what the network can handle.

The reason congestion control and flow control are often


confused is that the best way to handle both problems is to get
the host to slow down. Thus, a host can get a ‘‘slow down’’
message either because the receiver cannot handle the load or
because the network cannot handle it.

Several techniques can be employed. These include:


1. Warning bit
2. Choke packets
3. Load shedding
4. Random early discard
5. Traffic shaping
The first 3 deal with congestion detection and recovery. The last 2
deal with congestion avoidance

Warning Bit
1. A special bit in the packet header is set by the router to warn
the source when congestion is detected.
2. The bit is copied and piggy-backed on the ACK and sent to the
sender.
3. The sender monitors the number of ACK packets it receives
with the warning bit set and adjusts its transmission rate
accordingly.

Choke Packets
1. A more direct way of telling the source to slow down.
2. A choke packet is a control packet generated at a
congested node and transmitted to restrict traffic flow.
3. The source, on receiving the choke packet must reduce its
transmission rate by a certain percentage.
4. An example of a choke packet is the
ICMP Source Quench Packet. Hop-by-
Hop Choke Packets
1. Over long distances or at high speeds choke packets are not very
effective.
2. A more efficient method is to send to choke packets hop-by-hop.
3. This requires each hop to reduce its transmission even
before the choke packet arrive at the source

Load Shedding
1. When buffers become full, routers simply discard packets.
2. Which packet is chosen to be the victim depends on the
application and on the error strategy used in the data
link layer.
3. For a file transfer, for, e.g. cannot discard older packets
since this will cause a gap in the received data.
4. For real-time voice or video it is probably better to throw
away old data and keep new packets.
5. Get the application to mark packets with discard priority.
Random Early Discard (RED)
1. This is a proactive approach in which the router discards one
or more packets before the buffer becomes completely full.
2. Each time a packet arrives, the RED algorithm computes the
average queue length, avg.
3. If avg is lower than some lower threshold, congestion is
assumed to be minimal or non- existent and the packet is
queued.
4. If avg is greater than some upper threshold, congestion is
assumed to be serious and the packet is discarded.
5. If avg is between the two thresholds, this might indicate
the onset of congestion. The probability of congestion is then
calculated.

Traffic Shaping
1. Another method of congestion control is to “shape” the traffic
before it enters the
network.
2. Traffic shaping controls the rate at which packets are sent
(not just how many). Used in ATM and Integrated Services
networks.
3. At connection set-up time, the sender and carrier negotiate a traffic
pattern (shape).

Two traffic shaping algorithms are:


 Leaky Bucket
 Token Bucket

The Leaky Bucket Algorithm used to control rate in a


network. It is implemented as a single- server queue with
constant service time. If the bucket (buffer) overflows then
packets are discarded.
(a) A leaky bucket with water. (b) a leaky bucket with packets.

1. The leaky bucket enforces a constant output rate (average


rate) regardless of the burstiness of the input. Does nothing
when input is idle.
2. The host injects one packet per clock tick onto the network.
This results in a uniform flow of packets, smoothing out
bursts and reducing congestion.
3. When packets are the same size (as in ATM cells), the one
packet per tick is okay. For variable length packets though, it
is better to allow a fixed number of bytes per tick. E.g. 1024
bytes per tick will allow one 1024-byte packet or two 512-byte
packets or four 256- byte packets on 1 tick

Token Bucket Algorithm

1. In contrast to the LB, the Token Bucket Algorithm,


allows the output rate to vary, depending on the size
of the burst.
2. In the TB algorithm, the bucket holds tokens. To transmit a
packet, the host must capture and destroy one token.
3. Tokens are generated by a clock at the rate of one token every t
sec.
4. Idle hosts can capture and save up tokens (up to the max.
size of the bucket) in order to send larger bursts later.

(a) Before. (b) After.

You might also like