Skip to content

A Python-based network diagnosis and troubleshooting tool that detects packet loss, DNS failures, and high latency. It performs intelligent analysis, generates detailed reports, and provides automated troubleshooting workflows to help identify and resolve network performance issues efficiently.

License

Notifications You must be signed in to change notification settings

Isharkii/Network-Diagnostic-and-Troubleshooting-Lab

Repository files navigation

NetDiag - Network Diagnosis & Troubleshooting Tool

A comprehensive Python-based network diagnosis and troubleshooting tool that helps identify and analyze network connectivity issues, latency problems, DNS resolution failures, and packet loss.

Features

  • Network Connectivity Probes: TCP/UDP connectivity testing, ping, traceroute
  • DNS Analysis: DNS resolution testing, lookup times, record validation
  • Performance Metrics: Latency measurement, packet loss detection, throughput testing
  • Automated Analysis: Intelligent issue detection with configurable thresholds
  • Rich Reporting: Detailed reports with visualizations and recommendations
  • Async Operations: High-performance concurrent network testing
  • CLI Interface: Easy-to-use command-line interface with rich output
  • Docker Support: Containerized deployment and testing

Installation

From Source

git clone https://github.com/yourusername/netdiag.git
cd netdiag
pip install -r requirements.txt

Using Docker

docker-compose up --build

Quick Start

Basic Network Test

python -m src.netdiag.cli ping google.com

Comprehensive Analysis

python -m src.netdiag.cli diagnose --target google.com --config config.yaml

DNS Testing

python -m src.netdiag.cli dns-test --domain example.com --record-type A

Custom Configuration

python -m src.netdiag.cli diagnose --target 8.8.8.8 --timeout 5 --retries 3

Usage Examples

1. Basic Connectivity Test

# Test basic connectivity to a host
python -m src.netdiag.cli ping 8.8.8.8

2. Port Connectivity Test

# Test specific port connectivity
python -m src.netdiag.cli port-test --host google.com --port 443

3. DNS Diagnosis

# Comprehensive DNS testing
python -m src.netdiag.cli dns-test --domain github.com --nameserver 8.8.8.8

4. Network Path Analysis

# Traceroute with analysis
python -m src.netdiag.cli traceroute --target cloudflare.com --max-hops 30

5. Bulk Testing

# Test multiple targets from file
python -m src.netdiag.cli bulk-test --targets-file hosts.txt --output report.json

6. Performance Monitoring

# Continuous monitoring with thresholds
python -m src.netdiag.cli monitor --target 1.1.1.1 --interval 30 --duration 300

Configuration

Create a config.yaml file to customize thresholds and behavior:

# See config.yaml for full configuration options
thresholds:
  latency_warning: 100  # ms
  latency_critical: 500  # ms
  packet_loss_warning: 5  # %
  packet_loss_critical: 15  # %

API Usage

import asyncio
from src.netdiag.engine import DiagnosisEngine
from src.netdiag.probes import PingProbe, DNSProbe

async def main():
    engine = DiagnosisEngine()

    # Run ping test
    ping_result = await engine.run_probe(PingProbe("8.8.8.8"))

    # Run DNS test
    dns_result = await engine.run_probe(DNSProbe("google.com"))

    # Generate report
    report = engine.generate_report([ping_result, dns_result])
    print(report.to_json())

asyncio.run(main())

Development

Setup Development Environment

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt

Running Tests

pytest tests/

Running with Docker

docker-compose up --build netdiag

Requirements

  • Python 3.10+
  • See requirements.txt for dependencies

License

MIT License - see LICENSE file for details.

Contributing

See CONTRIBUTING.md for guidelines on contributing to this project.

Support

For issues and feature requests, please use the GitHub issue tracker.

About

A Python-based network diagnosis and troubleshooting tool that detects packet loss, DNS failures, and high latency. It performs intelligent analysis, generates detailed reports, and provides automated troubleshooting workflows to help identify and resolve network performance issues efficiently.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published