Path-Vector Routing Algorithm

 

Path-Vector Routing Algorithm

Path-vector (PV) routing is a routing algorithm in which the decision about the best route is based on the actual path and routing policies, rather than simply choosing the path with the lowest cost.

It is especially useful when a network wants to control which intermediate networks or routers a packet is allowed or not allowed to pass through.


1. Why Do We Need Path-Vector Routing?

Both Distance-Vector (DV) and Link-State (LS) routing mainly focus on finding the least-cost path.

For example:

A ─── B ─── D ─── E

Suppose this is the least-cost path from A to E. However, router D may belong to:

  • an organization that is not trusted,
  • a network with poor security,
  • a commercial competitor,
  • or a network that the sender wants to avoid.

Even though the route through D has the lowest cost, the sender may not want its packets to travel through D.

Therefore:

The least-cost path is not always the best path.

Path-vector routing solves this problem by allowing routing decisions to be based on policies.


2. Main Idea of Path-Vector Routing

In path-vector routing:

A router keeps information about the complete path to each destination.

Instead of storing only a distance or cost, it stores the sequence of nodes through which the packet will travel.

For example:

DestinationPath
B    A → B
C    A → B → C
D    A → B → D

The router can therefore examine the complete path and decide whether that path satisfies its routing policy.


3. Path-Vector Routing and Policy-Based Routing

The most important feature of path-vector routing is the use of routing policies.

A router may select a path based on policies such as:

Policy 1: Minimum number of nodes

Choose the path that passes through the smallest number of routers.

For example:

Path 1: A → B → E
Path 2: A → C → D → E

The first path may be preferred because it has fewer intermediate nodes.


Policy 2: Avoid specific nodes

Suppose router A does not want packets to pass through router D.

A → B → D → E    ✗ Not acceptable

A → C → E        ✓ Acceptable

Even if the first route has a lower cost, router A can select the second route because it satisfies its policy.


4. Best Spanning Tree in Path-Vector Routing

Like other routing algorithms, path-vector routing creates a spanning tree.

However, there is an important difference.

In Link-State Routing:

The tree is a:

Least-cost tree

In Path-Vector Routing:

The tree is:

A policy-based best spanning tree

The best route is selected according to the policies imposed by the source.

Therefore, different routers may create different spanning trees based on their own policies.




5. Initialization of Path Vectors

Path-vector routing is:

  • Distributed
  • Asynchronous

This means routers operate independently and exchange information with their neighbors.

When a router starts or is booted, it first discovers its immediate neighbors.

For example, suppose router C is directly connected to:

B, D, and E

Initially, C knows only these direct connections.

Its initial path vector may look like:

DestinationPath
CC
BC → B
DC → D
EC → E
AUnknown

At this stage, router C does not yet know how to reach A.




6. Exchange of Path Vectors

After creating its initial path vector:

Each router sends its path vector to all its immediate neighbors.

Suppose router C receives the path vector of router B.

Router B may know the following:

Destination    Path from B
A    B → A
C    B → C
D    B → D

Router C can use this information to discover new paths.

For example, if B knows:

B → A

Then C can create:

C → B → A

Thus, router C learns how to reach A.


7. Updating the Path Vector

The path-vector update equation is similar in concept to the Bellman-Ford idea used in distance-vector routing.

The  idea is:

Path(𝑥,𝑦)=best{Path(𝑥,𝑦),[𝑥+Path(𝑣,𝑦)]}

for all possible neighboring nodes 𝑣.

Let's understand this simply.

Where:

  • x = the current router
  • y = the destination
  • v = a neighboring router
  • Path(v, y) = the path known by neighbor v to destination y

The router adds itself to the beginning of the received path.


Example

Suppose router B tells router C:

B → A

Router C adds itself to the beginning:

C → B → A

Router C then compares:

  • its existing path to A, and
  • the new path through B.

It selects the path that best satisfies its policy.


8. Example Based on Router C

