Skip to content

harshitap1305/NetPerf-Toolkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NetPerf Toolkit: Custom C Network Diagnostics

C Python

A collection of custom-built network diagnostic utilities written in C. This toolkit includes tools for measuring Round Trip Time (RTT), benchmarking UDP throughput (similar to iperf), and mapping network hops using raw ICMP sockets.

🚀 Included Tools

  1. RTT Echo Suite (RTT_Echo/)

    • A UDP server and client designed to measure packet latency.
    • Calculates real-time Round Trip Time (RTT) and packet loss percentages over a specified interval.
  2. Throughput Benchmarker (Throughput_Test/)

    • An iperf-like UDP client that utilizes non-blocking sockets to stress-test network links.
    • Logs real-time throughput (Mbps) and average delay metrics to a CSV file.
    • Includes a Python visualization script (plot_throughput.py) to generate throughput vs. delay graphs using Matplotlib.
  3. Custom Traceroute (Traceroute/)

    • Maps the network path to a specific domain or IP address.
    • Built using raw sockets (IPPROTO_ICMP and IPPROTO_UDP) to manually manipulate IP Time-To-Live (TTL) fields and catch ICMP_TIME_EXCEEDED and ICMP_DEST_UNREACH responses.

📸 Demonstrations

1. RTT Echo Testing

RTT Echo Terminal

2. Throughput & Delay Visualization

Network Throughput Graph

Throughput Terminal

3. Custom Traceroute Execution

Traceroute Terminal

🛠️ Prerequisites

  • C Compiler: gcc
  • Python 3: Required for generating throughput graphs.
    • Dependencies: pip install matplotlib
  • Root Permissions: The Traceroute tool requires sudo privileges to open raw sockets.

⚙️ Compilation & Usage

1. RTT Echo Testing

1. Compilation:

cd RTT_Echo
gcc rtt_server.c -o rtt_server
gcc rtt_client.c -o rtt_client

2. Running the Server: The server listens for UDP packets on a specified port and echoes them back exactly.

# In Terminal 1
./rtt_server <port>

# Example:
./rtt_server 8001

3. Running the Client: The client sends packets containing a sequence number and timestamp, waits for echoes, and computes RTT.

# In Terminal 2
./rtt_client <server_ip> <port> <num_messages> <interval_ms> <packet_size>

# Example (sending 10 packets to localhost:8001, every 1000ms, 64 bytes each):
./rtt_client 127.0.0.1 8001 10 1000 64

2. Throughput Benchmarking (iperf clone)

Dependency Note: The Throughput_Test Client relies on the rtt_server built in RTT_Echo! Please ensure the server from RTT_Echo is running before running the client for Throughput_Test

1. Compilation:

cd Throughput_Test
gcc iperf_client.c -o iperf_client

2. Start the Server (if not already running):

# In Terminal 1
cd ../RTT_Echo
./rtt_server 8001

3. Run the iperf Client:

# In Terminal 2
cd ../Throughput_Test
./iperf_client <server_ip> <port> <duration_sec> <packet_size>

# Example (testing throughput to localhost:8001 for 10 seconds, 1024 bytes per packet):
./iperf_client 127.0.0.1 8001 10 1024

This will perform the throughput test and automatically generate a file named iperf_metrics.csv.

4. Generate Graphs:

# In Terminal 3 (or after the iperf_client finishes)
# Requires matplotlib (pip install matplotlib)
python3 plot_throughput.py

This script will read iperf_metrics.csv and generate throughput_delay_graph.png, showing throughput and delay over time.


3. Custom Traceroute

Compile and run the traceroute tool against a target domain (requires root for raw socket access):

1. Compilation:

cd Traceroute
gcc traceroute.c -o traceroute

2. Running Traceroute: Since this program uses raw ICMP sockets (IPPROTO_ICMP) to receive data, it requires administrative capabilities (sudo).

sudo ./traceroute <destination_ip_or_domain>

# Example:
sudo ./traceroute google.com

Thank you for visiting!

About

A suite of custom network diagnostic tools built in C, featuring a UDP-based throughput/latency benchmarker (iperf clone) and an ICMP raw-socket traceroute implementation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors