UniFi Network Controller on Openwrt x86

Hello!
Could I ask you to help me with setup Unifi Controler on OpenWRT.
Ubiquity provides version for Debian.
But, Im not a big professional in Linux. I searched in google, but without any success. One thing that I understand, better way is to use virtual machines, but it's too late.
Is it possible to use Debian(deb) package to install it in OpenWRT?

Thank you!

I don't think openwrt is based on debian, the possible scenario that I can think of are :

  1. Running OpenWrt in virtual machine or docker, alongside with unifi controller, I've thought about that scenario but the complexity of running such system in virtualization seems not worthed it.
  2. Use Debian itself as router (and install all required software like nftables for firewall etc etc) so you can install unifi controller, which is not feasible in my opinion since that's just as "manual" as previous option.
  3. Use separate system (not exactly ideal), which I use in my setup right now, openwrt mainly as router and unifi controller on other linux system. In this case I can also install pi-hole and dns server alongside unifi controller and leave the router strictly for routing and QoS only.
  4. Using DebianWrt and install unifi controller alongside (but I don't think DebianWrt is much updated like OpenWrt).
1 Like

No, you definitely cannot install .deb packages on OpenWrt.

Anyway, I don't think I understand what you are trying to do here.

Is that a client software used to control UniFi devices? Why do you want to install it on top of OpenWrt? Shouldn't you install it on your desktop?

Or do you want to control your OpenWrt devices using that software?

You cannot install UniFi controller on your router. Use something simple like RPi for that if you really need your controller running 24x7 or install it on your desktop if you need it only for occasional configuration changes and maintenance tasks.

Is that a client software used to control UniFi devices? Why do you want to install it on top of OpenWrt? Shouldn't you install it on your desktop?

I assume he want to install Unifi Controller alongside OpenWrt in his x86 build since it's powerful enough to run both I think, but it's currently impossible due to different environment.

Unifi Controller is a controller to all unifi devices which is connected by API so each devices doesn't have to run web server (which is lighter). Usually it's installed in desktop for fire and forget management, but there are some cases where unifi controller installed in mini server or stand alone device for cloud based management and other function like hotspot control.

I once had similar thought of putting both OpenWRT with unbound dns server, pi-hole, and unifi controller in one device like Raspberry Pi 4 4 - 8 Gb, But looks like currently not feasible.

runs from debian chroot ~1% cpu and ~200M ram

2 Likes

Unifi Controller is a commercial product supported by Ubiquity. You should probably ask them how to use it.

I found myself also wanting to run Unify off my openwrt router today, there mkght be better solutions than this already though

I haventy tried this myself but this guy got it running on a Pi4 apparently

Copy and pasted from this link:
https://www.cricalix.net/2021/11/13/unifi-controller-on-openwrt-on-a-pi4/

Unifi controller on OpenWRT (on a Pi4)

«

2021-11-13

»

It turns out that it’s not too hard to get the Unifi Controller software to work on OpenWRT. “Not too hard” is a relative term, mind you. You can’t install it on the base OS, but since OpenWRT provides LXC in the form of “lxc v1”, a container can be set up running something like Debian (officially supported distro for the controller package). An alternative would be Docker, either building your own docker image, or using one provided by LinuxServer. After trying the Docker route and failing to get the networking to work in the way I wanted, I switched to LXC.

Basic setup was

  • Via LuCI, I installed the luci-app-lxc package and a few other lxc-* tools (like lxc-destroy)
  • No network changes were needed
  • Mount a USB stick on /srv/lxc, formatted ext4
  • Used the UI to create a new LXC container from Debian Buster
  • Edited the config file to enable veth networking, and mapped the veth network to br-lan
  • Booted the container, installed wget
  • Used the latest script from AmazedMender16 to do the controller installation. Args were --skip-swap --local-controller --own-certificate (didn’t want to deal with LetsEncrypt for a local-only UI)

Container config:

lxc.include = /usr/share/lxc/config/common.conf
lxc.arch = linux64

# Container specific configuration
lxc.rootfs.path = dir:/srv/lxc/unifi/rootfs
lxc.uts.name = unifi

# Network configuration
lxc.net.0.type = veth
lxc.net.0.name = eth0
lxc.net.0.link = br-lan
lxc.net.0.flags = up

The benefit of the veth configuration is I can access the container from the LAN without issue; it’s bridged onto the OpenWRT br-lan interface, ensuring it’s protected by the firewall etcetera. I also get full IPv4 and IPv6 connectivity, DHCPing from the OpenWRT installation automatically. With Docker, I was bashing my head against host vs bridge networking and routing, and couldn’t get macvlan to behave at all.

Once the script was finished, it was a simple matter of setting up the controller software (local username/password only please), factory resetting the APs (because they were owned/managed by an installation of the controller that I don’t have any more), and putting back my wireless configuration (which is basically defaults). Were I to use the “login with cloud account” option, then the reset business wouldn’t be needed, but I don’t need that functionality.
"

2 Likes

I have used qemu to host completely independent VMs under OpenWrt running on the bare metal. lxc is probably a better choice though.

use a dockerized unifi controller. that's the easiest approach imho.

3 Likes

Instructions for running UniFi Network Controller via docker. This method uses IPvlan network to skip port forwarding and not to run controller on the host network either (docker's --net=host).

  1. Install docker and IPvlan module: opkg install docker dockerd kmod-ipvlan
  2. Setup IPvlan docker network:
docker network create -d ipvlan \
  --subnet <lan subnet, e.g. 10.33.33.0/24> \
  --gateway <lan gw (probably ip of the your openwrt router), e.g. 10.33.33.1> \
  -o parent=br-lan \
  ipvlan
  1. Prepare directories for unifi controller: mkdir -p /opt/unifi/data /opt/unifi/log
  2. Start unifi controller inside a container
docker run -d --init \
  --restart=unless-stopped \
  -e TZ='<your timezone in Olson format, e.g. Europe/Paris>' \
  -v /opt/unifi:/unifi \
  --user unifi \
  --name unifi \
  --network ipvlan \
  --ip <pick an IP within your LAN subnet, but outside of DHCP range, e.g. 10.33.33.2> \
  jacobalberty/unifi:v8.0.26

Hope this helps future readers.