Consider a network containing:

       A
       |
       B
      / \
     C   D
          \
           E

Suppose router C initially knows:

C → B
C → D
C → E

but does not know how to reach A.


Event 1: C receives B's path vector

Router B knows:

B → A

Router C receives this information.

C adds itself to the beginning:

C → B → A

Now router C updates its path vector.

New path vector of C:

DestinationPath
C    C
B    C → B
D    C → D
E    C → E
A    C → B → A

Now C knows how to reach A.


Event 2: C receives D's path vector

Suppose D also sends its path vector to C.

Router C examines all possible paths through D.

It compares them with the paths it already knows.

If the path through D:

  • is longer,
  • violates C's policy,
  • or is otherwise less preferred,

then C keeps its existing path.

Therefore:

Receiving new routing information does not always result in a change to the path vector.


 


9. Loop Prevention in Path-Vector Routing

One of the important features of path-vector routing is loop prevention.

Suppose router C receives the following path from a neighbor:

B → D → C → E

Router C wants to find a path to E.

However, the received path already contains C.

If C adds itself again, the path would become:

C → B → D → C → E

This creates a routing loop.

Therefore, the rule is:

If the received path already contains the current router, that path is discarded.

This prevents a router from selecting a route that eventually comes back to itself.


10. Complete Working of Path-Vector Routing

The complete process can be summarized as follows:

Router starts
      ↓
Discovers immediate neighbors
      ↓
Creates initial path vector
      ↓
Sends path vector to neighbors
      ↓
Receives path vectors from neighbors
      ↓
Adds its own node to received paths
      ↓
Checks for routing loops
      ↓
Applies its routing policies
      ↓
Selects the best acceptable path
      ↓
Updates its path vector
      ↓
Sends updated information to neighbors






11. Comparison with Distance-Vector and Link-State Routing

FeatureDistance VectorLink StatePath Vector
Main objectiveLeast-cost pathLeast-cost pathPolicy-based best path
Information storedDistance to destinationComplete network topologyComplete path to destination
Information exchangedDistance vectorsLink-state informationPath vectors
Network knowledgeLearned from neighborsComplete network mapPaths learned from neighbors
Main algorithmBellman-Ford conceptDijkstra's algorithmPolicy-based path selection
Loop preventionMore difficultLess problematicPath itself helps detect loops
Routing decisionBased mainly on costBased on complete topology and costBased on policies and path

12. Important Difference

A simple way to remember the three algorithms is:

Distance Vector

"How far is the destination?"

It focuses mainly on the distance or cost.

Link State

"What does the entire network look like?"

It builds a complete network map.

Path Vector

"Which path should I use according to my policy?"

It considers the actual path and routing policies.


13. Path-Vector Routing in the Internet

Path-vector routing is particularly important for routing between large networks and Internet Service Providers (ISPs).

Unlike routing inside a small network, communication between large independent networks may involve:

  • security policies,
  • commercial agreements,
  • administrative rules,
  • restrictions on particular networks.

Therefore, simply choosing the least-cost route may not be appropriate.

Path-vector routing allows these policies to influence the route selection.


Summary

  • Path-vector routing is policy-based routing.
  • It does not simply select the least-cost path.
  • Each router stores the complete path to a destination.
  • Routers exchange their path vectors with immediate neighbors.
  • A router adds itself to the beginning of a received path.
  • The router selects the best path according to its policy.
  • If a received path already contains the current router, it is discarded to prevent loops.
  • Different routers can select different spanning trees based on their policies.
  • Path-vector routing is particularly useful for routing between ISPs and large networks.

Path-vector routing is a distributed routing algorithm in which routers exchange complete path information and select the best route based on administrative policies rather than only on the least cost, while preventing routing loops by rejecting paths that already contain the router's own identifier.

Comments

Popular posts from this blog

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

Model Question Paper Computer Networks PCCST501 KTU 2024 Scheme and Answer Key

Introduction to Computer Networks