Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌐 PacketPatrol

Docker MikroTik Linux SNMP License

A comprehensive Docker-based network monitoring laboratory environment featuring real MikroTik RouterOS instances and Linux servers configured for SNMP monitoring, network administration training, and system monitoring development.

πŸ—οΈ Project Architecture

This repository contains two complete laboratory environments:

Network Monitoring Lab Suite/
β”œβ”€β”€ πŸ–₯️  Linux Server Lab/           # SNMP-enabled Linux server environment
β”‚   β”œβ”€β”€ 🐳 docker-compose.yml       # Docker configuration
β”‚   β”œβ”€β”€ πŸ“‹ Dockerfile               # Custom Linux container build
β”‚   β”œβ”€β”€ πŸ”§ config/                  # SNMP and SSH configurations
β”‚   β”œβ”€β”€ πŸš€ scripts/                 # Startup and automation scripts
β”‚   └── πŸ“– README.md                # Linux lab documentation
β”‚
β”œβ”€β”€ 🌐 MikroTik Router Lab/          # Real RouterOS environment
β”‚   β”œβ”€β”€ 🐳 docker-compose.yml       # RouterOS container setup
β”‚   β”œβ”€β”€ πŸ”§ config/                  # RouterOS configurations and OID references
β”‚   β”œβ”€β”€ 🌟 Mikrotik Router Admin Website/  # Flask web management interface
β”‚   β”œβ”€β”€ πŸš€ Management Scripts/       # Automation and testing tools
β”‚   └── πŸ“– Documentation/           # Comprehensive guides
β”‚
└── πŸ“‹ README.md                    # This main documentation

⭐ Key Features

πŸ–₯️ Linux Server Lab

  • Real SNMP Agent: Pre-configured snmpd with custom OIDs
  • SSH Access: Secure shell with custom users and configurations
  • System Monitoring: CPU, memory, disk, and network interface monitoring
  • Load Simulation: Built-in stress testing for realistic metrics
  • Custom Network: Isolated Docker network for lab testing

🌐 MikroTik Router Lab

  • Authentic RouterOS: Real MikroTik CHR (Cloud Hosted Router) instance
  • Full SNMP Support: Complete MIB-II + MikroTik Enterprise MIBs
  • Web Management Interface: Modern Flask-based administration panel
  • Multiple Access Methods: SSH, Web, WinBox, SNMP, API
  • Traffic Generation: Built-in tools for testing and simulation
  • Monitoring Ready: Pre-configured for Zabbix, PRTG, LibreNMS, Prometheus

🎯 Perfect For

  • πŸŽ“ Network Administration Training
  • πŸ”¬ SNMP Monitoring Development
  • πŸ§ͺ Network Management System Testing
  • πŸ“Š Monitoring Tool Development
  • πŸ› οΈ DevOps Network Labs
  • 🎯 Certification Practice (CCNA, MTCNA, etc.)

πŸš€ Quick Start

Prerequisites

# Install Docker and Docker Compose
sudo apt-get update
sudo apt-get install docker.io docker-compose-plugin

# Install SNMP tools for testing
sudo apt-get install snmp snmp-mibs-downloader

# Add your user to docker group
sudo usermod -aG docker $USER

πŸ–₯️ Option 1: Linux Server Lab Only

cd "Linux Server Lab"
docker-compose up -d --build

# Test SNMP monitoring
snmpwalk -v2c -c public localhost:161 1.3.6.1.2.1.1

# Test SSH access
ssh -p 2222 root@localhost  # password: labpassword

🌐 Option 2: MikroTik Router Lab Only

cd "Mikrotik Router Lab"
chmod +x *.sh
./setup.sh

# Test SNMP functionality
./test-snmp.sh

# Access web interface
# Browser: http://localhost:8000

πŸ”₯ Option 3: Complete Environment

# Start Linux Server Lab
cd "Linux Server Lab"
docker-compose up -d --build

