0% found this document useful (0 votes)
18 views43 pages

Unit 4 Switching - Routinmanid

The document discusses different network switching techniques including circuit switching, message switching, and packet switching. Circuit switching establishes a dedicated path but is inefficient. Message switching stores and forwards entire messages but can experience delays. Packet switching divides messages into packets that travel independently but can be reassembled.

Uploaded by

Majid Malik
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)
18 views43 pages

Unit 4 Switching - Routinmanid

The document discusses different network switching techniques including circuit switching, message switching, and packet switching. Circuit switching establishes a dedicated path but is inefficient. Message switching stores and forwards entire messages but can experience delays. Packet switching divides messages into packets that travel independently but can be reassembled.

Uploaded by

Majid Malik
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/ 43

BSc CS Entire T.Y.

Networking

Unit 2 Switching & routing concepts


Routing and switching are the basic functions of network
communication. Routing and Switching are different functions of
network communications.

The function of Switching is to switch data packets between devices


on the same network (or same LAN - Local Area Network). The
function of Routing is to Route packets between different networks
(between different LANs - Local Area Networks).

Switches operate at Layer 2 of the OSI Model (Datalink Layer). A


switch knows where to send a data packet by using Layer 2
addresses (MAC address - hardware address of a network adapter).
A switch maintains a table of MAC addresses (MAC Address table or
CAM Table) and what physical switch port they are connected to.
The Switching function can be explained more simply that,
Switching is the function of moving data packets (Ethernet Frames)
within the same LAN (Local Area Network).

In switching, data packets are sent between the devices on the


same network; for instance, data packets remain in the same LAN
(Local Area Network). Inside a single unit of the network, say a LAN,
various devices are connected to each other simultaneously with
the help of a switching device.

Mrs.V.O.Salunkhe Page 1
BSc CS Entire T.Y. Networking

Switches operate at Layer 2 of the OSI (Open System


Interconnection) Model. A switching device knows where to send the
data packets on the same network. This is done by using MAC
addresses, or the hardware address of a network adapter. A table of
MAC addresses is maintained by a switch.
There are three types of switching techniques, namely: Circuit
Switching, Packet switching, and Message switching.

Switching techniques

In large networks, there can be multiple paths from sender to


receiver. The switching technique will decide the best route for data
transmission.

Switching technique is used to connect the systems for making one-


to-one communication.

Classification Of Switching Techniques

Circuit Switching

Mrs.V.O.Salunkhe Page 2
BSc CS Entire T.Y. Networking

o Circuit switching is a switching technique that establishes a


dedicated path between sender and receiver.
o In the Circuit Switching Technique, once the connection is
established then the dedicated path will remain to exist until
the connection is terminated.
o Circuit switching in a network operates in a similar way as the
telephone works.
o A complete end-to-end path must exist before the
communication takes place.
o In case of circuit switching technique, when any user wants to
send the data, voice, video, a request signal is sent to the
receiver then the receiver sends back the acknowledgment to
ensure the availability of the dedicated path. After receiving
the acknowledgment, dedicated path transfers the data.
o Circuit switching is used in public telephone network. It is
used for voice transmission.
o Fixed data can be transferred at a time in circuit switching
technology.

Communication through circuit switching has 3 phases:

o Circuit establishment
o Data transfer
o Circuit Disconnect

Mrs.V.O.Salunkhe Page 3
BSc CS Entire T.Y. Networking

Circuit Switching can use either of the two technologies:

Space Division Switches:

o Space Division Switching is a circuit switching technology in


which a single transmission path is accomplished in a switch
by using a physically separate set of crosspoints.
o Space Division Switching can be achieved by using crossbar
switch. A crossbar switch is a metallic crosspoint or
semiconductor gate that can be enabled or disabled by a
control unit.
o The Crossbar switch is made by using the semiconductor. For
example, Xilinx crossbar switch using FPGAs.
o Space Division Switching has high speed, high capacity, and
nonblocking switches.

Space Division Switches can be categorized in two ways:

o Crossbar Switch
o Multistage Switch

Crossbar Switch

The Crossbar switch is a switch that has n input lines and n output
lines. The crossbar switch has n2 intersection points known
as crosspoints.

Disadvantage of Crossbar switch:

The number of crosspoints increases as the number of stations is


increased. Therefore, it becomes very expensive for a large switch.
The solution to this is to use a multistage switch.

Mrs.V.O.Salunkhe Page 4
BSc CS Entire T.Y. Networking

Multistage Switch

o Multistage Switch is made by splitting the crossbar switch into


the smaller units and then interconnecting them.
o It reduces the number of crosspoints.
o If one path fails, then there will be an availability of another
path.

Advantages Of Circuit Switching:

o In the case of Circuit Switching technique, the communication


channel is dedicated.
o It has fixed bandwidth.

Disadvantages Of Circuit Switching:

o Once the dedicated path is established, the only delay occurs


in the speed of data transmission.
o It takes a long time to establish a connection approx 10
seconds during which no data can be transmitted.
o It is more expensive than other switching techniques as a
dedicated path is required for each connection.
o It is inefficient to use because once the path is established and
no data is transferred, then the capacity of the path is wasted.
o In this case, the connection is dedicated therefore no other
data can be transferred even if the channel is free.

