Skip to content

OpenWrt

Is an Operating System based on Linux for network router devices. Few devices I own that can run it: Raspberry Pi, Xiaomi AX3200, TP-Link TL-WR841N

Hardware

  • Check the Table of Hardware
  • Annotation is RAM/ROM
    • 4/32 is deprectiated
    • 8/64 will be soon (in ~2023)
    • 16/128 is recommended
  • Possibilities

Generic x86/64 (VM)

  • Follow this guide to install on VirtualBox
  • After LAN setup, the LUCi interface is available on 192.168.56.2

Software

  • Build custom builds using OpenWrt ASU
  • Additional packets
  • Get logs by using logread

WAN

  • Bridge is impossible to do on some routers (like Livebox 5)
  • Workaround: firewall to Low and DMZ to the OpenWrt box

WLAN

IoT Network without internet access

  • Create an additional Wi-Fi network
  • Use the same zone than you main network
  • Define an additional firewall rule to prevent the connection to internet - Guide
    1. Navigate to LuCI → Network → Firewall → Traffic Rules.
    2. Click Add and specify:
      • Name: Filter-Parental-Controls
      • Protocol: Any
      • Source zone: lan
      • Destination zone: wan
      • Action: reject
    3. (Optional) If you want to add a MAC or IP limitation, on the Advanced Settings tab specify:
      • Source MAC address: 00:11:22:33:44:55
      • Source IP address: 192.168.1.2
    4. Click Save, then Save & Apply.

Interfaces

Default IPv6 configuration

  • Interface → LAN
    • Advanced Settings
      • IPv6 Assignment Lenght: 60
    • DHCP Server - IPv6 Settings
      • NDP-Proxy: disabled

Statistics in Home Assistant

  • See OpenWRT Metrics & Automations with Home Assistant - Jon Brito
  • Setup statistics collection
    • opkg update
    • opkg install luci-app-statistics collectd-mod-mqtt collectd-mod-rrdtool collectd-mod-uptime collectd-mod-conntrack collectd-mod-thermal
  • Setup MQTT server like Mosquito MQTT Broker
  • Setup MQTT client in /etc/collectd/conf.d/mqtt.conf c LoadPlugin mqtt <Plugin "mqtt"> <Publish "OpenWRT"> Host "192.168.1.xxx" # Your MQTT broker IP address Port 1883 User "openwrt" Password "YourSuperSecretPassword" ClientId "OpenWRT" Prefix "collectd" Retain true </Publish> </Plugin>
  • In Home Assistant, listen for the new MQTT topics