Packet switching

31
Computer Networks Computer Networks An Engineering Design Approach An Engineering Design Approach Packet Switching Packet Switching Sabyasachi Upadhyay BITS Pilani 1

Transcript of Packet switching

Page 1: Packet switching

Computer NetworksComputer NetworksAn Engineering Design ApproachAn Engineering Design Approach

Packet SwitchingPacket Switching

Sabyasachi Upadhyay

BITS Pilani

1

Page 2: Packet switching

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 .

[email protected]

Page 3: Packet switching

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.

[email protected]

Page 4: Packet switching

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.

[email protected]

Page 5: Packet switching

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,

[email protected]

Page 6: Packet switching

The question then is, How does the switch decide The 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.

[email protected]

Page 7: Packet switching

DatagramDatagramBased 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).

[email protected]

Page 8: Packet switching

Datagram Forwarding Datagram Forwarding ExampleExample

[email protected]

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

II I I

I

I

Page 9: Packet switching

• 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.

[email protected]

Page 10: Packet switching

• 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.

[email protected]

Page 11: Packet switching

Datagram approach

[email protected]

Page 12: Packet switching

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.

[email protected]

Page 13: Packet switching

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.

[email protected]

Page 14: Packet switching

VCI phases

Page 15: Packet switching

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

[email protected]

Page 16: Packet switching

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

[email protected]

Page 18: Packet switching

Packets path through a virtual circuit Packets path through a virtual circuit network.network.

[email protected]

Page 19: Packet switching

VC Forwarding Table ExampleVC Forwarding Table Example

[email protected]

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

33

1

1

1

Page 20: Packet switching

[email protected]

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 .

Page 21: Packet switching

[email protected]

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.

Page 22: Packet switching

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.

[email protected]

Page 23: Packet switching

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.

[email protected]

Page 24: Packet switching

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.

[email protected]

Page 25: Packet switching

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.

[email protected]

Page 26: Packet switching

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.

[email protected]

Page 27: Packet switching

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

[email protected]

Page 28: Packet switching

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.

[email protected]

Page 29: Packet switching

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 .

[email protected]

Page 30: Packet switching

[email protected]

Source routing in a switched network

Page 31: Packet switching

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.

[email protected]