Message Switching

o Message Switching is a switching technique in which a


message is transferred as a complete unit and routed through
intermediate nodes at which it is stored and forwarded.

Mrs.V.O.Salunkhe Page 5
BSc CS Entire T.Y. Networking

o In Message Switching technique, there is no establishment of


a dedicated path between the sender and receiver.
o The destination address is appended to the message. Message
Switching provides a dynamic routing as the message is
routed through the intermediate nodes based on the
information available in the message.
o Message switches are programmed in such a way so that they
can provide the most efficient routes.
o Each and every node stores the entire message and then
forward it to the next node. This type of network is known
as store and forward network.
o Message switching treats each message as an independent
entity.

Advantages Of Message Switching

o Data channels are shared among the communicating devices


that improve the efficiency of using available bandwidth.
o Traffic congestion can be reduced because the message is
temporarily stored in the nodes.
o Message priority can be used to manage the network.
o The size of the message which is sent over the network can be
varied. Therefore, it supports the data of unlimited size.

Disadvantages Of Message Switching


Mrs.V.O.Salunkhe Page 6
BSc CS Entire T.Y. Networking

o The message switches must be equipped with sufficient


storage to enable them to store the messages until the
message is forwarded.
o The Long delay can occur due to the storing and forwarding
facility provided by the message switching technique.

Packet Switching

o The packet switching is a switching technique in which the


message is sent in one go, but it is divided into smaller pieces,
and they are sent individually.
o The message splits into smaller pieces known as packets and
packets are given a unique number to identify their order at
the receiving end.
o Every packet contains some information in its headers such as
source address, destination address and sequence number.
o Packets will travel across the network, taking the shortest
path as possible.
o All the packets are reassembled at the receiving end in correct
order.
o If any packet is missing or corrupted, then the message will be
sent to resend the message.
o If the correct order of the packets is reached, then the
acknowledgment message will be sent.

Mrs.V.O.Salunkhe Page 7
BSc CS Entire T.Y. Networking

Approaches Of Packet Switching:

There are two approaches to Packet Switching:

Datagram Packet switching:

o It is a packet switching technology in which packet is known


as a datagram, is considered as an independent entity. Each
packet contains the information about the destination and
switch uses this information to forward the packet to the
correct destination.
o The packets are reassembled at the receiving end in correct
order.
o In Datagram Packet Switching technique, the path is not fixed.
o Intermediate nodes take the routing decisions to forward the
packets.
o Datagram Packet Switching is also known as connectionless
switching.

Mrs.V.O.Salunkhe Page 8
BSc CS Entire T.Y. Networking

Virtual Circuit Switching

o Virtual Circuit Switching is also known as connection-oriented


switching.
o In the case of Virtual circuit switching, a preplanned route is
established before the messages are sent.
o Call request and call accept packets are used to establish the
connection between sender and receiver.
o In this case, the path is fixed for the duration of a logical
connection.

Let's understand the concept of virtual circuit switching


through a diagram:

o In the above diagram, A and B are the sender and receiver


respectively. 1 and 2 are the nodes.
o Call request and call accept packets are used to establish a
connection between the sender and receiver.
o When a route is established, data will be transferred.
o After transmission of data, an acknowledgment signal is sent
by the receiver that the message has been received.
Mrs.V.O.Salunkhe Page 9
BSc CS Entire T.Y. Networking

o If the user wants to terminate the connection, a clear signal is


sent for the termination.

Differences b/w Datagram approach and Virtual Circuit approach

Datagram approach Virtual Circuit approach

Node takes routing decisions to Node does not take any routing
forward the packets. decision.

Congestion cannot occur as all Congestion can occur when the node
the packets travel in different is busy, and it does not allow other
directions. packets to pass through.

It is more flexible as all the It is not very flexible.


packets are treated as an
independent entity.

Advantages Of Packet Switching:

o Cost-effective: In packet switching technique, switching


devices do not require massive secondary storage to store the
packets, so cost is minimized to some extent. Therefore, we
can say that the packet switching technique is a cost-effective
technique.
o Reliable: If any node is busy, then the packets can be
rerouted. This ensures that the Packet Switching technique
provides reliable communication.
o Efficient: Packet Switching is an efficient technique. It does
not require any established path prior to the transmission,
and many users can use the same communication channel
simultaneously, hence makes use of available bandwidth very
efficiently.

Mrs.V.O.Salunkhe Page 10
BSc CS Entire T.Y. Networking

Disadvantages Of Packet Switching:

o Packet Switching technique cannot be implemented in those


applications that require low delay and high-quality services.
o The protocols used in a packet switching technique are very
complex and requires high implementation cost.
o If the network is overloaded or corrupted, then it requires
retransmission of lost packets. It can also lead to the loss of
critical information if errors are nor recovered.

Circuit Switching
o In this approach, there is a dedicated route between sender
and receiver. Before the link is determined in the circuit
switching approach, the dedicated route will continue until the
connection is eliminated.

Routers

