0% found this document useful (0 votes)
38 views

Switching and Routing: Samson A School of Electrical & Computer Engineering, Hawassa Institute of Technology

This document discusses different switching and routing techniques used in computer networks. It describes circuit switching, message switching, packet switching including datagram and virtual circuit approaches, and cell switching. Packet switching is now widely used, where messages are broken into standardized blocks called packets that contain source and destination addresses and are routed independently through the network.

Uploaded by

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

Switching and Routing: Samson A School of Electrical & Computer Engineering, Hawassa Institute of Technology

This document discusses different switching and routing techniques used in computer networks. It describes circuit switching, message switching, packet switching including datagram and virtual circuit approaches, and cell switching. Packet switching is now widely used, where messages are broken into standardized blocks called packets that contain source and destination addresses and are routed independently through the network.

Uploaded by

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

Switching and Routing

Samson A
[email protected]
School of Electrical & Computer Engineering,
Hawassa Institute of Technology
Switching

• Introduction
• Switching Techniques
• Circuit Switching
• Message Switching
• Packet Switching
• Cell Switching
• Routing Techniques
Least Cost Algorithms
• Dijkstra algorithm and
• Bellman-Ford algorithm

07/16/21 Switching & Routing 2


Introduction

• A network is an interconnection of multiple devices.


• Whenever we have multiple devices, we have the problem of how to
connect them to make one-to-one communication possible.
• One solution is to make a point-to-point connection between each
pair of devices (a mesh topology) or between a central device and
every other device (a star topology).
• These methods, however, are impractical and wasteful when
applied to very large networks.
• The number and length of the links require too much infrastructure
to be cost-efficient, and the majority of those links would be idle
most of the time.
• A better solution is Switching

07/16/21 Switching & Routing 3


Intro Cont’d…

• A switched network consists of a series of interlinked nodes, called


switches.
• Switches are devices capable of creating temporary connections
between two or more devices linked to the switch.
• In a switched network, some of these nodes are connected to the
end systems (computers or telephones, for example). Others are
used only for switching.
• The end systems
(communicating devices) are
labeled A, B, C, D, and so
on, and the switches are
labeled I, II, III, IV, and V.
• Each switch is connected to
multiple links.
07/16/21 Switching & Routing 4
Intro Cont’d…

• Switching is used to connect networks to form an


internetwork (a network of networks).
• Long distance communication is impossible with out
switching.
• An Internet is a switched network in which a switch
connects at least two links together.
• A switch needs to forward data from a network to
another network when required.

07/16/21 Switching & Routing 5


Switching Techniques

• There are four main switching techniques


available for digital traffic:
1. Circuit Switching
2. Message Switching
3. Packet Switching
4. Cell Switching

07/16/21 Switching & Routing 6


Circuit Switching

• Circuit switching is a technique that directly connects the


sender and the receiver in an unbroken path.
• Telephone switching equipment, for example,
establishes a path that connects the caller's telephone to
the receiver’s telephone by making a physical
connection.
• With this type of switching technique, once a connection
is established, a dedicated path exists between both
ends until the connection is terminated.
• Routing decisions must be made when the circuit is first
established, but there are no decisions made after that
time.
07/16/21 Switching & Routing 7
Cont’d…

07/16/21 Switching & Routing 8


Merits & Demerits of Circuit Switching
Advantages:
• The communication channel (once established) is
dedicated.
Disadvantages:
• Possible long wait to establish a connection during
which no data can be transmitted.
• More expensive than any other switching
techniques, because a dedicated path is required for
each connection.
• Inefficient use of the communication channel,
because the channel is not used when the
connected systems are not using it.

07/16/21 Switching & Routing 9


Message Switching

• With message switching, there is no need to establish a dedicated


path between two stations.
• When a station sends a message, the destination address is
appended to the message.
• The message is then transmitted through the network, in its entirety,
from node to node.
• Each node receives the entire message, stores it in its entirety on
disk, and then transmits the message to the next node.
• This type of network is called a store-and-forward network.

07/16/21 Switching & Routing 10


Cont’d…

• A message-switching node is typically a general-


purpose computer.
• The device needs sufficient secondary-storage
capacity to store the incoming messages, which
could be long.

07/16/21 Switching & Routing 11


Advantages

• Channel efficiency can be greater compared to circuit switched


systems, because more devices are sharing the channel.
• Traffic congestion can be reduced, because messages may be
temporarily stored in route.
• Message priorities can be established due to store-and forward
technique.
• Message broadcasting can be achieved with the use of broadcast
address appended in the message
Disadvantages
• Message switching is not compatible with interactive
applications.
• Store-and-forward devices are expensive, because they must
have large disks to hold potentially long messages
07/16/21 Switching & Routing 12
Packet Switching
• Packet switching can be seen as a solution that tries
to combine the advantages of message and circuit
switching and to minimize the disadvantages of
both.

