A Raspberry Pi-based network security system that monitors, detects, and blocks suspicious IoT devices on your home network.
Turn your Raspberry Pi into a network security shield:
- π Scans your network for IoT devices (cameras, sensors, smart bulbs, etc.)
- π€ Identifies devices automatically using MAC vendor lookup and port scanning
- π Alerts you when new or suspicious devices appear
- π« Blocks threats at the DNS/DHCP level via Pi-hole integration
- π Monitors traffic in real-time with visual dashboards
Your Network
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββ
β Raspberry Pi β
β βββββββββββββββββββββββββββββββββββββ β
β β Edge AI IoT Security Center β β
β β β’ Scans for devices β β
β β β’ Detects IoT types β β
β β β’ Monitors behavior β β
β β β’ Blocks suspicious devices β β
β βββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββ β
β β Pi-hole DNS β β
β β β’ Blocks ads network-wide β β
β β β’ Blocks malicious devices β β
β βββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββ
- Real network scanning using ARP and ping
- Automatic MAC vendor identification (RaspberryPi, ESP, Apple, Xiaomi, etc.)
- IoT device type detection (sensors, cameras, smart devices)
- Background scheduled scanning
| Action | What Happens | Use Case |
|---|---|---|
| Approve | Device is trusted and monitored | Known devices |
| Quarantine | Device gets IP but traffic is blocked | Investigate suspicious device |
| Block | Device is denied network access | Known threat |
- Blocks devices at DNS level (can't access internet)
- Optional DHCP blocking (device gets no IP at all)
- Works with Pi-hole v6 API
- π In-app notification bell
- π² Webhook support (Discord, Slack, Home Assistant)
- Alerts for: new devices, offline devices, auto-blocks
git clone https://github.com/tkv-04/EdgeAISecurev2.git
cd EdgeAISecurev2
npm install
cp .env.example .env
cat > .env << EOF
DATABASE_URL=postgresql://postgres:password@localhost:5432/edgeaisecure
PORT=5000
NODE_ENV=development
EOF
curl -sSL https://install.pi-hole.net | sudo bash
sudo pihole setpassword 'your-password'
npm run dev
http://localhost:5000
Login: admin@iot.local / admin123
| Variable | Description | Default |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | Required for DB mode |
PORT |
Server port | 5000 |
NODE_ENV |
Environment (development / production) |
development |
- Go to Settings
- Under Network Blocking, select method:
- Local - Blocks only at Pi level
- Pi-hole - DNS-level blocking (recommended)
- OpenWRT - Push rules to router (if you have one)
- Enter Pi-hole credentials if using that method
- Save
- Set your router to use Pi's IP as DNS server
- Or enable Pi-hole DHCP and disable router DHCP
- All devices will then go through the Pi for DNS
- Frontend: React + TypeScript + Vite + Recharts
- Backend: Express.js + TypeScript + Drizzle ORM
- Database: PostgreSQL (flow data, traffic stats, device info)
- IDS: Suricata (network intrusion detection)
- Blocking: Pi-hole API, iptables, ARP
- Scanning: ARP, ping, port scanning
- Hardware: Raspberry Pi (tested on Pi 5)
The Pi can act as a network gateway to monitor all IoT traffic.
Internet Source
β
βΌ
βββββββββββββββ
β OpenWRT ββββββ IoT Devices
β Router β
ββββββββ¬βββββββ
β LAN
βΌ
βββββββββββββββ
β Raspberry Piβ βββ Gateway (192.168.31.217)
β (Suricata) β Monitors all traffic
βββββββββββββββ
Use the included script to configure the Pi as a gateway:
# Configure for your router
sudo ./scripts/configure-gateway.sh <router_ip> <pi_ip>
# Example: OpenWRT at 192.168.31.1, Pi at 192.168.31.217
sudo ./scripts/configure-gateway.sh 192.168.31.1 192.168.31.217
# Check status
sudo ./scripts/configure-gateway.sh 192.168.31.1 192.168.31.217 status
# Reset to DHCP
sudo ./scripts/configure-gateway.sh 192.168.31.1 192.168.31.217 resetSet Pi's IP as the gateway for IoT devices in OpenWRT:
- Go to OpenWRT β Network β DHCP
- Set Gateway to Pi's IP (e.g., 192.168.31.217)
- IoT devices will route through Pi for monitoring
Real-time network intrusion detection with Suricata:
- Flow Monitoring: Track all network flows (source, dest, protocol, bytes)
- Traffic Analysis: KB/sec graphs per device on dashboard
- Alert Detection: Security alerts from Suricata rules
- Data Persistence: 3-day retention in PostgreSQL
| Endpoint | Description |
|---|---|
GET /api/suricata/status |
Suricata running status |
GET /api/suricata/stats |
Traffic statistics |
GET /api/suricata/alerts |
Security alerts |
GET /api/suricata/traffic |
Per-device traffic data |
GET /api/flows |
Historical flow events |
GET /api/flows/:ip |
Flows for specific IP |
βββ server/
β βββ network-scanner.ts # Device discovery
β βββ network-block.ts # Blocking logic
β βββ suricata-service.ts # Suricata EVE reader
β βββ notification-service.ts
β βββ storage.ts # Database operations
β βββ routes.ts # API endpoints
βββ client/
β βββ src/pages/
β βββ dashboard.tsx # Traffic graphs
β βββ devices.tsx # Device management
β βββ monitoring.tsx # Live monitoring
β βββ settings.tsx # Configuration
βββ scripts/
β βββ configure-gateway.sh # Gateway setup script
βββ shared/
β βββ schema.ts # Database schema
βββ README.md
| Table | Purpose | Retention |
|---|---|---|
devices |
Discovered network devices | Permanent |
flow_events |
Suricata flow data | 3 days |
traffic_data |
KB/sec per device | Permanent |
alerts |
Security alerts | Permanent |
logs |
System event logs | Permanent |
- Raspberry Pi (tested on Pi 5)
- Node.js 18+
- PostgreSQL
- Suricata (for IDS features)
- Pi-hole (optional, for DNS blocking)
- Real device discovery
- Notification system
- Pi-hole integration
- Zone-based blocking (quarantine vs block)
- Suricata IDS integration
- Flow data persistence (3-day retention)
- Gateway configuration script
- Traffic graphs (KB/sec per device)
- Edge AI anomaly detection model
- Mobile app
MIT
Built for securing home IoT networks with a Raspberry Pi.