Routers operate at Layer 3 of the OSI Model (Network layer). A


Router knows where to send a packet by using Network part of the
destination IP address. A Router maintains a table called Routing
Table and uses the routing table to determine the route to the
destination network.

Routing is the process of connecting various networks


simultaneously. Routing, therefore, happens in the network layer.
Routing process involves setting a path for data packets to move in
a network or across multiple networks.

Mrs.V.O.Salunkhe Page 11
BSc CS Entire T.Y. Networking

Routers operate at Layer 3 of the OSI Model or the network layer. A


Router does this by sending a data packet by using Network part of
the destination IP (Internet Protocol) address. A routing device
maintains a table called Routing Table. This table is used to
determine the route to the destination network.
If there are multiple conductors, the electricity would go through
the conductor having the path of least resistance. Similarly, a
router tries to send data packets, possibly through the shortest
path in the connection of various networks.

Difference Between Routing and Switching

Router Switch

1. Various devices on the same


1. Various networks are connected
network are connected with the help
simultaneously by the router. This
of a switch.
is its main objective.

2. It works in the network layer. 2. It works in the data link layer.

Mrs.V.O.Salunkhe Page 12
BSc CS Entire T.Y. Networking

3. Used by LAN, MAN


3. Used by LAN only.
(Metropolitan Area Network) and
WAN ( Wide Area Network)

4. Data is send as packets over by 4. Data is sent in the form of discrete


a Router. packets, or in frames.

5. Chances of the collision of data 5. In the case of full-duplex


packets are there, though it is switching, chances of the collision of
minimized. data packets are zero.

6. The types of routing are


6. Types of switching are Circuit,
Adaptive and Non-Adaptive
Packet, and Message.
routing.

7. It provides security measures to


7. It provides port security.
protect the network.

8. Bandwidth sharing is dynamic 8. There is no sharing of bandwidth.

9. It can take relatively more time for


9. It takes faster routing decisions.
complex routing decisions.

10. It uses IP addresses. 10. It uses MAC addresses.

11. Transmission type: At initial 11. Transmission type: first


level Broadcast. Then unicast and Broadcast; then unicast and
multi-cast. multicast as needed.
Characteristics of Routers

1. Routers are multi-port devices with high – speed backbones


2. Routers also support filtering and encapsulation like bridges
3. Like bridges routers are also self-learning, as they can
communicate their existence. to other devices and can learn of
the existence of new routers, nodes and LAN segments
4. As explained earlier, they route traffic by considering the
network as a whole. It shows that they use a high level of
Mrs.V.O.Salunkhe Page 13
BSc CS Entire T.Y. Networking

intelligence to accomplish this task. This characteristic makes


them superior than hubs and bridges because they simply view
the network on a link-by-link basis
5. The packet handled by router may include destination address,
packet priority level, least-cost route, minimum route delay,
minimum route distance, and route congestion level
6. Routers constantly monitor the condition of the network, as a
whole to dynamically adapt to changes in the condition of the
network
7. They typically provide some level of redundancy so that they
are less susceptible to catastrophic failure.

Routing Algorithms

o In order to transfer the packets from source to the destination,


the network layer must determine the best route through
which packets can be transmitted.
o Whether the network layer provides datagram service or
virtual circuit service, the main job of the network layer is to
provide the best route. The routing protocol provides this job.
o The routing protocol is a routing algorithm that provides the
best path from the source to the destination. The best path is
the path that has the "least-cost path" from source to the
destination.
o Routing is the process of forwarding the packets from source
to the destination but the best route to send the packets is
determined by the routing algorithm.

Classification of a Routing algorithm

The Routing algorithm is divided into two categories:

o Adaptive Routing algorithm


o Non-adaptive Routing algorithm

Mrs.V.O.Salunkhe Page 14
BSc CS Entire T.Y. Networking

Adaptive Routing algorithm

o An adaptive routing algorithm is also known as dynamic


routing algorithm.
o This algorithm makes the routing decisions based on the
topology and network traffic.
o The main parameters related to this algorithm are hop count,
distance and estimated transit time.

An adaptive routing algorithm can


can be classified into three
parts:

o Centralized algorithm: It is also known as global routing


algorithm as it computes the least-cost
least cost path between source
and destination by using complete and global knowledge about
the network. This algorithm takes the connectivity
connectivity between the
nodes and link cost as input, and this information is obtained
before actually performing any calculation. Link state
algorithm is referred to as a centralized algorithm since it is
aware of the cost of each link in the network.

Mrs.V.O.Salunkhe Page 15
BSc CS Entire T.Y. Networking

o Isolation algorithm: It is an algorithm that obtains the


routing information by using local information rather than
gathering information from other nodes.
o Distributed algorithm: It is also known as decentralized
algorithm as it computes the least-cost path between source
and destination in an iterative and distributed manner. In the
decentralized algorithm, no node has the knowledge about the
cost of all the network links. In the beginning, a node contains
the information only about its own directly attached links and
through an iterative process of calculation computes the least-
cost path to the destination. A Distance vector algorithm is a
decentralized algorithm as it never knows the complete path
from source to the destination, instead it knows the direction
through which the packet is to be forwarded along with the
least cost path.

