Skip to content

yashkukrecha/network-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Network Simulator

A Rust-based network simulator is an educational tool that mimics packet transportation, routing, and other network behaviors, designed to help visualize and test network configurations and behaviors. The project includes a variety of features such as packet forwarding, static routing, error simulation, and a planned GUI for enhanced interactivity.

Tech

  • Rust: Core language used for developing the simulator.
  • Cargo: Rust's package manager and build tool.
  • Egui: For handling terminal-based interaction and GUI.
  • Multithreading: Multithreading supports sending responses to incoming packets or forwarding packets through the network.
  • Synchronization (Mutex): Maintains atomicity and prevents race conditions with multithreading.

Features

Core Features:

  • Packet Simulation:
    • Simulate the creation, forwarding, and modification of network packets.
    • Include packet fragmentation and reassembly.
  • Routing:
    • Static routing tables to forward packets.
  • Error Simulation:
    • Simulate packet loss, corruption, retransmissions, and delays.
    • Configurable bandwidth constraints on routers and switches.
  • TTL (Time-To-Live): The TTL field in the packet header decreases as the packet travels through routers.
  • TCP/IP Behavior Simulation: Support for simple behaviors of TCP/IP packets for testing.

GUI Features:

  • Network Graph: A graphical representation of the network showing devices, links, and packet flow.
  • Animations: Visual animations of packets forwarded through the network.
  • Interactive Nodes: Clickable network nodes (hosts, switches, routers) to inspect packet history and routing tables.
  • Real-time Updates: Display packet state changes, routing updates, and error simulations in real-time.

Classes Implemented:

  • Packet:
    • Represents a network packet with properties such as source/destination IP, source/destination MAC addresses, and data.
    • Handles ARP requests and responses.
  • Router:
    • Static routing table.
    • Will support dynamic routing protocols in future updates.
    • Can forward packets based on the destination network.
  • Switch:
    • Maintains a CAM/MAC table (MAC → port).
    • Can forward frames to the correct port.
  • Host:
    • Can generate packets.
    • Maintains ARP table (IP → MAC).
    • Sends/receives ARP requests.
  • Device:
    • Interface for hosts/routers/switches.

Future Enhancements:

  • Dynamic Routing: Implementation of routing protocols such as RIP and OSPF.
  • Protocol Expansion: More complex protocol simulations like ICMP, ARP, and HTTP.

Installation

To get started with the simulator, clone the repository and compile the project:

git clone https://github.com/yashkukrecha/network-simulator.git
cd network-simulator
cargo run

Have fun learning about networking! Here is a basic demonstration:

Network_Simulator_Demo.mp4

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages