Must have packages for OpenWRT

From Jwiki


Introduction

OpenWrt is a powerful, flexible Linux-based firmware for routers and embedded devices. Its package system allows you to extend your device’s functionality with a wide range of software. This page introduces several handy packages for advanced network management, monitoring, and troubleshooting.

Installed Packages Overview

The following packages are recommended for enhanced routing, traffic management, monitoring, and system diagnostics:

  • pbr & luci-app-pbr:
 Policy-Based Routing (PBR) enables you to define granular rules for directing specific traffic through different WAN interfaces or VPNs. The luci-app-pbr package provides an easy-to-use web interface for configuring these policies.
  • luci-app-sqm:
 Smart Queue Management (SQM) helps reduce bufferbloat and keeps latency low, especially on congested connections. The LuCI app allows you to easily configure and monitor SQM from the web interface.
  • luci-app-nlbwmon:
 Netlink Bandwidth Monitor (nlbwmon) tracks per-host network usage and presents bandwidth statistics over time through the LuCI web interface. This is useful for monitoring which devices consume the most data.
  • irqbalance:
 A background daemon that distributes hardware interrupts across multiple CPU cores for better performance on multi-core routers and virtualized environments.
  • tcpdump:
 A powerful command-line packet analyzer for capturing and inspecting network traffic.
  • htop:
 An interactive process viewer for monitoring CPU, memory, and running processes.
  • iftop:
 A real-time bandwidth monitor that displays network usage per connection.
  • prometheus-node-exporter-lua:
 Lightweight Prometheus Node Exporter written in Lua, providing system metrics (CPU, RAM, network, etc.) over HTTP for Prometheus scraping and monitoring.

Installation and Enabling irqbalance

To install all recommended packages and enable irqbalance, run:

opkg update
opkg install pbr luci-app-pbr luci-app-sqm luci-app-nlbwmon irqbalance tcpdump htop iftop prometheus-node-exporter-lua

# Enable irqbalance in the config file
echo "config irqbalance 'irqbalance'
        option enabled '1'" > /etc/config/irqbalance

# Start and enable irqbalance service
/etc/init.d/irqbalance enable
/etc/init.d/irqbalance start

Package Details

Package Overview
Package Description Web Interface
pbr, luci-app-pbr Advanced policy-based routing for directing traffic by rules (e.g., by IP, port, protocol). Yes
luci-app-sqm Smart Queue Management to reduce bufferbloat and improve latency. Yes
luci-app-nlbwmon Per-host bandwidth monitoring and usage statistics. Yes
irqbalance Distributes hardware interrupts across CPU cores for better multi-core performance. No
tcpdump Command-line packet capture and analysis tool. No
htop Interactive system resource monitor. No
iftop Real-time bandwidth usage per connection. No
prometheus-node-exporter-lua Exports system metrics for Prometheus monitoring (CPU, RAM, network, etc.). No

Quick Usage Tips

Policy-Based Routing (PBR)
Configure routing rules via LuCI: Network → PBR - Policy-Based Routing.
Direct specific devices or traffic types through VPNs or alternate WANs.
SQM
Enable and configure via LuCI: Network → SQM QoS.
Set download/upload rates slightly below your actual speeds for best results.
Bandwidth Monitoring
View per-host usage via LuCI: Status → Bandwidth Monitor (requires luci-app-nlbwmon).
IRQ Balance
After enabling irqbalance, check interrupt distribution with:
  cat /proc/interrupts
You should see interrupts handled by multiple CPU cores.
Traffic Analysis
Capture packets:
  tcpdump -i <interface> -ne
Replace <interface> with your WAN or LAN interface name.
System Monitoring
Run htop or iftop from the command line for live system and network stats.
Prometheus Node Exporter
After installing prometheus-node-exporter-lua, metrics are available at:
http://<router-ip>:9100/metrics
Add your router as a scrape target in your Prometheus server configuration.