Non-Adaptive Routing algorithm

o Non Adaptive routing algorithm is also known as a static


routing algorithm.
o When booting up the network, the routing information stores
to the routers.
o Non Adaptive routing algorithms do not take the routing
decision based on the network topology or network traffic.

The Non-Adaptive Routing algorithm is of two types:

Flooding: In case of flooding, every incoming packet is sent to all


the outgoing links except the one from it has been reached. The
disadvantage of flooding is that node may contain several copies of
a particular packet.

Mrs.V.O.Salunkhe Page 16
BSc CS Entire T.Y. Networking

Random walks: In case of random walks, a packet sent by the node


to one of its neighbors randomly. An advantage of using random
walks is that it uses the alternative routes very efficiently.

Differences b/w Adaptive and Non-Adaptive Routing Algorithm

Basis Of Adaptive Routing Non-Adaptive Routing


Comparison algorithm algorithm

Define Adaptive Routing The Non-Adaptive Routing


algorithm is an algorithm algorithm is an algorithm
that constructs the that constructs the static
routing table based on table to determine which
the network conditions. node to send the packet.

Usage Adaptive routing The Non-Adaptive Routing


algorithm is used by algorithm is used by static
dynamic routing. routing.

Routing Routing decisions are Routing decisions are the


decision made based on topology static tables.
and network traffic.

Categorization The types of adaptive The types of Non Adaptive


routing algorithm, are routing algorithm are flooding
Centralized, isolation and and random walks.
distributed algorithm.

Complexity Adaptive Routing Non-Adaptive Routing


algorithms are more algorithms are simple.
complex.

Mrs.V.O.Salunkhe Page 17
BSc CS Entire T.Y. Networking

Distance Vector Routing Algorithm

o The Distance vector algorithm is iterative, asynchronous


and distributed.
o Distributed: It is distributed in that each node receives
information from one or more of its directly attached
neighbors, performs calculation and then distributes the
result back to its neighbors.
o Iterative: It is iterative in that its process continues until
no more information is available to be exchanged
between neighbors.
o Asynchronous: It does not require that all of its nodes
operate in the lock step with each other.
o The Distance vector algorithm is a dynamic algorithm.
o It is mainly used in ARPANET, and RIP.
o Each router maintains a distance table known as Vector.

Three Keys to understand the working of Distance Vector Routing


Algorithm:

o Knowledge about the whole network: Each router shares its


knowledge through the entire network. The Router sends its
collected knowledge about the network to its neighbors.
o Routing only to neighbors: The router sends its knowledge
about the network to only those routers which have direct
links. The router sends whatever it has about the network
through the ports. The information is received by the router
and uses the information to update its own routing table.
o Information sharing at regular intervals: Within 30 seconds,
the router sends the information to the neighboring routers.

Distance Vector Routing Algorithm

Let dx(y) be the cost of the least-cost path from node x to node y.
The least costs are related by Bellman-Ford equation,

Mrs.V.O.Salunkhe Page 18
BSc CS Entire T.Y. Networking

dx(y) = minv{c(x,v) + dv(y)}

Where the minv is the equation taken for all x neighbors. After
traveling from x to v, if we consider the least-cost path from v to y,
the path cost will be c(x,v)+dv(y). The least cost from x to y is the
minimum of c(x,v)+dv(y) taken over all neighbors.

With the Distance Vector Routing algorithm, the node x


contains the following routing information:

o For each neighbor v, the cost c(x,v) is the path cost from x to
directly attached neighbor, v.
o The distance vector x, i.e., Dx = [ Dx(y) : y in N ], containing its
cost to all destinations, y, in N.
o The distance vector of each of its neighbors, i.e., Dv = [ Dv(y) : y
in N ] for each neighbor v of x.

Distance vector routing is an asynchronous algorithm in which


node x sends the copy of its distance vector to all its neighbors.
When node x receives the new distance vector from one of its
neighboring vector, v, it saves the distance vector of v and uses the
Bellman-Ford equation to update its own distance vector. The
equation is given below:

dx(y) = minv{ c(x,v) + dv(y)} for each node y in N

The node x has updated its own distance vector table by using the
above equation and sends its updated table to all its neighbors so
that they can update their own distance vectors.

Algorithm

At each node x,

Initialization

for all destinations y in N:


Dx(y) = c(x,y) // If y is not a neighbor then c(x,y) = ∞

Mrs.V.O.Salunkhe Page 19
BSc CS Entire T.Y. Networking

for each neighbor w


