Computer NetworksComputer Networks
An Engineering Design ApproachAn Engineering Design Approach
Packet SwitchingPacket Switching
Sabyasachi Upadhyay
BITS Pilani
1
Packet SwitchingPacket Switching
 Your phone is not directly connected to every
person you might want to call, but instead is
connected to an exchange that contains a switch.
 It is the switches that create the impression that
you have a connection to the person at the other
end of the call.
 Similarly, computer networks use packet
switches to enable packets to travel from one
host to another, even when no direct connection
exists between those hosts .
mahadev@bits-goa.ac.in
2
 A packet switch is a device with several inputs and
outputs leading to and from the hosts that the switch
interconnects.
 The core job of a switch is to take packets that arrive on
an input and forward (or switch) them to the right
output so that they will reach their appropriate
destination.
 There are a variety of ways that the switch can
determine the “right” output for a packet, which can be
broadly categorized as connectionless and
connection-oriented approaches.mahadev@bits-goa.ac.in
3
 A key problem that a switch must deal with is the
finite bandwidth of its outputs.
 If packets destined for a certain output arrive at a
switch and their arrival rate exceeds the capacity of
that output, then we have a problem of contention.
 The switch queues (buffers) packets until the
contention subsides, but if it lasts too long, the switch
will run out of buffer space and be forced to discard
packets.
 When packets are discarded too frequently, the
switch is said to be congested.
mahadev@bits-goa.ac.in
4
Switching and ForwardingSwitching and Forwarding
 A switch is a mechanism that allows us to interconnect
links to form a larger network.
 A switch is a multi-input, multi-output device, which
transfers packets from an input to one or more outputs.
 Switched networks are considered more scalable.
 A switch’s primary job is to receive incoming packets on
one of its links and to transmit them on some other link.
This function is sometimes referred to as either
switching or forwarding,
mahadev@bits-goa.ac.in
5
The question then is, How does the switch decideThe question then is, How does the switch decide
which output port to place each packet on?which output port to place each packet on?
• Soln: It looks at the header of the packet for
an identifier that it uses to make the decision .
• There are two common approaches to make
decision .
The first is the datagram or Packet Switching
connectionless approach.
The second is the virtual circuit or connection-
oriented approach. mahadev@bits-goa.ac.in
6
DatagramDatagram
Based on complete destination address within the packet.
Any valid destination must be forwarded correctly.
To decide how to forward a packet, a switch consults a
forwarding table (sometimes called a routing table).
mahadev@bits-goa.ac.in
7
Datagram ForwardingDatagram Forwarding ExampleExample
mahadev@bits-goa.ac.in
8
Switch #1
Dest Port
A 1
B 2
C 3
D 3
E 4
F 4
G 4
H 4
I 3
J 3
Switch #2
Dest Port
A 2
B 2
C 1
D 3
E 2
F 2
G 4
H 4
I 4
J 4
Switch #3
Dest Port
A 1
B 1
C 1
D 1
E 2
F 4
G 3
H 3
I 3
J 3
Switch #4
Dest Port
A 1
B 1
C 3
D 3
E 1
F 1
G 2
H 4
I 3
J 3
Switch #5
Dest Port
A 1
B 1
C 1
D 1
E 2
F 2
G 2
H 2
I 3
J 4
I
I I I
I
I
• Connectionless (datagram) networks have
the following characteristics:
A host can send a packet anywhere at any time,
since any packet that turns up at a switch can be
immediately forwarded. Which is contrasting with
most connection-oriented networks, in which some
“connection state” needs to be established before the
first data packet is sent.
When a host sends a packet, it has no way of knowing
if the network is capable of delivering it or if the
destination host is even up and running.
mahadev@bits-goa.ac.in
9
• Each packet is forwarded independently of
previous packets that might have been sent
to the same destination.
Thus, two successive packets from host A to host B
may follow completely different paths
• A switch or link failure might not have any
serious effect on communication if it is
possible to find an alternate route around
the failure and to update the forwarding
table accordingly.
mahadev@bits-goa.ac.in
10
Datagram approach
mahadev@bits-goa.ac.in
11
Virtual Circuit SwitchingVirtual Circuit Switching
 It differs significantly from the datagram model, uses the