• There are two methods of packet switching:


– Datagram and
– Virtual Circuit
07/16/21 Switching & Routing 13
Cont’d…
• In both packet switching methods, a message is broken
into small parts, called packets.
• Each packet is tagged with appropriate source and
destination addresses.
• Since packets have a strictly defined maximum length,
they can be stored in main memory instead of disk,
therefore access delay and cost are minimized.

07/16/21 Switching & Routing 14


Cont’d…

• Also the transmission speeds, between nodes are


optimized.
• With current technology, packets are generally
accepted onto the network on a first-come, first-
served basis.
• If the network becomes overloaded, packets are
delayed or discarded.

07/16/21 Switching & Routing 15


Datagram Packet Switching
• Datagram packet switching is similar to message
switching in that each packet is a self-contained unit
with complete addressing information attached.

07/16/21 Switching & Routing 16


• As shown in the above figure, packets take a variety of
possible paths through the network.
• So the packets, each with the same destination address, do not
follow the same route, and they may arrive out of sequence at
the exit point node (or the destination).
• Reordering is done at the destination point based on the
sequence number of the packets.
• It is possible for a packet to be destroyed if one of the
nodes on its way is crashed momentarily. Thus all its
queued packets may be lost.

07/16/21 Switching & Routing 17


Virtual Circuit Packet Switching

• In VC approach: before all datagrams in a message can be sent, a


virtual connection should be set up to define the path for the
datagrams.

• After connection setup, the datagrams can all follow the same path

07/16/21 Switching & Routing 18


Cont’d…

• In addition to source and destination addresses, packets also


contain flow label (virtual circuit identifier used to define the virtual
path) used to route packets
• In virtual circuit, the route between stations does not mean that this
is a dedicated path, as in circuit switching.
• A packet is still buffered at each node and queued for output over a
line.
• The difference between virtual circuit and datagram approaches:
• With virtual circuit, the node does not need to make a routing decision
for each packet.
• It is made only once for all packets using that virtual circuit.
• In datagram, each packet needs a routing decision.

07/16/21 Switching & Routing 19


Advantages

• Packet switching is cost effective, because switching devices do not


need massive amount of secondary storage.
• Packet switching offers improved delay characteristics, because
there are no long messages in the queue (maximum packet size is
fixed).
• Packet can be rerouted if there is any problem, such as, busy or
disabled links.
• Many network users can share the same channel at the same time.
• Maximize link efficiency by making optimal use of link bandwidth.

07/16/21 Switching & Routing 20


Disadvantages

• Protocols for packet switching are typically more


complex.
• It can add some initial costs in implementation.
• If packet is lost, sender needs to retransmit the data.
• Packet-switched systems still can’t deliver the same
quality as dedicated circuits in applications requiring very
little delay - like voice conversations or moving images.

07/16/21 Switching & Routing 21


Cell Switching

• Cell switching is a form of packet switching.


• The main difference between a packet-switched network and a cell-
switched network is the size of the cell.
• Cells are extremely small and do not vary in size.
• Their size makes them fast and provides for a network with a low
latency.
• An example of a cell-switched network is Asynchronous Transfer
Mode (ATM) with a cell length of 53 bytes including the data portion.

07/16/21 Switching & Routing 22


Cont’d…

• Because a cell does not vary in size, each router in the


cell switched network knows how much data to expect
with each cell and is built to take advantage of it.
• The tiny cell is small enough to be stored in random
access memory.
• Because the router need only switch the cell in and out of
its fastest memory, there is little latency in a cell-switched
network.
Summary

07/16/21 Switching & Routing 23


Routing

• Graph Theory
• Routing Protocols
• Interior Gateway Routing Protocol
• Distance Vector Routing Protocol
• Link State Routing Protocl
• Routing Algorithm
• Least Cost Algorithm
• Dijkstra
• Bellman Ford
• Exterior Gateway Routing Protocol

07/16/21 Switching & Routing 24


Graph Theory

• A graph or a network is a way to specify relationships


amongst a collection of items.
• A graph consists of
• Set of objects called: nodes
• Pairs of objects connected by: edges

• Two nodes are neighbors if they are connected by an


edge
• A weighted graph, every edge has an associated value
called a weight.

07/16/21 Switching & Routing 25


Graph orientation

• Undirected graph: a graph with Edges have no orientation


• Directed Graph: a graph with Edges have an orientation