Dw(y) = ? for all destination y in N.
for each neighbor w
send distance vector Dx = [ Dx(y) : y in N ] to w
loop
wait(until
(until I receive any distance vector from some neighbor w)
for each y in N:
Dx(y) = minv{c(x,v)+Dv(y)}
If Dx(y) is changed for any destination y
Send distance vector Dx = [ Dx(y) : y in N ] to all neighbors
forever

Let's understand through an example:

Sharing Information

o In the above figure, each cloud represents the network, and


the number inside the cloud represents the network ID.
o All the LANs are connected by routers, and they are
represented in boxes labeled as A, B, C, D, E, F.
o Distance vector routing algorithm simplifies tthe routing
process by assuming the cost of every link is one unit.

Mrs.V.O.Salunkhe Page 20
BSc CS Entire T.Y. Networking

Therefore, the efficiency of transmission can be measured by


the number of links to reach the destination.
o In Distance vector routing, the cost is based on hop count.

In the above figure, we observe that the router sends the knowledge
to the immediate neighbors. The neighbors add this knowledge to
their own knowledge and sends the updated table to their own
neighbors. In this way, routers get its own information plus the new
information about
out the neighbors.

Routing Table

Two process occurs:

o Creating the Table


o Updating the Table

Mrs.V.O.Salunkhe Page 21
BSc CS Entire T.Y. Networking

Creating the Table

Initially, the routing table is created for each router that contains
atleast three types of information such as Network ID, the cost and
the next hop.

o NET ID: The Network ID defines the final destination of the


packet.
o Cost: The cost is the number of hops that packet must take to
get there.
o Next hop: It is the router to which the packet must be
delivered.

o In the above figure, the original routing tables are shown of all
the routers. In a routing table, the first column represents the
Mrs.V.O.Salunkhe Page 22
BSc CS Entire T.Y. Networking

network ID, the second column represents the cost of the link,
and the third column is empty.
o These routing tables are sent to
t all the neighbors.

For Example:

1. A sends its routing table to B, F & E.


2. B sends its routing table to A & C.
3. C sends its routing table to B & D.
4. D sends its routing table to E & C.
5. E sends its routing table to A & D.
6. F sends its routing table to A.

Updating the Table

o When A receives a routing table from B, then it uses its


information to update the table.
o The routing table of B shows how the packets can move to the
networks 1 and 4.
o The B is a neighbor to the A router, the packets from A to B
can reach in one hop. So, 1 is added to all the costs given in
the B's table and the sum will be the cost to reach a particular
network.

o After adjustment, A then combines this table with its own


table to create a combined table.

Mrs.V.O.Salunkhe Page 23
BSc CS Entire T.Y. Networking

o The combined table may contain some duplicate data. In the


above figure, the combined table of router A contains the
duplicate data, so it keeps only those data which has the
lowest cost. For example, A can send the data to network 1 in
two ways. The first, which uses no next router,
router, so it costs one
hop. The second requires two hops (A to B, then B to Network
1). The first option has the lowest cost, therefore it is kept and
the second one is dropped.

o The process of creating the routing table continues for all


routers. Every router
router receives the information from the
neighbors, and update the routing table.

Final routing tables of all the routers are given below:

Mrs.V.O.Salunkhe Page 24
BSc CS Entire T.Y. Networking

Link State Routing

Link state routing is a technique in which each router shares the


knowledge of its neighborhood with every other router in the
internetwork.

The three keys to understand the Link State Routing


algorithm:

o Knowledge about the neighborhood: Instead of sending its


routing table, a router sends the information about its
neighborhood only. A router broadcast
broadcast its identities and cost
of the directly attached links to other routers.
o Flooding: Each router sends the information to every other
router on the internetwork except its neighbors. This process
is known as Flooding. Every router that receives the packet
Mrs.V.O.Salunkhe Page 25
BSc CS Entire T.Y. Networking

sends the copies to all its neighbors. Finally, each and every
router receives a copy of the same information.
o Information sharing: A router sends the information to every
other router only when the change occurs in the information.

Link State Routing has two phases:

Reliable Flooding

o Initial state: Each node knows the cost of its neighbors.


o Final state: Each node knows the entire graph.

Route Calculation

Each node uses Dijkstra's algorithm on the graph to calculate the


optimal routes to all nodes.

o The Link state routing algorithm is also known as Dijkstra's


algorithm which is used to find the shortest path from one
node to every other node in the network.
o The Dijkstra's algorithm is an iterative, and it has the property
that after kth iteration of the algorithm, the least cost paths are
well known for k destination nodes.

Let's describe some notations:

o c( i , j): Link cost from node i to node j. If i and j nodes are not
directly linked, then c(i , j) = ∞.
o D(v): It defines the cost of the path from source code to
destination v that has the least cost currently.
o P(v): It defines the previous node (neighbor of v) along with
current least cost path from source to v.
o N: It is the total number of nodes available in the network.

Algorithm

Initialization

Mrs.V.O.Salunkhe Page 26
BSc CS Entire T.Y. Networking

N = {A} // A is a root node.


node
for all nodes v
if v adjacent to A
then D(v) = c(A,v)
else D(v) = infinity
loop
find w not in N such that D(w) is a minimum.
Add w to N
Update D(v) for all v adjacent to w and not in N:
D(v) = min(D(v) , D(w) + c(w,v))
Until all nodes in N

In the above algorithm, an initialization step is followed by the loop.


The number of times the loop is executed is equal to the total
number of nodes available in the network.

Let's understand through an example:

In the above figure,


figure source vertex is A.

Step 1:

Mrs.V.O.Salunkhe Page 27
BSc CS Entire T.Y. Networking

The first step is an initialization step. The currently known least


cost path from A to its directly attached neighbors, B, C, D are 2,5,1
respectively. The cost from A to B is set to 2, from A to D is set to 1
and from A to C is set to 5. The cost from A to E and F are set to
infinity as they are not directly linked to A.

Step N D(B),P(B) D(C),P(C) D(D),P(D) D(E),P(E) D(F),P(F)

1 A 2,A 5,A 1,A ∞ ∞

Step 2:

In the above table, we observe that vertex D contains the least cost
path in step 1. Therefore, it is added in N. Now, we need to
determine a least-cost path through D vertex.

a) Calculating shortest path from A to B