concept of a virtual circuit (VC).
• Based only on a label with the packet header. Only
packets whose “virtual circuit” has been set up ahead
of time must be forwarded correctly.
mahadev@bits-goa.ac.in
12
Host A wants to send packets to host B.
The first stage is “connection setup.”
The second is “data transfer”.
Connection setup for a single connection
consists of an entry in a “VC table” in
each switch through which the
connection passes.
mahadev@bits-goa.ac.in
13
VCI phases
One entry in the VC table on a single switch
contains:
 a virtual circuit identifier (VCI) that uniquely identifies the
connection at this switch and that will be carried inside the
header of the packets that belong to this connection
 an incoming interface on which packets for this VC arrive
at the switch
 an outgoing interface in which packets for this VC leave
the switch
 a potentially different VCI that will be used for outgoing
packets
mahadev@bits-goa.ac.in
15
semantics of entry in VC tablesemantics of entry in VC table
 If a packet arrives on the designated incoming
interface and that packet contains the designated
VCI value in its header,
 Then that packet should be sent out the specified
outgoing interface with the specified outgoing VCI
value.
 Combination of the VCI of packets as they are
received at the switch and the interface on which they
are received uniquely identifies the virtual
connection
mahadev@bits-goa.ac.in
16
mahadev@bits-goa.ac.in
17
Packets path through a virtual circuitPackets path through a virtual circuit
network.network.
mahadev@bits-goa.ac.in
18
VC Forwarding Table ExampleVC Forwarding Table Example
mahadev@bits-goa.ac.in
19
Switch #2
In Port In Label Out Port Out Label
2 5 4 1
2 1 1 1
3 6 4 3
Switch #3
In Port In Label Out Port Out Label
1 1 3 3
2 1 3 1
Switch #5
In Port In Label Out Port Out Label
1 1 4 2
1 3 2 1
2 1 3 1
Switch #1
In Port In Label Out Port Out Label
1 2 3 5
2 1 3 1
1 1 4 1
Switch #4
In Port In Label Out Port Out Label
1 3 2 5
1 1 3 1
3 1 4 1
6
3
3
1
1
1
mahadev@bits-goa.ac.in
20
The switch creates an entry in its table for this virtual circuit,
but it is only able to fill three of the four columns.
The switch assigns the incoming port (1) and chooses an
available incoming VCI (14) and the outgoing port (3).
It does not yet know the outgoing VCI, which will be found
during the acknowledgment step .
mahadev@bits-goa.ac.in
21
A special frame, called the acknowledgment frame, complete the entries
in the switching tables .
The destination sends an ack to switch 3.along with VCI 77, chosen by the
destination as the incoming VCI for frames from A.
Switch 3 uses this VCI to complete the outgoing VCI column for this entry.
Switch 3 sends an ack to switch 2 that contains its incoming VCI in the
table. Switch 2 uses this as the outgoing VCI in the table..
Switch2 & switch 1 follows the same procedure.
There are two broad classes of approach to
establishing connection state.
One is to have a network administrator configure
the state, called “permanent virtual circuit”
A host can send messages into the network to
cause the state to be established. This is referred to
as signaling.
mahadev@bits-goa.ac.in
22
Signaling processSignaling process
 Host A sends a setup message into the network, that is,
to switch 1 , which contains Complete destination address
of host B.
 We assume that the switches know enough about the
network topology to figure out how to switch packets so
that the setup message flows on to switches 2 and 3 before
finally reaching host B.
 When switch 1 receives the connection request, in
addition to sending it on to switch 2, it creates a new
entry in its virtual circuit table for this new connection.mahadev@bits-goa.ac.in
23
 When packets arrive on port 2 with identifier 5,
send them out on port 1.
 When switch 2 receives the setup message, it
performs a similar process; picks the value 11 as
the incoming VCI value.
 switch 3 picks 7 as the value for its incoming
VCI
 Each switch can pick any number it likes, as long
