Setting up a Ubiquiti Network

This may sound crazy, but believe it or not, I am an IT professional. But my home network doesn't really show that. I have a Dlink can router/ap running dd-wrt. DNS is managed by a pi-hole (That is also my dhcp server) but otherwise, I have crappy wifi, and a router that overheats and bogs down my connection.

Well not anymore. I purchased a Ubiquiti EdgeRouter-X and Unifi acces point. Finally, I'll have some semi-professional gear. I've used Ubiquiti in the past and I must say it's very nice, and fairly easy to set up, espeically if you spring for the Cloud Key. In my home use case, I didn't really want to, so I wanted to try running it on my pi-hole, which just sits around doing nothing most of the day (and will still do nothing MOST of the day).

The EdgeRouter

This is probably easiest part of the whole thing. For such a simple deployment as my home, there's not much configuration to do. Drop all packets coming in, allow all going out. Use the pihole as a DNS and DHCP server. Not much to it. If you were looking for a more in-depth walkthrough of how to do this, I'm sorry but it probably wouldn't be as useful as Ubiquiti's Beginners Guide.

Installing Unifi on a Raspberry Pi 3

Setting it up

Should be easy, right? Just follow the instructions for Debian, right? Well... Yeah, the first thing you need to do is install UniFi. I just grabbed the deb from Ubiquiti, because I don't much care for adding PPAs, &c. The install was fairly easy, dpkg -i unifi.deb, but that's where the trouble began.

The service just would not start. And there were no error messages printed to the console. What to do?

From this post I got the following:

# apt install oracle-java8-jdk -y
# update-alternatives --config java

Whether this helped or not in the end, I can't say. I continued using Oracle's Java instead of OpenJava, but I don't think it would matter.

As of right now, I absolutely cannot get the service to work properly. I have tried editing /usr/lib/unifi/bin/unifi.init and setting the JVM_MAX_HEAP_SIZE and JVM_INIT_HEAP_SIZE variables, I have tried setting unifi.xms in system.properties (By the way, I don't know if I believe that doing anything in that file has any effect if it doesn't already exist), and nothing.

BUT there is a light at the end of the tunnel. If I create the jvm myself, Iit will run. I can do the following:

java -Xmx512M -jar /usr/lib/unifi/lib/ace.jar start

The controller starts, and all is well! Not sure why I can't just make the unifi service create a usable jvm, but I'll try opening a ticket with ubnt tomorrow.

Extra thanks to osunifi at the community.ubnt.com forums. It was their comment about Java using too much memory that lead me to that command to start the JVM manually. https://community.ubnt.com/t5/UniFi-Wireless/NOTICE-UniFi-Controller-Memory-Usage-5-6-20/m-p/2268804/highlight/true#M282524

Final Thoughts

I'd say don't do this... Even with my workaround above, the JVM crashes after a few hours (Maybe less? I actually don't check it frequently) so I'm currently living without a cloudkey. That's fine, since nothing changes in my environment, but I have no monitoring or insight into my WiFi. Anyway, if you're mad enough to try to follow in my footsteps, I hope this helped. If you want to discuss it with me, reach out to me any way you see fit.

If you want a UniFi setup in your home, I'd say just buy the damn cloudkey or put it on a server with a minimum of 2GB of RAM.

ubiquiti-unifi.md | Last Edited 2019-04-25 | Cleaned up some of the sections and added final thoughts.

All content unless otherwise noted © 2019 Robert D Herb CC-BY-SA
Powered by ssg and OpenBSD