1. v = B, w = D
2. D(B) = min( D(B) , D(D) + c(D,B) )
3. = min( 2, 1+2)>
4. = min( 2, 3)
5. The minimum value is 2. Therefore, the currently shortest path fro
m A to B is 2.

b) Calculating shortest path from A to C

1. v = C, w = D
2. D(B) = min( D(C) , D(D) + c(D,C) )
3. = min( 5, 1+3)
4. = min( 5, 4)
5. The minimum value is 4. Therefore, the currently shortest path fro
m A to C is 4.</p>

c) Calculating shortest path from A to E

Mrs.V.O.Salunkhe Page 28
BSc CS Entire T.Y. Networking

1. v = E, w = D
2. D(B) = min( D(E) , D(D) + c(D,E) )
3. = min( ∞, 1+1)
4. = min(∞, 2)
5. The minimum value is 2. Therefore, the currently shortest path fro
m A to E is 2.
Step N D(B),P(B) D(C),P(C) D(D),P(D) D(E),P(E) D(F),P(F)

1 A 2,A 5,A 1,A ∞ ∞

2 AD 2,A 4,D 2,D ∞

6. Step 3:
7. In the above table, we observe that both E and B have the
least cost path in step 2. Let's consider the E vertex. Now, we
determine the least cost path of remaining vertices through E.

a) Calculating the shortest path from A to B.

1. v = B, w = E
2. D(B) = min( D(B) , D(E) + c(E,B) )
3. = min( 2 , 2+ ∞ )
4. = min( 2, ∞)
5. The minimum value is 2. Therefore, the currently shortest path fro
m A to B is 2.

b) Calculating the shortest path from A to C.

1. v = C, w = E
2. D(B) = min( D(C) , D(E) + c(E,C) )
3. = min( 4 , 2+1 )
4. = min( 4,3)
5. The minimum value is 3. Therefore, the currently shortest path fro
m A to C is 3.

c) Calculating the shortest path from A to F.


Mrs.V.O.Salunkhe Page 29
BSc CS Entire T.Y. Networking

1. v = F, w = E
2. D(B) = min( D(F) , D(E) + c(E,F) )
3. = min( ∞ , 2+2 )
4. = min(∞ ,4)
5. The minimum value is 4. Therefore, the currently shortest path fro
m A to F is 4.
Step N D(B),P(B) D(C),P(C) D(D),P(D) D(E),P(E) D(F),P(F)

1 A 2,A 5,A 1,A ∞ ∞


2 AD 2,A 4,D 2,D ∞

3 ADE 2,A 3,E 4,E

Step 4:

In the above table, we observe that B vertex has the least cost path
in step 3. Therefore, it is added in N. Now, we determine the least
cost path of remaining vertices through B.

a) Calculating the shortest path from A to C.

1. v = F, w = C
2. D(B) = min( D(F) , D(C) + c(C,F) )
3. = min( 4, 3+5)
4. = min(4,8)
5. The minimum value is 4. Therefore, the currently shortest path fro
m A to F is 4.
Step N D(B),P(B) D(C),P(C) D(D),P(D) D(E),P(E) D(F),P(F)

1 A 2,A 5,A 1,A ∞ ∞

2 AD 2,A 4,D 2,D ∞

3 ADE 2,A 3,E 4,E

Mrs.V.O.Salunkhe Page 30
BSc CS Entire T.Y. Networking

4 ADEB 3,E 4,E

5 ADEBC 4,E

Final table:

Step N D(B),P(B) D(C),P(C) D(D),P(D) D(E),P(E) D(F),P(F)

1 A 2,A 5,A 1,A ∞ ∞

2 AD 2,A 4,D 2,D ∞

3 ADE 2,A 3,E 4,E

4 ADEB 3,E 4,E

5 ADEBC 4,E

6 ADEBCF

Disadvantage:

Heavy traffic is created in Line state routing due to Flooding.


Flooding can cause an infinite looping, this problem can be solved
by using Time-to-leave field

Hierarchical routing
In hierarchical routing, the routers are divided into regions. Each
router has complete details about how to route packets to
destinations within its own region. But it does not have any idea
about the internal structure of other regions.
As we know, in both LS and DV algorithms, every router needs to
save some information about other routers. When network size is
growing, the number of routers in the network will increase.
Therefore, the size of routing table increases, then routers cannot

Mrs.V.O.Salunkhe Page 31
BSc CS Entire T.Y. Networking

handle network traffic as efficiently. To overcome this problem we