as that number is not currently in use for some
other connection.
mahadev@bits-goa.ac.in
24
Cont…Cont…
Finally, the setup message arrives at host B.
B is willing to accept a connection from host A,
so it allocates a incoming VCI value 4.
This VCI value can be used by B to identify all packets coming
from host A.
mahadev@bits-goa.ac.in
25
 To complete the connection, every switch needs to be
informed what their downstream neighbors VCI.
 Host B sends an acknowledgment to switch 3 and
includes in that message the VCI that it chose 4.
 Switch 3 sends the acknowledgment on to switch 2,
specifying a VCI of 7.
 Switch 2 sends the message on to switch 1, specifying a
VCI of 11.
 Finally, switch 1 passes the acknowledgment on to host
A, telling it to use the VCI of 5 for this connection.
mahadev@bits-goa.ac.in
26
Tearing down the connectionTearing down the connection
When host A no longer wants to send data
to host B, it tears down the connection.
It sends a teardown message to switch
1.
The switch removes the relevant entry
from its table and forwards the message on
to the other switches in the path.
 Which similarly delete the appropriate table
entries
mahadev@bits-goa.ac.in
27
Source RoutingSource Routing
Switching that uses neither virtual circuits
nor conventional datagram.
All the information about network topology,
required to switch a packet across the network
is provided by the source host.
It assign a number to each output of each
switch and to place that number in the header
of the packet.
mahadev@bits-goa.ac.in
28
 For each packet that arrives on an input, the
switch would read the port in the header and
transmit the packet on that output.
 However, since there will be more than one
switch in the path, the header for the packet
needs to contain enough information to allow
every switch in the path to determine which
output the packet needs to be placed on.
 Solution is to put an ordered list of switch
ports in the header and to rotate the list so
that the next switch in the path is always at the
front of the list .
mahadev@bits-goa.ac.in
29
mahadev@bits-goa.ac.in
30
Source routing in a switched network
Disadvantage:Disadvantage:
Source routing suffers from a scaling
problem.
Reasonably large network, it is very hard
for a host to get the complete path
information it needs to construct
correct headers.
mahadev@bits-goa.ac.in
31