# Start MikroTik Router Lab
cd "../Mikrotik Router Lab"
./setup.sh

# Both labs are now running!

πŸ“‹ Access Information

πŸ–₯️ Linux Server Lab

Service Access Method Credentials
SNMP localhost:161 Community: public
SSH (root) ssh -p 2222 root@localhost Password: labpassword
SSH (user) ssh -p 2222 labuser@localhost Password: labpass123

🌐 MikroTik Router Lab

Service Access Method Credentials
Web Interface http://localhost:8000 admin / (no password)
Secure Web https://localhost:8443 admin / (no password)
SSH ssh admin@localhost -p 2222 admin / (no password)
SNMP localhost:161 Community: public
WinBox localhost:8291 admin / (no password)
Admin Website http://localhost:5000 Router credentials

πŸ› οΈ Detailed Lab Descriptions

πŸ–₯️ Linux Server Lab

A containerized Linux environment specifically designed for network monitoring testing:

Core Services

  • SNMP Daemon: Full SNMPv2c support with custom community strings
  • SSH Server: Secure access with multiple user accounts
  • System Monitoring: Real-time CPU, memory, and network metrics
  • Load Generation: Built-in stress testing for realistic monitoring data

Use Cases

  • SNMP monitoring tool development
  • Linux system administration practice
  • Network monitoring system testing
  • DevOps infrastructure simulation

Sample SNMP Queries

# System information
snmpwalk -v2c -c public localhost:161 1.3.6.1.2.1.1

# CPU and memory statistics  
snmpwalk -v2c -c public localhost:161 1.3.6.1.4.1.2021

# Network interfaces
snmpwalk -v2c -c public localhost:161 1.3.6.1.2.1.2

# Disk usage
snmpwalk -v2c -c public localhost:161 1.3.6.1.4.1.2021.9

🌐 MikroTik Router Lab

A complete MikroTik RouterOS environment with web management interface:

RouterOS Features

  • Real MikroTik CHR: Authentic RouterOS experience
  • Complete SNMP Support: Standard + Enterprise MIBs
  • Multiple Interfaces: Ethernet, wireless, VPN capabilities
  • Routing & Firewall: Full networking feature set
  • User Management: PPP, Hotspot, DHCP user control

Web Management Interface

Built with Flask and Bootstrap 5, featuring:

  • Dashboard: System health, interface status, user analytics
  • User Management: PPP/Hotspot user administration
  • Monitoring: Real-time bandwidth and system metrics
  • Security: Session-based auth with CSRF protection
  • Mobile Responsive: Works on all devices

Monitoring Integration Examples

The lab includes ready-to-use configurations for:

  • Zabbix: Templates and host configurations
  • PRTG: Sensor definitions and device setup
  • LibreNMS: Device discovery and monitoring setup
  • Prometheus: SNMP exporter configuration
  • Nagios: Service checks and host definitions

πŸ“Š SNMP OID Reference

πŸ–₯️ Linux Server OIDs

System Information:
β”œβ”€β”€ 1.3.6.1.2.1.1.1.0     # System description
β”œβ”€β”€ 1.3.6.1.2.1.1.3.0     # System uptime
└── 1.3.6.1.2.1.1.5.0     # System name

CPU & Memory (UCD-SNMP-MIB):
β”œβ”€β”€ 1.3.6.1.4.1.2021.11.9.0   # CPU user %
β”œβ”€β”€ 1.3.6.1.4.1.2021.11.10.0  # CPU system %
β”œβ”€β”€ 1.3.6.1.4.1.2021.4.5.0    # Total RAM
└── 1.3.6.1.4.1.2021.4.6.0    # Available RAM

Network Interfaces:
β”œβ”€β”€ 1.3.6.1.2.1.2.2.1.2      # Interface descriptions
β”œβ”€β”€ 1.3.6.1.2.1.2.2.1.8      # Interface status
β”œβ”€β”€ 1.3.6.1.2.1.2.2.1.10     # Bytes in
└── 1.3.6.1.2.1.2.2.1.16     # Bytes out