are using hierarchical routing.
In hierarchical routing, routers are classified in groups called
regions. Each router has information about the routers in its own
region and it has no information about routers in other regions. So,
routers save one record in their table for every other region.
For huge networks, a two-level hierarchy may be insufficient hence,
it may be necessary to group the regions into clusters, the clusters
into zones, the zones into groups and so on.
When a device has multiple paths to reach a destination, it always
selects one path by preferring it over others. This selection process
is termed as Routing. Routing is done by special network devices
called routers or it can be done by means of software processes.The
software based routers have limited functionality and limited
scope.
A router is always configured with some default route. A default
route tells the router where to forward a packet if there is no route
found for specific destination. In case there are multiple path
existing to reach the same destination, router can make decision
based on the following information:
 Hop Count
 Bandwidth
 Metric
 Prefix-length
 Delay
Routes can be statically configured or dynamically learnt. One
route can be configured to be preferred over others.

Unicast routing

Most of the traffic on the internet and intranets known as unicast


data or unicast traffic is sent with specified destination. Routing
unicast data over the internet is called unicast routing. It is the

Mrs.V.O.Salunkhe Page 32
BSc CS Entire T.Y. Networking

simplest form of routing because the destination is already known.


Hence the router just has to look up the routing table and forward
the packet to next hop.

Broadcast routing

By default, the broadcast packets are not routed and forwarded by


the routers on any network. Routers create broadcast domains.
But it can be configured to forward broadcasts in some special
cases. A broadcast message is destined to all network devices.
Broadcast routing can be done in two ways (algorithm):
 A router creates a data packet and then sends it to each host
one by one. In this case, the router creates multiple copies of
single data packet with different destination addresses. All
packets are sent as unicast but because they are sent to all, it
simulates as if router is broadcasting.
This method consumes lots of bandwidth and router must
destination address of each node.
 Secondly, when router receives a packet that is to be
broadcasted, it simply floods those packets out of all
interfaces. All routers are configured in the same way.

Mrs.V.O.Salunkhe Page 33
BSc CS Entire T.Y. Networking

This method is easy on router's CPU but may cause the


problem of duplicate packets received from peer routers.
Reverse path forwarding is a technique, in which router
knows in advance about its predecessor from where it should
receive broadcast. This technique is used to detect and
discard duplicates.

Multicast Routing

Multicast routing is special case of broadcast routing with


significance difference and challenges. In broadcast routing,
packets are sent to all nodes even if they do not want it. But in
Multicast routing, the data is sent to only nodes which wants to
receive the packets.

Mrs.V.O.Salunkhe Page 34
BSc CS Entire T.Y. Networking

The router must know that there are nodes, which wish to receive
multicast packets (or stream) then only it should forward.
Multicast routing works spanning tree protocol to avoid looping.
Multicast routing also uses reverse path Forwarding technique, to
detect and discard duplicates and loops.

Anycast Routing

Anycast packet forwarding is a mechanism where multiple hosts


can have same logical address. When a packet destined to this
logical address is received, it is sent to the host which is nearest in
routing topology.

Mrs.V.O.Salunkhe Page 35
BSc CS Entire T.Y. Networking

Anycast routing is done with help of DNS server. Whenever an


Anycast packet is received it is enquired with DNS to where to send
it. DNS provides the IP address which is the nearest IP configured
on it.

Unicast Routing Protocols

There are two kinds of routing protocols available to route unicast


packets:

 Distance Vector Routing Protocol

Distance Vector is simple routing protocol which takes


routing decision on the number of hops between source and
destination. A route with less number of hops is considered
as the best route. Every router advertises its set best routes to
other routers. Ultimately, all routers build up their network
topology based on the advertisements of their peer routers,
For example Routing Information Protocol (RIP).

 Link State Routing Protocol

Link State protocol is slightly complicated protocol than


Distance Vector. It takes into account the states of links of all
Mrs.V.O.Salunkhe Page 36
BSc CS Entire T.Y. Networking

the routers in a network. This technique helps routes build a


common graph of the entire network. All routers then
calculate their best path for routing purposes.for example,
Open Shortest Path First (OSPF) and Intermediate System to
Intermediate System (ISIS).

Multicast Routing Protocols

Unicast routing protocols use graphs while Multicast routing


protocols use trees, i.e. spanning tree to avoid loops. The optimal
tree is called shortest path spanning tree.
 DVMRP - Distance Vector Multicast Routing Protocol
 MOSPF - Multicast Open Shortest Path First
 CBT - Core Based Tree
 PIM - Protocol independent Multicast
Protocol Independent Multicast is commonly used now. It has two
flavors:
 PIM Dense Mode
This mode uses source-based trees. It is used in dense
environment such as LAN.
 PIM Sparse Mode
This mode uses shared trees. It is used in sparse environment
such as WAN.

Routing Algorithms

The routing algorithms are as follows:

Flooding

Flooding is simplest method packet forwarding. When a packet is


received, the routers send it to all the interfaces except the one on
which it was received. This creates too much burden on the
network and lots of duplicate packets wandering in the network.

Mrs.V.O.Salunkhe Page 37
BSc CS Entire T.Y. Networking