07/16/21 Switching & Routing 26


Graph representations in real-world

Examples
•Communication networks
• Companies, telephone wires
•Social networks
• People, friendship/contacts
•Information networks
• Web sites, hyperlinks
•Biological networks
• Species, predation (food web). Or metabolic
pathways
07/16/21 Switching & Routing 27
Routing Algorithms

• Routing: is the process of selecting paths in a network along which


to send network traffic.
• In unicast routing, a packet is routed, hop by hop, from its source to
its destination.
• But, there are several routes that a packet can travel from the
source to the destination.
• Therefore, what must be determined is which route the packet
should take.
• To find the best route, an internet can be modeled as a graph.
• To model an internet as a graph, we can think of each router as a
node and each network between a pair of routers as an edge.

07/16/21 Switching & Routing 28


• When an internet is modeled as a weighted graph, one of the ways
to interpret the best route from the source router to the destination
router is to find the least cost between the two.
• This means that each router needs to find the least-cost route
between itself and all the other routers to be able to route a packet
using this criteria.
• Routing algorithms differ in the way they interpret the least cost and
the way they create the least-cost tree for each node.

07/16/21 Switching & Routing 29


Routing Protocols
• The routers in an internet are responsible for receiving and
forwarding packets through the interconnected set of networks.
• Each router makes routing decision based on knowledge of the
topology and traffic/delay conditions of the internet.
• In a simple internet, a fixed routing scheme is possible.
• In more complex internets, a degree of dynamic cooperation
is needed among the routers.
• In particular,
• The router must avoid portions of the network that have failed
and,
• The routers should avoid portions of the network that are
congested.
• To make such dynamic routing decisions, routers exchange routing
information using a special routing protocol.

07/16/21 Switching & Routing 30


Routing protocols…
Routing protocols can be categorized as:
I.Interior Gateway Routing Protocol: includes the two
common least cost routing protocols:
1. Distance vector routing protocol
the heart of these routing is Bellman-Ford
algorithms
2. Link state routing protocol
the heart of these routing is Dijkstra algorithms
II.Exterior Gateway Routing Protocol: includes
1.Path Vector: which is used when the priority is not
least cost. i.e, if we focus on other issues rather
than least cost; (like security issues) we use these
routing protocols.

07/16/21 Switching & Routing 31


Distance Vector routing protocol
• Routes are advertised as vectors of distance
and direction.
• Distance is defined in terms of a metric
• Such as hop count
• Direction is simply the:
• Next hop router or
• Exit interface
• These routing protocols
• Do not know the topology of an internetwork.
• Only knows the routing information received
from its neighbors.
• Distance Vector routing protocol does not have
the knowledge of the entire path to a destination
network
• That is, it does not have a topological map of the
network.
07/16/21 Switching & Routing 32
Link-State Routing Protocols

Distance Vector
Link-State
• Link-state routing protocols - road map
• Knows topological map used by each router
• Each router determines the shortest path to each
network

07/16/21 Switching & Routing 33


Link state routing process:-

• Each router learns about its own links, its own directly connected networks.
This is done by detecting that an interface is in the up state.
• Each router is responsible for meeting its neighbors on directly connected
networks. Link state routers do this by exchanging Hello packets with other
link-state routers on directly connected networks.
• Each router builds a Link-State Packet (LSP) containing the state of each
directly connected link. This is done by recording all the pertinent
information about each neighbor, including neighbor ID, link type, and
bandwidth.
• Each router floods the LSP to all neighbors, who then store all LSPs
received in a database. Neighbors then flood the LSPs to their neighbors
until all routers in the area have received the LSPs. Each router stores a
copy of each LSP received from its neighbors in a local database.
• Each router uses the database to construct a complete map of the topology
and computes the best path to each destination network. Like having a
road map, the router now has a complete map of all destinations in the
topology and the routes to reach them. The shortest path first (SPF)
algorithm is used to construct the map of the topology and to determine the
best path to each network. Switching & Routing
07/16/21 34
Least Cost Algorithms

• Are basis for routing decisions


• Defines cost of path between two nodes as sum of costs
of links traversed
• The most common least cost algorithms are:
• Dijkstra algorithm and
• Bellman-Ford algorithm

07/16/21 Switching & Routing 35


Dijkstra’s Algorithm

• Finds shortest paths from given source node to all other


nodes by developing paths in order of increasing path
length
• Each time adding node with next shortest path
• Algorithm terminates when all nodes processed by algorithm

07/16/21 Switching & Routing 36


