Step 1: Take stock with ICMP/ARP (host discovery)
From a Linux box in the same VLAN as the devices (replace the range with yours):
Code: Select all
sudo nmap -sn 192.168.20.0/24
Step 2: See what announces itself
mDNS (install avahi-utils on Debian/Ubuntu):
Code: Select all
avahi-browse -art
Code: Select all
sudo nmap --script broadcast-dns-service-discovery
sudo nmap -sV --script broadcast-upnp-info
sudo nmap --script broadcast-wsdd-discover
Step 3: Test SNMP (read-only)
Install the net-snmp tools (snmp package on Debian/Ubuntu). On the device or router, create a read-only SNMPv3 user with authentication and privacy, and restrict access to your monitoring host's IP. Then, for example:
Code: Select all
snmpget -v3 -l authPriv -u ha_monitor -a SHA -A 'AUTHPASS' -x AES -X 'PRIVPASS' 192.168.10.1 1.3.6.1.2.1.1.3.0
Step 4: Ping monitoring in Home Assistant
1. Give each device a DHCP reservation or static IP (the HA docs say to do this, otherwise HA keeps pinging the old address).
2. Go to Settings > Devices & services > Add integration > Ping (ICMP), enter the host and submit.
3. You get a binary sensor (up/down). Default polling is every 30 seconds; the docs explain how to turn off the polling and drive it from your own automation if you want another interval.
Use it for the router, switches, access points, NAS, cameras and the internet (a stable address you choose) and alert when something is down for more than a few minutes, not on a single missed ping.
Step 5: SNMP sensor in Home Assistant
HA's SNMP integration is configured in YAML (platform-style entries as documented on the integration page; check the page for any changes). The docs list "version" as 1 by default and note SNMPv3 settings, so set it explicitly:
Code: Select all
sensor:
- platform: snmp
name: "Router uptime"
host: 192.168.10.1
version: "3"
username: ha_monitor
auth_key: !secret snmp_auth
auth_protocol: hmac-sha
priv_key: !secret snmp_priv
priv_protocol: aes-cfb-128
baseoid: 1.3.6.1.2.1.1.3.0
value_template: "{{ (value | int / 360000) | round(1) }}"
unit_of_measurement: "h"
Step 6: Optional presence with Nmap Tracker
The Nmap Tracker integration scans address ranges (CIDR or range notation), lets you exclude addresses and set the minimum minutes between scans. Remember the docs' warning that phones often sleep their Wi-Fi, so combine it with the HA Companion app or router-based presence. Do not set the scan interval very low on a large range.
Hardening checklist
- SNMP: v3 only, read-only, source-restricted, with strong unique keys. Disable v1/v2c and the default "public" community.
- Turn off UPnP on the router if you do not use it.
- Put cameras and cheap IoT devices on their own VLAN with no internet access unless needed, and allow only Home Assistant to reach them. Discovery that stops working is a good sign the segmentation is doing its job. Add devices by IP, or use a limited mDNS reflector.
- Document your device list, and review it every few months.
Question for the group: what is the most surprising thing you found on your network when you scanned it? Which SNMP OIDs or Ping sensors do you actually alert on?