Connection-Oriented Service: Virtual-Circuit Approach

 

Connection-Oriented Service: Virtual-Circuit Approach

The virtual-circuit approach is a connection-oriented packet-switching service at the network layer. In this approach, all packets belonging to the same message are related to one another because a virtual connection (virtual circuit) is established before data transmission begins.

Unlike the datagram approach, where every packet is routed independently, the virtual-circuit approach establishes a logical path through the network and then uses that path for all packets belonging to the connection.


1. Basic Idea

Suppose source A wants to send a message to destination B.

The message is divided into packets:

Message
   ↓
┌────┬────┬────┬────┐
│ P1 │ P2 │ P3 │ P4 │
└────┴────┴────┴────┘

Before these packets are sent, a virtual circuit is established:

A → R1 → R3 → R4 → B

After the virtual circuit has been established, all packets belonging to this message follow the same logical path.

P1 → R1 → R3 → R4 → B
P2 → R1 → R3 → R4 → B
P3 → R1 → R3 → R4 → B
P4 → R1 → R3 → R4 → B

Therefore, packets normally arrive at the destination in the same order in which they were sent.


2. Virtual Circuit Identifier / Label

In addition to the source and destination addresses, packets in a virtual-circuit network carry a flow label, also called a:

  • Virtual Circuit Identifier (VCI)
  • Label

The label identifies the virtual path that the packet should follow.

For example:

┌─────────────────────────────┐
│ Source Address              │
│ Destination Address         │
│ Virtual Circuit Label: 14   │
│ Data                        │
└─────────────────────────────┘

The forwarding decision at a router is based primarily on the label.

Important distinction

In a datagram network:

Forwarding decision → Destination address

In a virtual-circuit network:

Forwarding decision → Virtual-circuit label


3. Why Is a Label Needed?

Consider the virtual circuit:

A → R1 → R3 → R4 → B

Different labels can be used on different links.

For example:

A ──14──→ R1 ──66──→ R3 ──22──→ R4 ──77──→ B

The label can therefore be changed at every router.

DeviceIncoming LabelOutgoing Label
R11466
R36622
R42277

When a packet arrives at a router, the router looks at the incoming label and determines:

  1. Which virtual circuit the packet belongs to.
  2. Which output port should be used.
  3. Which new label should be attached before forwarding.






4. Three Phases of Virtual-Circuit Service

A connection-oriented service uses three phases:

  1. Setup phase
  2. Data-transfer phase
  3. Teardown phase
        ┌───────────────┐
        │  Setup Phase  │
        └───────┬───────┘
                ↓
        ┌───────────────┐
        │ Data Transfer │
        └───────┬───────┘
                ↓
        ┌───────────────┐
        │ Teardown Phase│
        └───────────────┘

5. Setup Phase

The first phase is the setup phase.

Suppose source A wants to establish a virtual circuit with destination B.

Two special packets are exchanged:

  • Request packet
  • Acknowledgment packet

The purpose of the setup phase is to create the necessary entries in the forwarding tables of all routers along the path.


Step 1: Request Packet

Source A sends a request packet toward B.

The request packet contains the source and destination addresses.

A → R1 → R3 → R4 → B

At R1

R1 determines that packets from A to B should leave through port 3.

R1 creates a table entry.

For example:

Incoming PortIncoming LabelOutgoing PortOutgoing Label
1143?

R1:

  • identifies incoming port = 1
  • chooses incoming label = 14
  • determines outgoing port = 3
  • does not yet know the outgoing label

So three of the four values are known.


Step 2: Request Reaches R3

R3 receives the request packet.

It performs the same operation.

Suppose R3 chooses:

Incoming port = 1
Incoming label = 66
Outgoing port = 3

Its table becomes:

Incoming PortIncoming LabelOutgoing PortOutgoing Label
1663?

Step 3: Request Reaches R4

Similarly, R4 creates:

Incoming PortIncoming LabelOutgoing PortOutgoing Label
1224?

Step 4: Destination B Receives Request

The request eventually reaches destination B.

If B is ready to accept packets from A, B chooses a label for packets arriving from A.

Suppose B chooses:

77

This label identifies packets arriving at B as belonging to the virtual circuit from A.




6. Acknowledgment Phase

The acknowledgment now travels backward from B toward A.

This completes the forwarding-table entries.

The process is:

B → R4 → R3 → R1 → A

At R4

B sends the acknowledgment containing label 77.

R4 uses 77 as its outgoing label:

Incoming PortIncoming LabelOutgoing PortOutgoing Label
122477

At R3

R4 sends an acknowledgment containing its incoming label 22.

R3 uses 22 as its outgoing label:

Incoming PortIncoming LabelOutgoing PortOutgoing Label
166322

At R1

R3 sends an acknowledgment containing its incoming label 66.

R1 uses 66 as its outgoing label:

Incoming PortIncoming LabelOutgoing PortOutgoing Label
114366

Finally, R1 sends an acknowledgment containing label 14 back to A.

A now knows that it should use 14 as the label for packets sent into the virtual circuit.


7. Complete Virtual-Circuit Setup

The resulting logical path can be represented as:

A ──14──→ R1 ──66──→ R3 ──22──→ R4 ──77──→ B

The labels are local to each link and can change at every router.

The forwarding tables are now established.




8. Data-Transfer Phase

After the setup phase is complete, the actual data packets can be transmitted.

Suppose A wants to send packets:

P1, P2, P3, P4

All packets follow the established virtual circuit.

A → R1 → R3 → R4 → B

For example, consider one packet.

At source A

A attaches label 14:

A ──[Label 14]──→ R1

At R1

R1 looks up label 14.

It changes the label from 14 → 66 and forwards the packet to R3.

R1 ──[Label 66]──→ R3

At R3

R3 changes:

66 → 22

and forwards the packet to R4.

At R4

R4 changes:

22 → 77

and delivers the packet to B.

Thus:

A
 │
 │ Label 14
 ↓
R1
 │
 │ Label 66
 ↓
R3
 │
 │ Label 22
 ↓
R4
 │
 │ Label 77
 ↓
B

Every packet belonging to the same virtual circuit follows the same sequence of labels.




9. Teardown Phase

After all packets have been transmitted, the virtual circuit is no longer required.

Source A sends a special teardown packet to B.

A → R1 → R3 → R4 → B

Destination B responds with a confirmation packet.

After this:

  • R1 deletes the virtual-circuit entry.
  • R3 deletes the virtual-circuit entry.
  • R4 deletes the virtual-circuit entry.

The virtual circuit is therefore terminated.


10. Datagram vs Virtual Circuit

FeatureDatagram ApproachVirtual-Circuit Approach
Service    Connectionless    Connection-oriented
Connection setup    Not required    Required
Packets    Independent    Related
Routing    Each packet independently routed    Packets follow established virtual circuit
Forwarding decision    Destination address    Virtual-circuit label
Path    May differ for each packet    Same logical path
Packet order    May be out of order    Normally in order
Setup phase    No    Yes
Data-transfer phase    Yes    Yes
Teardown phase    No    Yes
Router table entries    General forwarding table    Entries created for each virtual circuit

Key Idea to Remember

In the virtual-circuit approach, a logical connection is established before data transmission. The setup phase creates forwarding-table entries at the routers, the data packets then follow the established virtual circuit using labels, and the teardown phase removes the corresponding table entries.

Comments

Popular posts from this blog

Computer Networks PCCST501 Semester 5 KTU CS 2024 Scheme - Dr Binu V P

Introduction to Computer Networks

Introduction to Local Area Network (LAN)