for (y 1 to N) // N is the number of nodes
6{
7 if (y is the root)
8 D[y] 0 // D[y] is shortest distance from root to node y
9 else if (y is a neighbor)
10 D[y] c[root][y] // c[x][y] is cost between nodes x and y in LSDB
11 else
12 D[y] ∞
13 }
14 // Calculation
15 repeat
16 {
17 find a node w, with D[w] minimum among all nodes not in the Tree
18 Tree Tree ∪{w} // Add w to tree
19 // Update distances for all neighbors of w
20 for (every node x, which is a neighbor of w and not in the Tree)
21 {
22 D[x] min{D[x], (D[w] c[w][x])}
23 }
24 } until (all nodes included in the Tree)
25 } // End of Dijkstra

07/16/21 Switching & Routing 37


5
3 B
A
5
2

2 3 E
S 1

1 2
C D
1

07/16/21 Switching & Routing 38


. 3:C
5 2:S
A B
5
2
S 2 3 E 4:D
1
1 2
C D
1:S 1 2:C
S-C = 1
Source S A B C D E S-A = 2
Cost 0 2 3 1 2 4 S-C-D = 2
Predecessor - S D S C D S-C-D-B = 3
S-C-D-E = 4

07/16/21 Switching & Routing 39


Bellman-Ford Algorithm

• Use iteration method to find the least cost


path
• First: it finds the shortest paths from given node
subject to constraint that paths contain at most
one link
• Second: it finds the shortest paths with a
constraint of paths of at most two links
• and so on …

07/16/21 Switching & Routing 40


Distance_Vector_Routing ( )
2{
3 // Initialize (create initial vectors for the node)
4 D[myself ] 0

for (y 1 to N)
6{
7 if (y is a neighbor)
8 D[y] c[myself ][y]
9 else
10 D[y] ∞
11 }
12 send vector {D[1], D[2], …, D[N]} to all neighbors
13 // Update (improve the vector with the vector received from a
neighbor)
14 repeat (forever)
15 {
16 wait (for a vector D from a neighbor w or any change in the link)
w

17 for (y 1 to N)
18 {
19 D[y] min [D[y], (c[myself ][w] D [y ])] // Bellman-Ford equation
w

20 }
21 if (any change in the vector)
22 send vector {D[1], D[2], …, D[N]} to all neighbors
23 }
24 } // End of Distance Vector

07/16/21 Switching & Routing 41


5
. 3
A B
5
2

2 3 E
S 1

1 2
C D
1

Note:
• Works by repeatedly testing the vertices in the graph.
• The total number of iteration will be number of nodes minus
one.
• But the algorithm can converge before the final iteration.
07/16/21 Switching & Routing 42
. Source S A B C D E
Cost 0 2 5 1 ∞ ∞
Predecessor - S S S - -

Source S A B C D E
Cost 0 2 3 1 2 4
Predecessor - S D S C D

Source S A B C D E
Cost 0 2 3 1 2 4
Predecessor - S D S C D
07/16/21 Switching & Routing 43
5
3 B
. A
5
2

2 3 E
S 1

1 2
C D
1

07/16/21 Switching & Routing 44


Comparison
• Bellman-Ford
• calculation for node n needs link cost to neighbouring
nodes plus total cost to each neighbour from s
• each node can maintain set of costs and paths for
every other node
• can exchange information with direct neighbours
• can update costs and paths based on information
from neighbours and knowledge of total link cost from
the source.
• Dijkstra
• Each node needs complete topology
• must know link costs of all links in network
• must exchange information with all other nodes

07/16/21 Switching & Routing 45


Routing Protocol Characteristics
• Time to convergence:
• Faster the better.
• Scalability:
• How large network the routing protocol can handle.
• Resource usage:
• Routing protocol usage of RAM, CPU utilization, and
link bandwidth utilization.
• Implementation and maintenance:
• Level of knowledge that is required for a network
administrator.

07/16/21 Switching & Routing 46


Distance Vector vs Link State
No. Distance Vector Link State
1 Uses hop count as metric Uses shortest path
2 View the network from the perspective of Gets common view of entire network
neighbor topology
3 Has frequent and periodic updates Has event triggered updates
4 Slow convergence Faster convergence
5 Susceptible to routing loops. Not as susceptible to routing loops
6 Easy to configure and administer Difficult to configure and administer.
7 Requires less memory and processing Requires more processing power and
power of routers. memory than distance vector.
8 Consumes a lot of Bandwidth. Consumes less BW than distance
vector
9 Passes copies of routing table to neighbor Passes link-state routing updates to
routers. other routers
10 E.g. Routing Information Protocol (RIP) E.g. Open Shortest Path First (OSPF)
07/16/21 Switching & Routing 47

You might also like