🌐 MikroTik Router OIDs

System Health:
β”œβ”€β”€ 1.3.6.1.4.1.14988.1.1.3.10.0    # CPU usage
β”œβ”€β”€ 1.3.6.1.4.1.14988.1.1.3.11.0    # Memory usage
β”œβ”€β”€ 1.3.6.1.4.1.14988.1.1.3.12.0    # Disk usage
└── 1.3.6.1.4.1.14988.1.1.3.13.0    # Temperature

Interface Statistics:
β”œβ”€β”€ 1.3.6.1.4.1.14988.1.1.1.1.1.2   # Interface names
β”œβ”€β”€ 1.3.6.1.4.1.14988.1.1.1.1.1.3   # Interface types
β”œβ”€β”€ 1.3.6.1.4.1.14988.1.1.1.1.1.6   # RX bytes
└── 1.3.6.1.4.1.14988.1.1.1.1.1.7   # TX bytes

User Management:
β”œβ”€β”€ 1.3.6.1.4.1.14988.1.1.5.1.1.2   # PPP user names
β”œβ”€β”€ 1.3.6.1.4.1.14988.1.1.5.1.1.4   # PPP user status
└── 1.3.6.1.4.1.14988.1.1.6.1.1.2   # Hotspot users

πŸ”§ Configuration Examples

πŸ“Š Zabbix Integration

<!-- Host configuration for MikroTik Router -->
<host>
    <name>MikroTik Lab Router</name>
    <interfaces>
        <interface>
            <ip>172.20.0.3</ip>
            <port>161</port>
            <type>SNMP</type>
        </interface>
    </interfaces>
    <templates>
        <template>Template Net MikroTik SNMPv2</template>
    </templates>
</host>

πŸš€ Prometheus Configuration

# prometheus.yml
scrape_configs:
  - job_name: 'mikrotik-snmp'
    static_configs:
      - targets:
        - 172.20.0.3  # MikroTik router IP
    metrics_path: /snmp
    params:
      module: [mikrotik]
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: localhost:9116  # SNMP exporter address

πŸ” LibreNMS Discovery

# Add device to LibreNMS
./addhost.php 172.20.0.3 public v2c

# Force discovery
./discovery.php -h 172.20.0.3

# Poll device
./poller.php -h 172.20.0.3

πŸ§ͺ Testing and Validation

πŸ”¬ Automated Testing Scripts

Linux Server Testing

cd "Linux Server Lab"
./test-lab.sh

MikroTik Router Testing

cd "Mikrotik Router Lab"
./test-snmp.sh          # SNMP functionality test
./generate-traffic.sh   # Traffic generation for monitoring

πŸ“‹ Manual Testing Procedures

SNMP Connectivity Test

# Test basic SNMP connectivity
snmpget -v2c -c public localhost:161 1.3.6.1.2.1.1.1.0

# Test community string
snmpwalk -v2c -c public localhost:161 1.3.6.1.2.1.1

# Test wrong community (should fail)
snmpwalk -v2c -c wrong localhost:161 1.3.6.1.2.1.1

SSH Functionality Test

# Test SSH connectivity
ssh -o ConnectTimeout=5 -p 2222 root@localhost 'uptime'

# Test user authentication
ssh -o ConnectTimeout=5 -p 2222 labuser@localhost 'whoami'

Web Interface Test

# Test web interface availability
curl -I http://localhost:8000
curl -I http://localhost:5000

# Test HTTPS (ignore cert warnings)
curl -k -I https://localhost:8443

πŸ”§ Customization Guide

βš™οΈ Environment Variables

Linux Server Lab

# Edit docker-compose.yml environment section
environment:
  - SSH_ROOT_PASSWORD=your_password
  - SNMP_COMMUNITY=your_community
  - CONTAINER_TIMEZONE=America/New_York

MikroTik Router Lab