Time to Live (TTL) can be used to avoid infinite looping of packets.


There exists another approach for flooding, which is called
Selective Flooding to reduce the overhead on the network. In this
method, the router does not flood out on all the interfaces, but
selective ones.

Shortest Path

Routing decision in networks, are mostly taken on the basis of cost


between source and destination. Hop count plays major role here.
Shortest path is a technique which uses various algorithms to
decide a path with minimum number of hops.
Common shortest path algorithms are:
 Dijkstra's algorithm
 Bellman Ford algorithm
 Floyd Warshall algorithm
Congestion Control techniques in Computer Networks
Congestion control refers to the techniques used to control or
prevent congestion. Congestion control techniques can be broadly
classified into two categories:

Mrs.V.O.Salunkhe Page 38
BSc CS Entire T.Y. Networking

Open Loop Congestion Control


Open loop congestion control policies are applied to prevent
congestion before it happens. The congestion control is handled
either by the source or the destination.
Policies adopted by open loop congestion control –

1. Retransmission Policy :
It is the policy in which retransmission of the packets are taken
care of. If the sender feels that a sent packet is lost or corrupted,
the packet needs to be retransmitted. This transmission may
increase the congestion in the network.
To prevent congestion, retransmission timers must be designed
to prevent congestion and also able to optimize efficiency.

2. Window Policy :
The type of window at the sender’s side may also affect the
congestion. Several packets in the Go-back-n window are re-sent,
although some packets may be received successfully at the
receiver side. This duplication may increase the congestion in the
network and make it worse.
Therefore, Selective repeat window should be adopted as it sends
the specific packet that may have been lost.

3. Discarding Policy :
A good discarding policy adopted by the routers is that the
routers may prevent congestion and at the same time partially
discard the corrupted or less sensitive packages and also be able
to maintain the quality of a message.
In case of audio file transmission, routers can discard less
sensitive packets to prevent congestion and also maintain the
quality of the audio file.

4. Acknowledgment Policy :
Since acknowledgements are also the part of the load in the
network, the acknowledgment policy imposed by the receiver may
also affect congestion. Several approaches can be used to prevent
congestion related to acknowledgment.
Mrs.V.O.Salunkhe Page 39
BSc CS Entire T.Y. Networking

The receiver should send acknowledgement for N packets rather


than sending acknowledgement for a single packet. The receiver
should send an acknowledgment only if it has to send a packet
or a timer expires.

5. Admission Policy :
In admission policy a mechanism should be used to prevent
congestion. Switches in a flow should first check the resource
requirement of a network flow before transmitting it further. If
there is a chance of a congestion or there is a congestion in the
network, router should deny establishing a virtual network
connection to prevent further congestion.
All the above policies are adopted to prevent congestion before it
happens in the network.

Closed Loop Congestion Control


Closed loop congestion control techniques are used to treat or
alleviate congestion after it happens. Several techniques are used
by different protocols; some of them are:

1. Backpressure :
Backpressure is a technique in which a congested node stops
receiving packets from upstream node. This may cause the
upstream node or nodes to become congested and reject
receiving data from above nodes. Backpressure is a node-to-node
congestion control technique that propagate in the opposite
direction of data flow. The backpressure technique can be
applied only to virtual circuit where each node has information of
its above upstream node.

Mrs.V.O.Salunkhe Page 40
BSc CS Entire T.Y. Networking

1. In above diagram the 3rd node is congested and stops receiving


packets as a result 2nd node may be get congested due to
slowing down of the output data flow. Similarly 1st node may get
congested and inform the source to slow down.

2. Choke Packet Technique :


Choke packet technique is applicable to both virtual networks as
well as datagram subnets. A choke packet is a packet sent by a
node to the source to inform it of congestion. Each router
monitors its resources and the utilization at each of its output
lines. Whenever the resource utilization exceeds the threshold
value which is set by the administrator, the router directly sends
a choke packet to the source giving it a feedback to reduce the
traffic. The intermediate nodes through which the packets has
traveled are not warned about congestion.

1. Implicit Signaling :
In implicit signaling, there is no communication between the
congested nodes and the source. The source guesses that there
is congestion in a network. For example when sender sends

Mrs.V.O.Salunkhe Page 41
BSc CS Entire T.Y. Networking

several packets and there is no acknowledgment for a while, one


assumption is that there is a congestion.

2. Explicit Signaling :
In explicit signaling, if a node experiences congestion it can
explicitly sends a packet to the source or destination to inform
about congestion. The difference between choke packet and
explicit signaling is that the signal is included in the packets that
carry data rather than creating a different packet as in case of
choke packet technique.
Explicit signaling can occur in either forward or backward
direction.
 Forward Signaling : In forward signaling, a signal is sent in
the direction of the congestion. The destination is warned
about congestion. The receiver in this case adopt policies to
prevent further congestion.
 Backward Signaling : In backward signaling, a signal is sent
in the opposite direction of the congestion. The source is
warned about congestion and it needs to slow down.

Mrs.V.O.Salunkhe Page 42
BSc CS Entire T.Y. Networking

Mrs.V.O.Salunkhe Page 43

You might also like