Quick start
About 951 words
This tutorial takes you from a fresh installation to a signed-in context, a look at your clients and switch ports, and the live dashboard. It takes a few minutes and assumes unifi is on your PATH (see Installation).
The whole tutorial in twenty seconds, recorded against the demo controller.
Pick one of three ways to sign in. The first needs no hardware at all.
Sign in
Option A: the demo controller
The repository ships a mock controller with a hand-built home-lab data set: a gateway, three switches and a fourth waiting for adoption, four access points, 48 clients and two sites. Start it with Docker from a checkout of the repository:
docker compose up -d --build --wait unifi-mockIt listens on https://localhost:8443, reachable from your machine only, with a self-signed certificate like a console has out of the box, and it accepts the API key demo-api-key. The mock makes a new certificate every time it starts, so this is the one place where skipping verification is the practical choice:
$ UNIFI_API_KEY=demo-api-key unifi login --local \
--address https://localhost:8443 --insecure-skip-tls-verify --name demo
✓ Signed in. The context "demo" is ready.
Controller https://localhost:8443
Site Default
Account demo (local)
API key stored in the keyring credential store
Current context demoEvery example in this documentation was captured against this controller, so your output should match line for line. The demo guide describes what the data set contains.
Option B: a console on your network
Open the UniFi Network application on your console and go to Settings → Control Plane → Integrations.
Create an API key and copy it; the console shows it only once.
Run the sign-in and paste the key when asked:
unifi login --local --address https://192.168.1.1
Consoles ship with a certificate your machine doesn't trust. The sign-in shows its SHA-256 fingerprint and offers to pin it, which means unifi-cli trusts exactly that certificate for this console from then on; compare the fingerprint with the one the console's web interface shows and accept. The login guide explains the alternatives.
Option C: your UI account, through the cloud
- Open unifi.ui.com, go to Settings → API Keys, and create a key.
- Run
unifi loginwithout flags and follow the prompts.
unifi login checks the key against the Site Manager API, lets you choose the console and its default site, and creates a context for it. A cloud context works from anywhere because requests travel through Ubiquiti's cloud connector.
Check where you are
$ unifi ctx get
NAME ACCOUNT TYPE CONTROLLER SITE
→ demo demo local demo DefaultThe arrow marks the current context, which every command uses unless you pass --context. unifi ctx describe goes one step further and asks the controller for its version and sites, which proves that the address, the certificate and the key all work.
List the clients
$ unifi clients get --network Servers
NAME IP CONNECTION NETWORK UPLINK EXPERIENCE DOWN UP
Home Assistant 192.168.40.20 wired Servers Core Switch #1 100% 96 kbps 140 kbps
NAS 192.168.40.10 wired Servers Core Switch #26 100% 38.4 Mbps 4.2 Mbps
Proxmox Node 1 192.168.40.11 wired Servers Core Switch #2 100% 5.2 Mbps 3.9 Mbps
Proxmox Node 2 192.168.40.12 wired Servers Core Switch #3 100% 820 kbps 610 kbps
Raspberry Pi Lab 192.168.40.30 wired Servers Office Switch #6 100% 18 kbps 11 kbps
5 clientsDrop --network Servers to see everything, or try unifi clients get --wireless --sort signal. unifi clients describe nas shows one client in full, and --output json turns any of these into data for jq.
Look at the switch ports
$ unifi ports get "Core Switch" NAS
NAS port 26 of Core Switch ● Up
Port Link
Number 26 Status Up
Connector SFP+ Enabled yes
Profile All Speed 10 GbE
Native network Servers Max speed 10 GbE
Connected to NAS Duplex full
Power over Ethernet Traffic
Capable no Down 38.4 Mbps
Up 4.2 Mbps
Sent 1.8 TB
Received 912 GBPorts go by the names you gave them in the UniFi application, so NAS is the port called NAS on the device called Core Switch; the number 26 works as well. unifi ports get without arguments draws every switch as its faceplate.
On the demo controller you can change things without consequences. Power-cycle a camera; the command asks for confirmation unless you pass --yes:
$ unifi ports cycle "Core Switch" "Camera Driveway" --yes
✓ Power-cycled port 10 "Camera Driveway" of Core Switch.
→ The powered device needs a minute to boot.Open the dashboard
unifi dashboardThe dashboard is a full-screen view that refreshes every five seconds. Press 2 for the topology and 3 for the event log, tab and enter to focus and zoom a widget, ? for all keys, and q to leave. unifi dashboard --once prints a single frame instead, which is handy over SSH or in a screenshot.
Where to go from here
- Switch ports: PoE, profiles, ranges, and the safety net around uplinks.
- Settings: networks, WiFi, firewall and the rest of the configuration subjects.
- Configuration as code: export the site to YAML, review changes with
unifi diff, apply them withunifi apply. - Contexts: more than one controller, more than one site.
When you're done with the demo controller, remove the context and stop the container:
unifi logout demo --yes
docker compose down --volumes