Packet switching

  • 1.
    Computer NetworksComputer Networks AnEngineering Design ApproachAn Engineering Design Approach Packet SwitchingPacket Switching Sabyasachi Upadhyay BITS Pilani 1
  • 2.
    Packet SwitchingPacket Switching Your phone is not directly connected to every person you might want to call, but instead is connected to an exchange that contains a switch.  It is the switches that create the impression that you have a connection to the person at the other end of the call.  Similarly, computer networks use packet switches to enable packets to travel from one host to another, even when no direct connection exists between those hosts . mahadev@bits-goa.ac.in 2
  • 3.
     A packetswitch is a device with several inputs and outputs leading to and from the hosts that the switch interconnects.  The core job of a switch is to take packets that arrive on an input and forward (or switch) them to the right output so that they will reach their appropriate destination.  There are a variety of ways that the switch can determine the “right” output for a packet, which can be broadly categorized as connectionless and connection-oriented approaches.mahadev@bits-goa.ac.in 3
  • 4.
     A keyproblem that a switch must deal with is the finite bandwidth of its outputs.  If packets destined for a certain output arrive at a switch and their arrival rate exceeds the capacity of that output, then we have a problem of contention.  The switch queues (buffers) packets until the contention subsides, but if it lasts too long, the switch will run out of buffer space and be forced to discard packets.  When packets are discarded too frequently, the switch is said to be congested. mahadev@bits-goa.ac.in 4
  • 5.
    Switching and ForwardingSwitchingand Forwarding  A switch is a mechanism that allows us to interconnect links to form a larger network.  A switch is a multi-input, multi-output device, which transfers packets from an input to one or more outputs.  Switched networks are considered more scalable.  A switch’s primary job is to receive incoming packets on one of its links and to transmit them on some other link. This function is sometimes referred to as either switching or forwarding, mahadev@bits-goa.ac.in 5
  • 6.
    The question thenis, How does the switch decideThe question then is, How does the switch decide which output port to place each packet on?which output port to place each packet on? • Soln: It looks at the header of the packet for an identifier that it uses to make the decision . • There are two common approaches to make decision . The first is the datagram or Packet Switching connectionless approach. The second is the virtual circuit or connection- oriented approach. mahadev@bits-goa.ac.in 6
  • 7.
    DatagramDatagram Based on completedestination address within the packet. Any valid destination must be forwarded correctly. To decide how to forward a packet, a switch consults a forwarding table (sometimes called a routing table). mahadev@bits-goa.ac.in 7
  • 8.
    Datagram ForwardingDatagram ForwardingExampleExample mahadev@bits-goa.ac.in 8 Switch #1 Dest Port A 1 B 2 C 3 D 3 E 4 F 4 G 4 H 4 I 3 J 3 Switch #2 Dest Port A 2 B 2 C 1 D 3 E 2 F 2 G 4 H 4 I 4 J 4 Switch #3 Dest Port A 1 B 1 C 1 D 1 E 2 F 4 G 3 H 3 I 3 J 3 Switch #4 Dest Port A 1 B 1 C 3 D 3 E 1 F 1 G 2 H 4 I 3 J 3 Switch #5 Dest Port A 1 B 1 C 1 D 1 E 2 F 2 G 2 H 2 I 3 J 4 I I I I I I
  • 9.
    • Connectionless (datagram)networks have the following characteristics: A host can send a packet anywhere at any time, since any packet that turns up at a switch can be immediately forwarded. Which is contrasting with most connection-oriented networks, in which some “connection state” needs to be established before the first data packet is sent. When a host sends a packet, it has no way of knowing if the network is capable of delivering it or if the destination host is even up and running. mahadev@bits-goa.ac.in 9
  • 10.
    • Each packetis forwarded independently of previous packets that might have been sent to the same destination. Thus, two successive packets from host A to host B may follow completely different paths • A switch or link failure might not have any serious effect on communication if it is possible to find an alternate route around the failure and to update the forwarding table accordingly. mahadev@bits-goa.ac.in 10
  • 11.
  • 12.
    Virtual Circuit SwitchingVirtualCircuit Switching  It differs significantly from the datagram model, uses the concept of a virtual circuit (VC). • Based only on a label with the packet header. Only packets whose “virtual circuit” has been set up ahead of time must be forwarded correctly. mahadev@bits-goa.ac.in 12
  • 13.
    Host A wantsto send packets to host B. The first stage is “connection setup.” The second is “data transfer”. Connection setup for a single connection consists of an entry in a “VC table” in each switch through which the connection passes. mahadev@bits-goa.ac.in 13
  • 14.
  • 15.
    One entry inthe VC table on a single switch contains:  a virtual circuit identifier (VCI) that uniquely identifies the connection at this switch and that will be carried inside the header of the packets that belong to this connection  an incoming interface on which packets for this VC arrive at the switch  an outgoing interface in which packets for this VC leave the switch  a potentially different VCI that will be used for outgoing packets mahadev@bits-goa.ac.in 15
  • 16.
    semantics of entryin VC tablesemantics of entry in VC table  If a packet arrives on the designated incoming interface and that packet contains the designated VCI value in its header,  Then that packet should be sent out the specified outgoing interface with the specified outgoing VCI value.  Combination of the VCI of packets as they are received at the switch and the interface on which they are received uniquely identifies the virtual connection mahadev@bits-goa.ac.in 16
  • 17.
  • 18.
    Packets path througha virtual circuitPackets path through a virtual circuit network.network. mahadev@bits-goa.ac.in 18
  • 19.
    VC Forwarding TableExampleVC Forwarding Table Example mahadev@bits-goa.ac.in 19 Switch #2 In Port In Label Out Port Out Label 2 5 4 1 2 1 1 1 3 6 4 3 Switch #3 In Port In Label Out Port Out Label 1 1 3 3 2 1 3 1 Switch #5 In Port In Label Out Port Out Label 1 1 4 2 1 3 2 1 2 1 3 1 Switch #1 In Port In Label Out Port Out Label 1 2 3 5 2 1 3 1 1 1 4 1 Switch #4 In Port In Label Out Port Out Label 1 3 2 5 1 1 3 1 3 1 4 1 6 3 3 1 1 1
  • 20.
    mahadev@bits-goa.ac.in 20 The switch createsan entry in its table for this virtual circuit, but it is only able to fill three of the four columns. The switch assigns the incoming port (1) and chooses an available incoming VCI (14) and the outgoing port (3). It does not yet know the outgoing VCI, which will be found during the acknowledgment step .
  • 21.
    mahadev@bits-goa.ac.in 21 A special frame,called the acknowledgment frame, complete the entries in the switching tables . The destination sends an ack to switch 3.along with VCI 77, chosen by the destination as the incoming VCI for frames from A. Switch 3 uses this VCI to complete the outgoing VCI column for this entry. Switch 3 sends an ack to switch 2 that contains its incoming VCI in the table. Switch 2 uses this as the outgoing VCI in the table.. Switch2 & switch 1 follows the same procedure.
  • 22.
    There are twobroad classes of approach to establishing connection state. One is to have a network administrator configure the state, called “permanent virtual circuit” A host can send messages into the network to cause the state to be established. This is referred to as signaling. mahadev@bits-goa.ac.in 22
  • 23.
    Signaling processSignaling process Host A sends a setup message into the network, that is, to switch 1 , which contains Complete destination address of host B.  We assume that the switches know enough about the network topology to figure out how to switch packets so that the setup message flows on to switches 2 and 3 before finally reaching host B.  When switch 1 receives the connection request, in addition to sending it on to switch 2, it creates a new entry in its virtual circuit table for this new connection.mahadev@bits-goa.ac.in 23
  • 24.
     When packetsarrive on port 2 with identifier 5, send them out on port 1.  When switch 2 receives the setup message, it performs a similar process; picks the value 11 as the incoming VCI value.  switch 3 picks 7 as the value for its incoming VCI  Each switch can pick any number it likes, as long as that number is not currently in use for some other connection. mahadev@bits-goa.ac.in 24
  • 25.
    Cont…Cont… Finally, the setupmessage arrives at host B. B is willing to accept a connection from host A, so it allocates a incoming VCI value 4. This VCI value can be used by B to identify all packets coming from host A. mahadev@bits-goa.ac.in 25
  • 26.
     To completethe connection, every switch needs to be informed what their downstream neighbors VCI.  Host B sends an acknowledgment to switch 3 and includes in that message the VCI that it chose 4.  Switch 3 sends the acknowledgment on to switch 2, specifying a VCI of 7.  Switch 2 sends the message on to switch 1, specifying a VCI of 11.  Finally, switch 1 passes the acknowledgment on to host A, telling it to use the VCI of 5 for this connection. mahadev@bits-goa.ac.in 26
  • 27.
    Tearing down theconnectionTearing down the connection When host A no longer wants to send data to host B, it tears down the connection. It sends a teardown message to switch 1. The switch removes the relevant entry from its table and forwards the message on to the other switches in the path.  Which similarly delete the appropriate table entries mahadev@bits-goa.ac.in 27
  • 28.
    Source RoutingSource Routing Switchingthat uses neither virtual circuits nor conventional datagram. All the information about network topology, required to switch a packet across the network is provided by the source host. It assign a number to each output of each switch and to place that number in the header of the packet. mahadev@bits-goa.ac.in 28
  • 29.
     For eachpacket that arrives on an input, the switch would read the port in the header and transmit the packet on that output.  However, since there will be more than one switch in the path, the header for the packet needs to contain enough information to allow every switch in the path to determine which output the packet needs to be placed on.  Solution is to put an ordered list of switch ports in the header and to rotate the list so that the next switch in the path is always at the front of the list . mahadev@bits-goa.ac.in 29
  • 30.
  • 31.
    Disadvantage:Disadvantage: Source routing suffersfrom a scaling problem. Reasonably large network, it is very hard for a host to get the complete path information it needs to construct correct headers. mahadev@bits-goa.ac.in 31