# Create .env file
echo "ROUTER_PASSWORD=your_admin_password" > .env
echo "SNMP_COMMUNITY=your_community" >> .env
echo "WEB_PORT=8080" >> .env

πŸ”§ Custom SNMP Configuration

# Edit Linux server SNMP config
vim "Linux Server Lab/config/snmpd.conf"

# Edit RouterOS initial config
vim "Mikrotik Router Lab/config/initial-config.rsc"

🌐 Network Configuration

# Custom network settings in docker-compose.yml
networks:
  netmon-lab:
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 172.20.0.0/24
          gateway: 172.20.0.1

🚨 Troubleshooting

πŸ” Common Issues

Port Conflicts

# Check for port conflicts
sudo netstat -tulpn | grep -E ":(161|2222|8000|5000)"

# Stop conflicting services
sudo systemctl stop snmpd  # If SNMP is running on host

Container Not Starting

# Check container logs
docker-compose logs mikrotik
docker-compose logs server

# Rebuild containers
docker-compose down
docker-compose up -d --build --force-recreate

SNMP Not Responding

# Check SNMP service in container
docker exec -it mikrotik-router /system health print
docker exec -it netmon-server systemctl status snmpd

# Test from inside container
docker exec -it mikrotik-router ping 8.8.8.8

Web Interface Issues

# Check Flask application logs
docker-compose -f "Mikrotik Router Admin Website/docker-compose.yml" logs

# Restart web interface
cd "Mikrotik Router Admin Website"
docker-compose restart

πŸ› οΈ Performance Optimization

Resource Allocation

# Add resource limits to docker-compose.yml
services:
  mikrotik:
    deploy:
      resources:
        limits:
          memory: 1G
          cpus: '1.0'
        reservations:
          memory: 512M
          cpus: '0.5'

Persistent Storage

# Add volumes for data persistence
volumes:
  - ./data/mikrotik:/opt/routeros
  - ./logs:/var/log

πŸ“š Educational Resources

πŸŽ“ Learning Objectives

  • SNMP Protocol Understanding: Learn OIDs, communities, and MIB structures
  • Network Monitoring: Implement monitoring solutions with real devices
  • RouterOS Administration: Master MikroTik configuration and management
  • Docker Networking: Understand containerized network environments
  • System Administration: Practice Linux and network device management

πŸ“– Recommended Reading

πŸ”— Useful Tools

🀝 Contributing

We welcome contributions to improve this network monitoring lab suite!

πŸ“ How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ› Reporting Issues

Please use the GitHub Issues tab to report:

  • Bug reports with detailed reproduction steps
  • Feature requests with clear use cases
  • Documentation improvements
  • Performance issues

πŸ’‘ Ideas for Contributions

  • Additional monitoring tool integrations
  • New OID examples and use cases
  • Performance optimizations
  • Security enhancements
  • Additional test scenarios
  • Documentation translations

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • MikroTik for providing excellent network equipment and RouterOS
  • Docker Community for containerization tools and best practices
  • Net-SNMP Project for SNMP implementation and tools
  • Flask Community for the excellent web framework
  • Bootstrap Team for the responsive UI framework

πŸ“ž Support

If you encounter any issues or need help with the lab setup:

  1. πŸ“– Check the documentation in each lab's README
  2. πŸ” Search existing GitHub Issues
  3. πŸ› Create a new Issue with detailed information
  4. πŸ’¬ Join the discussion in the repository

Made with ❀️ for network administrators, developers, and students worldwide

Transform your network monitoring skills with real-world lab environments!

About

🌐 PacketPatrol β€” A comprehensive Docker-based network monitoring laboratory environment featuring real MikroTik RouterOS instances and Linux servers configured for SNMP monitoring, network administration training, and system monitoring development.

About

🌐 PacketPatrol β€” A comprehensive Docker-based network monitoring laboratory environment featuring real MikroTik RouterOS instances and Linux servers configured for SNMP monitoring, network administration training, and system monitoring development.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages