Skip to content

About

Java-based simulation system for IP subnetting and routing (Dijkstra & BGP logic)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

115 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Subnetting and Routing System

This program is a system for routing within and between subnets. It manages any number of subnets of any size and finds the shortest path between any systems based on the topology. This enables the exchange of packets.

Features

  • Network management: Create and manage any number of subnets of different sizes.
  • System management: Add and remove computers and routers.
  • Connection management: Create and remove connections between systems.
  • Path finding: Calculate the shortest path between any systems.
    • Intra-subnet routing using Dijkstra's algorithm
    • Inter-subnet routing using BGP tables
  • Packet exchange: Send packets between systems via the calculated path.

Components

  • Network: Central data structure for managing subnets, systems, and connections.
  • Subnet: Represents a subnet in CIDR notation and contains systems.
  • Systems: Base class for all network systems.
    • Computer: End device inside a subnet.
    • Router: Connects subnets and enables inter-subnet routing.
  • Connection: Connection between two systems with a weight.
  • PathFinder: Implements algorithms for path finding

Usage

The program is controlled from the command line. The following commands are available:

  • load network: Loads a network from a file
  • list subnets: Lists all subnets
  • list range: Shows the IP range of a subnet
  • list systems: Lists all systems in a subnet
  • add computer: Adds a computer to a subnet
  • remove computer: Removes a computer from a subnet
  • add connection: Creates a connection between two systems
  • remove connection: Removes a connection between two systems
  • send packet: Sends a packet from one system to another
  • quit: Exits the program

Example file

An example network can be found in example1.txt. Load it with load network src/main/resources/example1.txt.

graph TD;
  subgraph 192.168.1.0/24
    A_Router[192.168.1.1]
    A_PC1[192.168.1.2]
    A_PC2[192.168.1.3]
    A_PC3[192.168.1.4]
    A_PC4[192.168.1.5]
    A_PC5[192.168.1.6]
    A_Router <-->|7| A_PC1
    A_Router <-->|2| A_PC2
    A_Router <-->|10| A_PC4
    A_PC1 <-->|5| A_PC2
    A_PC2 <-->|3| A_PC3
    A_PC4 <-->|9| A_PC2
    A_PC1 <-->|1| A_PC5
  end
      subgraph 10.0.0.0/16
    B_Router[10.0.0.1]
    B_PC1[10.0.0.2]
    B_PC2[10.0.0.3]
    B_Router <-->|6| B_PC1
    B_Router <-->|4| B_PC2
    B_PC1 <-->|7| B_PC2
  end
  subgraph 172.16.0.0/24
    C_Router[172.16.0.1]
    C_PC1[172.16.0.2]
    C_PC2[172.16.0.3]
    C_PC3[172.16.0.4]
    C_Router <-->|5| C_PC1
    C_Router <-->|8| C_PC2
    C_PC1 <-->|2| C_PC2
    C_PC2 <-->|3| C_PC3
  end
  subgraph 192.168.100.0/24
    D_Router[192.168.100.1]
    D_PC1[192.168.100.2]
    D_PC2[192.168.100.3]
    D_PC3[192.168.100.4]
    D_PC4[192.168.100.5]
    D_Router <-->|4| D_PC1
    D_Router <-->|9| D_PC4
    D_PC1 <-->|2| D_PC2
    D_PC2 <-->|3| D_PC3
    D_PC3 <-->|6| D_PC4
  end
A_Router <--> B_Router
B_Router <--> C_Router
C_Router <--> D_Router
B_Router <--> D_Router
Loading

Technical details

The system uses:

  • Command Design Pattern for a modular and extensible CLI.
  • Optimized Dijkstra's algorithm for intra-subnet routing ($O(E \log V)$ using PriorityQueue and Adjacency Lists).
  • BGP-like path-vector protocol for inter-subnet routing.
  • Automatic updating of routing tables when the network topology changes.
  • Unit Testing using JUnit5.
  • Error handling for invalid operations.

Possible improvements and extensions

  • Add support for more complex routing protocols (OSPF, etc.)
  • Add a simple working GUI
  • Implement multithreaded BGP convergence simulation

About

Java-based simulation system for IP subnetting and routing (Dijkstra & BGP logic)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages