Ubiquiti Unifi Controller on FreeNAS

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,974
If you're just changing what you're running the controller on you shouldn't have to do a site migration. I started running the controller software on my windows desktop and after I got it installed in the jail I just uploaded the database backup from the old setup to the new install and everything just worked.
 
Joined
Jul 2, 2019
Messages
648
If you're just changing what you're running the controller on you shouldn't have to do a site migration. I started running the controller software on my windows desktop and after I got it installed in the jail I just uploaded the database backup from the old setup to the new install and everything just worked.
So did I. I moved from a docker version running on Synology to one running on a Ubuntu VM. Then to the FreeNAS (at the time) plug-in. Then back to a Ubuntu VM when I found that the FreeNAS plug-in was lagging way behind the official controller.

I did it each time I did it I backed up my configuration and then uploaded the config to the new install. I did keep the same IP as the controller.
 

kiriak

Contributor
Joined
Mar 2, 2020
Messages
122
I’m open to trying something more difficult as long as I have a strategy to go back. I just dealt with a big headache re-adopting hardware from an old controller I didn’t have access to anymore. In hindsight it was a simple problem, but it was hard to find the solution (USG had to be updated before it would adopt).

It looks like I have to be on 6 if I don’t want to go through that whole process again.


once, because of changing versions of Unifi Controller, during migration from one server to another,
there was no way for the mew controller to "see" my AP, despite having a backup and despite resetting the AP to factory defaults

and the following 30 second solution, saved my day

https://sites.google.com/site/altwhy/wiki/ssh-reset-adopting-unify-ap
 

Netdewt

Explorer
Joined
Jan 19, 2021
Messages
98
Unifi6 is not available as a package. If you want it you'll have to install the port and I wouldn't recommend that to most new users without an installation guide to follow.
Is this guide still accurate enough?
 

ThreeDee

Guru
Joined
Jun 13, 2013
Messages
698
Is this guide still accurate enough?
I just installed Unifi6 via ports
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,974
Is this guide still accurate enough?
Just install the package, it's a simple install and easier to keep it up to date. The install is really simple in a standard jail.

If you're not already, make sure you switch to the latest package repository. The package isn't available on the quarterly branch.

mkdir -p /usr/local/etc/pkg/repos
ee /usr/local/etc/pkg/repos/FreeBSD.conf

Copy and paste the following into the shell

Code:
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest"
}


Now install unify6.

pkg install unifi6
sysrc unifi_enable=YES
service unifi start
 

Netdewt

Explorer
Joined
Jan 19, 2021
Messages
98
Unifi6 is not available as a package. If you want it you'll have to install the port and I wouldn't recommend that to most new users without an installation guide to follow.

Oh, did it come out in the last couple weeks?
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,974
Yes, I have it installed. Read the post directly above yours for more information and installation instructions.
 

ThreeDee

Guru
Joined
Jun 13, 2013
Messages
698
Just install the package, it's a simple install and easier to keep it up to date. The install is really simple in a standard jail.

If you're not already, make sure you switch to the latest package repository. The package isn't available on the quarterly branch.

mkdir -p /usr/local/etc/pkg/repos
ee /usr/local/etc/pkg/repos/FreeBSD.conf

Copy and paste the following into the shell

Code:
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest"
}


Now install unify6.

pkg install unifi6
sysrc unifi_enable=YES
service unifi start
Unifi 6 if finally available on pkg's? well it's about freak'n time, lol.

I agree . .pkg install's are way cleaner/easier .. I'm going to nuke my port unifi6 install and do pkg install .. thanks for the heads up Jailer
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,974
Unifi 6 if finally available on pkg's? well it's about freak'n time, lol.

I agree . .pkg install's are way cleaner/easier .. I'm going to nuke my port unifi6 install and do pkg install .. thanks for the heads up Jailer
No need to nuke it. Just make sure you are on the latest package repository and use pkg upgrade to keep it up to date.
 

Netdewt

Explorer
Joined
Jan 19, 2021
Messages
98
mkdir -p /usr/local/etc/pkg/repos
ee /usr/local/etc/pkg/repos/FreeBSD.conf

Copy and paste the following into the shell

Code:
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest"
}

When I do this it tells me: unable to create file "/usr/local/etc/pkg/repos/FreeBSD.conf"
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
When I do this it tells me: unable to create file "/usr/local/etc/pkg/repos/FreeBSD.conf"
Are you doing it in the jail? Use whatever tool you want to create the file all you really need to do is create a file called FreeBSD.conf in that path. and put the correct string inside it.
 

Netdewt

Explorer
Joined
Jan 19, 2021
Messages
98
Are you doing it in the jail? Use whatever tool you want to create the file all you really need to do is create a file called FreeBSD.conf in that path. and put the correct string inside it.
Nope, I'm missing all kinds of obvious steps here. Thanks.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
Nope, I'm missing all kinds of obvious steps here. Thanks.
You need to login to your jail, either by using SSH directly into it or by using iocage console from the NAS system.
 

Netdewt

Explorer
Joined
Jan 19, 2021
Messages
98
Ok, I hadn't even made a jail. I am confusing plug-in, package, and ports. I'm just glad you guys haven't kicked me out of here yet.

Clone Jail, same release as main OS? If I use my second ethernet connection (2 of them on this mb), then I don't need to enable NAT and VNET, right?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
I prefer base jails over clone jails but for one single jail it doesn't make much of a difference. Same OS release, yes. You need VNET specifically if you want to use your second ethernet interface.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
@Netdewt Some more info about VNET and some hints to get that second interface to work. I assume you want this connected to the same network, just dedicated to jail traffic, correct?

VNET means your jail gets its own network stack, interfaces, addresses, routing, even firewall if desired. All virtualised. This is what you want in most cases in 2021. Specifically for services that are supposed to be available on your network independent of the NAS - like a Unifi controller.

The default setup "binds" the jail's interface to your main one. Behind the scenes TrueNAS/FreeBSD/iocage will create a bridge interface that has your physical port as one member and each jail's virtual interface as another one. Just letting the default magic work creates some problems with IPv6 and "scopes", so I try to avoid it. Most users never notice, though.

To do a proper setup in line with FreeBSD documentation we need to create the bridge interface in advance. So to use your second network port:
  • go to Network --> Interfaces --> edit your second unused interface
  • check "Disable Hardware Offloading"
  • add "up" into the options field
  • save and apply
This interface serves solely as a layer 2 connect, so it doesn't need an IP address. Without an IP address we need to tell FreeBSD to activate it - which is done implicitly with an address. Hence the "up".

Then
  • again ... Interfaces, click "Add"
  • add an interface of type "Bridge"
  • add the physical interface as the bridge member
  • save and apply
In your jail settings
  • change the "auto" in vnet_default_interface to "none"
  • configure IP address, netmask and default gateway
  • down in the network settings set interfaces to "vnet0:<your bridge you just created>"
My setting is "bridge100" which is the bridge connected to VLAN 100 in my network ... just a name that I picked.

That should do it.

Bildschirmfoto 2021-03-08 um 21.14.05.png Bildschirmfoto 2021-03-08 um 21.14.24.png
 

Netdewt

Explorer
Joined
Jan 19, 2021
Messages
98
OK, I got to pkg install unifi6

And I get this:
Code:
root@unifi:~ # pkg install unifi6
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/latest, please wait...
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:12:amd64/latest/Latest/pkg.txz: No address record
Address resolution failed for http://pkg.FreeBSD.org/FreeBSD:12:amd64/latest.
Consider changing PACKAGESITE.


What's wrong?
I browsed here and the address seems right.
 
Last edited:

ThreeDee

Guru
Joined
Jun 13, 2013
Messages
698
OK, I got to pkg install unifi6

And I get this:
Code:
root@unifi:~ # pkg install unifi6
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/latest, please wait...
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:12:amd64/latest/Latest/pkg.txz: No address record
Address resolution failed for http://pkg.FreeBSD.org/FreeBSD:12:amd64/latest.
Consider changing PACKAGESITE.


Ideas on what's wrong?
in your newly created jail's shell run:

Code:
mkdir -p /usr/local/etc/pkg/repos
ee /usr/local/etc/pkg/repos/FreeBSD.conf


copy the following:
Code:
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest"
}

..and paste it into the FreeBSD.conf file (Shift + Insert keys)

hit esc and follow directions to save and quit (I think you just hit "a" at the prompts)

then run:
Code:
pkg update && pkg upgrade
pkg install unifi6
sysrc unifi_enable=YES
service unifi start


this is all found in Jailer's thread here
 

Netdewt

Explorer
Joined
Jan 19, 2021
Messages
98
Somehow pkg update && pkg upgrade was left out of the code above. Thanks.
 
Top