Acn Final MP G3 23 ODD
Acn Final MP G3 23 ODD
Acn Final MP G3 23 ODD
Submitted By
Name Enrollment No
Shreyash Dilip Chabilwad 2106034
Ritesh Ganesh Chinchole 2106036
Rushikesh Pundlik Dawale 2106039
Shreyas Sunil Deobhankar 2106040
Smt.A.S.Paike Mam
(Academic Year:2023-24)
Government Polytechnic,Pune 16
Department of Computer Engineering
CERTIFICATE
This is to certify that the mini-project work entitled “Distance Vector Algorithm
Program using C++ ” is a bonafide work carried out by
Name Enrollment No
Shreyash Dilip Chabilwad 2106034
Ritesh Ganesh Chinchole 2106036
Rushikesh Pundlik Dawale 2106039
Shreyas Sunil Deobhankar 2106040
of class Third Year in partial fulfilment of the requirement for the completion of
Course of Diploma Advanced Computer Network (CM4108) in Computer Engineering
from Government Polytechnic Pune. The report has been approved as it satisfies the
academic requirements in respect of micro-project work
prescribed for the course.
Acknowledgement
My Sincere efforts have made me to accomplish the task of completing this project.
However, it would not have been possible without the kind support and help of many
individuals.I would like to express my sincere gratitude to my Principal Dr. Vitthal Bandal
and the college for providing me with facilities required to do my project.
I am highly indebted to my Project Guide Smt.A.S.Paike mam for her valuable guidance
which has promoted my efforts in all the stages of this project work. Assistant is
developing my project and to the people who have willingly helped me out with their
abilities.
This project has been a remarkable learning experience, and I am thankful to each and
every one of you for your contributions and support in bringing our smart home design to
fruition.Finally, words are not sufficient to express gratitude my cherished family
members for supporting me without their encouragement and support I would not reach
this stage.
Abstract
Distance Vector Routing is a fundamental algorithm used in computer networking to
determine the best path for data to travel through a network. This project presents
an implementation of the Distance Vector Routing Algorithm using C++, providing a
simplified but illustrative example of its functionality.
The program simulates a network of routers and allows users to specify link costs
between routers. Each router maintains a routing table, which is updated as per the
Distance Vector Algorithm. The routing tables reflect the best path and associated
cost to reach other routers in the network.
The project demonstrates the core principles of Distance Vector Routing, including
the exchange of routing information among routers and the iterative process of
updating routing tables until they converge to optimal values. It also showcases how
routers can handle unreachable or infinity-cost destinations.
This C++ program serves as a valuable learning resource for those looking to
understand the basic concepts of Distance Vector Routing and lays the groundwork
for more complex routing protocols used in real-world networking scenarios. It
illustrates the importance of dynamic routing and adapting to changes in network
topology, making it an essential concept in the field of computer networking.
Through this project, readers and learners can gain insight into the mechanics of
routing in computer networks, furthering their understanding of how data is
efficiently delivered from source to destination in complex network infrastructures.
Contents
1 Acknowledgement 1
2 Abstract 2
3 Introduction 4
4 Routing Protocols 6
5 Routing table 7
8 Output 14
9 Conclusion 15
10 Reference 15
Introduction
Functions of routers
Path
Determination Data Forwarding Data Forwarding
Path determination :
A router determines the path data takes when it moves from a source to a
destination.
Data forwarding :
A router forwards data to the next device on the selected path to eventually
reach its destination. The device and router may be on the same network or on
different networks.
Load balancing :
Sometimes the router may send copies of the same data packet by using
multiple different paths. It does this to reduce errors due to data losses, create
redundancy, and manage traffic volume.
Routing table
A routing table is a set of rules, often viewed in table format, that is used to
determine where data packets traveling over an Internet Protocol (IP) network
will be directed. All IP-enabled devices, including routers and switches, use
routing tables.
The routing table contains a list of specific routing destinations. When the
router receives a packet of data, it references the routing table to know where
to send that data. The routing table may also contain information on how far
each destination is from the router. In essence, a routing table is a map for the
router.
A routing table does not contain a list of all possible destinations. Rather, it
contains a list of destinations that are next in line to the router. Each router
contains this list. When a packet is received, it's directed to the next network
link (hop), as listed in the table, until it reaches its final destination. The
routing table contains a list of IP addresses, Gateway addresses, and other
information.
1. Network ID:
The network ID or destination corresponding to the route.
2. Subnet Mask:
The mask that is used to match a destination IP address to the network ID.
3. Next Hop:
The IP address to which the packet is forwarded
4. Outgoing Interface:
Outgoing interface the packet should go out to reach the destination
network.
5. Metric:
A common use of the metric is to indicate the minimum number of
hops (routers crossed) to the network ID.
Routing algorithms are software programs that implement different routing protocols.
They work by assigning a cost number to each link; the cost number is calculated using
various network metrics. Every router tries to forward the data packet to the next best link
with the lowest cost.
Distributed:
Each node receives information from one or more of its directly attached neighbours,
performs calculation and then distributes the result back to its neighbours.
Iterative:
Its process continues until no more information is available to be exchanged between
neighbours.
Asynchronous:
It does not require that all of its nodes operate in the lock step with each other.
1. A router transmits its distance vector to each of its neighbours in a routing packet.
2. Each router receives and saves the most recently received distance vector
from each of its neighbours.
When a node x receives new DV estimate from any neighbor v, it saves v’s distance
vector and it updates its own DV using B-F equation :
Program:
#include <iostream>
#include <vector>
#include <map>
#include <climits> // Include the header for INT_MAX
using namespace std;
class Router {
private:
int id;
map<int, int> routingTable;
public:
Router(int id) : id(id) {
routingTable[id] = 0; // Distance to itself is 0
}
void printRoutingTable() {
cout << "Router " << id << " Routing Table:" << endl;
for (auto entry : routingTable) {
cout << "To " << entry.first << " via " << entry.first << ": " <<
entry.second << endl;
}
}
};
Department Of Computer Engineering
P a g e | 12
int main() {
vector<Router> routers;
int numRouters;
return 0;
}
Output
Advantages:
Disadvantage:
1.A broken link between the routers should be updated to every other router in the network
immediately. The distance vector routing takes a considerable time for the update. This
problem is also known as count-to- infinity.
2.The time required by every router in a network to produce an accurate routing table is called
convergence time. In the large and complex network, this time is excessive.
3.Every change in the routing table is propagated to other neighbouring routers periodically
which create traffic on the network.
Conclusion
This report includes all the basic knowledge about Routing, types of routing, routing
protocols and algorithms. Need and importance of routing and routing tables are neatly
defined. We studied about the Distance Vector Routing and implemented it by creating
routing tables for the routers using python language. This report can serve as a guide for
learning distance Vector Routing and its implementation.
Reference