Hey all,
Like many of you I run UniFi APs and switches but use my own router (OPNSense in my case). The one thing that always bugged me was the missing gateway in the UniFi controller. No topology, no WAN stats, just a hole where a USG should be.
Thanks to the brilliant efforts of others before me, the inform protocol got reversed-engineered. Some work started to get a working emulator but nothing concrete materialized over the last ten years. Sadly, lots of abandoned projects.
A reddit post recently reminded me of this topic and after looking back and seeing nothing, I decided to take a stab at it.
I've been working on a small daemon that emulates a UGW3. It speaks the actual inform protocol (TNBU binary, AES encryption, the whole thing) so the controller genuinely thinks there's a USG on the network. You get interface stats, traffic counters, connected clients, DHCP leases, CPU/mem, latency, all showing up in the dashboard like a real gateway.
It currently runs on:
- Linux (Debian, Ubuntu, RHEL, etc.) - apt/dnf repos available
- FreeBSD / OPNSense / pfSense - pkg repo available
- OpenWRT - opkg repo available
- Docker - if you just want to throw it on whatever box
- There are also standalone binaries (x86_64, ARM64, ARMv7) if you don't want to mess with Python.
Setup is basically: install, point it at your controller's inform URL, adopt it like any other device, and run. The config file just maps your real interfaces (like eth0, br-lan, whatever) to the emulated USG ports.
It supports dnsmasq, ISC dhcpd, and KEA lease formats out of the box. Platform-specific stuff (ARP tables, routing, neighbors) is handled automatically based on your OS.
It is still a work in progress. I'm working on deeper API integrations for OPNSense and OpenWRT so it can pull richer data (per-device traffic from Netflow, manufacturer info from ARP, etc.) and eventually push config back from the controller to the router (DHCP reservations, port forwards, DNS overrides).
Repo: https://github.com/amd989/unifi-gateway
Would love for people to try it out and let me know what breaks. Issues and PRs welcome.
(https://private-user-images.githubusercontent.com/1676879/571014728-a3226241-1494-4133-a42a-0afa1e37510f.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ4OTUyMzcsIm5iZiI6MTc3NDg5NDkzNywicGF0aCI6Ii8xNjc2ODc5LzU3MTAxNDcyOC1hMzIyNjI0MS0xNDk0LTQxMzMtYTQyYS0wYWZhMWUzNzUxMGYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDMzMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjAzMzBUMTgyMjE3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzNiODE4MzU1NzIzOTFkNTU4NWM5NzJlM2Y2ZTA3ZjQ3ZWYxNDZkNjZmMTQ1MGFhN2M3MWQ2NTFjYmI1MGYwNyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.UZjPvATdaUlh75t9KzhybO-eJYQA3fim7zNzxTJvPtQ)
Disclaimer: I've used AI code assisting tools to get well ahead I would have done on my own, so if that doesn't rock your boat, just skip this one.
Why do you want the USG in your UniFi Controller while all USG models are declared EOL officially and should be avoided since about 1 year ago ?!
I have replaced mine with OPNsense and I don't really miss it to be honest :)
But then again pfSense/OPNsense or the USG or simply use my xDSL Modem/Router from DrayTek with GlassFiber too was something I considered a long time ago anyway so you could say I am a bit biased...