Settings
About 3161 words
Everything you configure under Settings in the UniFi application is a configuration subject in unifi-cli: networks, WiFi, firewall, VPN, DNS, port profiles and more. They all share one set of verbs, so this guide explains the verbs once and then walks through the subjects.
The subjects
| Subject | Manages | Kind | API |
|---|---|---|---|
networks | Networks and VLANs | Network | official |
wifi | WiFi networks (SSIDs) | WifiBroadcast | official |
firewall zones | Firewall zones | FirewallZone | official |
firewall policies | Zone-based firewall policies | FirewallPolicy | official |
firewall groups | Legacy address and port groups | FirewallGroup | internal |
acls | Switch ACL rules | ACLRule | official |
dns | Local DNS records and forward domains | DNSPolicy | official |
traffic lists | Port and IP address matching lists | TrafficMatchingList | official |
traffic rules | Traffic rules of the policy engine | TrafficRule | internal |
traffic routes | Policy-based routes | TrafficRoute | internal |
vouchers | Hotspot vouchers | Voucher | official |
port-profiles | Switch port profiles | PortProfile | internal |
port-forwards | Port forwarding rules | PortForward | internal |
routes | Static routes | StaticRoute | internal |
internet | Internet (WAN) connections | Internet | internal |
vpn servers | WireGuard, OpenVPN and L2TP servers | VPNServer | internal |
vpn clients | VPN client tunnels | VPNClient | internal |
vpn site-to-site | Site-to-site tunnels | SiteToSiteVPN | internal |
radius | RADIUS profiles | RadiusProfile | internal |
ddns | Dynamic DNS entries | DynamicDNS | internal |
known-clients | Client aliases, fixed IPs and notes | KnownClient | internal |
settings | Controller and site settings | Setting | internal |
unifi resources get prints this table from the binary, and --output wide adds the API path of each kind.
The API column matters. Kinds served by the official Network Integration API have documented, versioned fields in camelCase. Kinds served by the controller's internal API use the controller's own snake_case field names, and Ubiquiti can change those between Network versions without notice. unifi-cli passes the fields through as they are, so a new field shows up without a new release, and a renamed field needs a change in your scripts and manifests.
The shared verbs
The examples use networks; every subject in the table works the same way.
get and describe
$ unifi networks get
NAME VLAN MANAGEMENT SUBNET ENABLED
Default 1 Gateway 192.168.1.1/24 yes
Guest 30 Gateway 192.168.30.1/24 yes
IoT 20 Gateway 192.168.20.1/24 yes
Management 99 Gateway 192.168.99.1/24 yes
Servers 40 Gateway 192.168.40.1/24 yes
Trusted 10 Gateway 192.168.10.1/24 yes--output wide adds columns and the object IDs. --filter and --sort work on the object's own field paths, such as --filter 'vlanId >= 20' or --filter 'enabled && name contains "guest"'.
Tables spell enumerated values the way a person would: Gateway, WPA3 Personal, Forward domain. JSON and YAML keep the controller's spelling (GATEWAY, WPA3_PERSONAL, FORWARD_DOMAIN), and that spelling is what flags and manifests take.
describe shows one object in full. For the kinds people look at most (networks, WiFi, firewall policies, port forwards, port profiles, vouchers) it's laid out in words, with references to other objects shown by name:
$ unifi networks describe IoT
IoT · Network
Site Default
ID 58aa7221-fd83-4c68-afe4-d7f9a7cd00cf
Network
VLAN 20
Managed by Gateway
Enabled yes
Default network no
Firewall zone IoT
IPv4
Gateway 192.168.20.1/24
DHCP Server · 192.168.20.100 – 192.168.20.254 · lease 12h
Domain iot.home.arpa
Access
Isolated yes
Internet access yes
mDNS forwarding no
Cellular backup yesThe other kinds list their fields under the paths that --set takes. For any kind, unifi networks get IoT --output yaml prints the complete object as the controller spells it, which is where you find field paths and the quickest way to a valid spec for create -f or unifi apply.
create
$ unifi networks create Lab --vlan 50 --subnet 192.168.50.1/24
✓ Created the network "Lab".
→ Inspect it with `unifi networks describe Lab`.Each subject has typed flags for its most common fields, and create fills in the defaults a new object needs. --subnet takes the gateway's address with the prefix length. Switches such as --isolated turn something on; the =false form turns it off, as in --enabled=false.
For everything else there are two generic ways in, and they combine:
--set path=valuesets any field (see field paths and values).-f <file>(--filename) reads a manifest or a bare spec;-f -reads standard input. Flags are applied on top of the file.
unifi networks get IoT --output yaml > lab.yaml # start from an existing object
$EDITOR lab.yaml
unifi networks create Lab -f lab.yaml --vlan 50Flag values are checked before anything is sent. A VLAN ID outside 1 to 4094 or a security mode that doesn't exist fails with the valid range or values.
set
set changes the fields you name and leaves the rest alone, then shows what changed. --dry-run shows the change without making it:
$ unifi networks set IoT --vlan 21 --dry-run
● Would update the network "IoT" (dry run):
~ vlanId: 20 → 21--unset path removes a field. On kinds of the internal API the controller keeps the key and stores an empty value instead, so there --unset clears a field.
A set that changes nothing says so and exits 0.
edit
unifi networks edit IoTedit opens the object as a YAML manifest in $VISUAL, then $EDITOR, then vi, and applies what you save. What you save becomes the object's new state, so deleting a line removes that field. Closing without changes or emptying the file cancels. If the result isn't valid or the controller rejects it, your text is kept in a file whose path is printed.
enable and disable
$ unifi traffic rules disable "Limit guest bandwidth" --yes
✓ Disabled the traffic rule "Limit guest bandwidth".
~ enabled: true → false
$ unifi traffic rules enable "Limit guest bandwidth"
✓ Enabled the traffic rule "Limit guest bandwidth".
~ enabled: false → trueThese exist on the subjects whose objects can be switched off: networks, WiFi, firewall policies, ACLs, DNS, port forwards, routes, traffic rules and routes, and the three VPN subjects. Disabling something that is in use, such as an SSID or a firewall policy, asks for confirmation; enabling doesn't. An object that already is in the wanted state is left alone, with a notice.
delete
$ unifi dns delete nvr.home.arpa photos2.home.arpa --yes
✓ Deleted 2 DNS policies: "nvr.home.arpa", "photos2.home.arpa".Every name is checked before anything is deleted, so a typo in the second name deletes nothing. Deleting asks for confirmation; scripts pass --yes.
Two things can't be deleted or changed at all. Objects the controller defines itself, such as the built-in firewall policies, are marked system defined and refused. And the default network has to exist, so unifi networks delete Default fails with advice to change it instead.
One rule for confirmation
Every verb that changes something accepts -y / --yes, so a script can pass it everywhere. A question is only asked when something live goes offline or something is destroyed: delete, and disable of an object that is in use. create, set and enable don't ask. Without a terminal, a command that would ask fails instead, and Ctrl-C at a question aborts with exit code 130.
Field paths and values
--set <path>=<value>The path addresses a field with dots: ipv4Configuration.dhcpConfiguration.leaseTimeSeconds. The value is read as YAML, which gives you types without extra syntax:
| You write | The field becomes |
|---|---|
--set vlanId=20 | the number 20 |
--set enabled=true | a boolean |
--set name=Lab | text |
--set 'dns=[1.1.1.1,9.9.9.9]' | a list, which replaces the whole field |
--set 'items=[{type: PORT_NUMBER, value: 443}]' | a list of objects |
--set 'code="0042"' | text that would otherwise read as a number |
Repeat --set to change several fields in one request.
A field that no object of the kind on the site has is refused, because it's nearly always a typo:
$ unifi networks set IoT --set vlanID=21 --dry-run
✗ The network "IoT" has the field "vlanID", which no object of its kind on this site has.
Advice:
• Did you mean "vlanId" instead of "vlanID"?--force sends the field anyway, for the case where the controller knows a field that nothing on your site uses yet.
Names that aren't unique
The controller allows two objects with the same name. The demo site has three built-in policies called "Allow All Traffic", and two DNS records for nas.home.arpa. unifi-cli refuses to guess and tells you how to pick:
$ unifi firewall policies describe "Allow All Traffic"
✗ 3 firewall policies on site "Default" are named "Allow All Traffic".
Advice:
• Pass `--id <id>` to pick one, for example `--id beb28758-5ef0-4679-a332-be857fcd3782`.
• Or pick one by what tells them apart: `--source`, `--destination`.--id works on every verb that names an object. On get and describe, the flags for a kind's key fields pick too: --source and --destination for firewall policies, --type for DNS records.
unifi firewall policies describe "Allow All Traffic" --source Internal --destination External
unifi dns describe nas.home.arpa --type AAAA_RECORD
unifi dns set --id 57d157f2-4794-4b36-ab46-1f5275e503fe --ttl 600 --dry-runSecrets
WiFi passphrases, RADIUS secrets, VPN keys and device SSH passwords read <redacted> wherever unifi-cli prints an object: in describe, in --output yaml and json, and in diffs. Tables never show them.
$ unifi wifi get Lab --output yaml | grep passphrase
passphrase: <redacted>
$ unifi wifi get Lab --output yaml --show-secrets | grep passphrase
passphrase: hunter2hunter2--show-secrets on get and describe prints the real values in YAML and JSON, never in the text view. They then sit in your terminal's scrollback and in any file you redirect to, so use it deliberately.
A WiFi passphrase has no flag that takes it as a value, because command lines are visible to other users and kept in shell history. On a terminal, unifi wifi create asks for it with hidden input; scripts pipe it in:
pass show wifi/lab | unifi wifi create Lab --network Servers --security WPA2_PERSONAL --passphrase-stdinThe personal security modes require a passphrase of 8 to 63 characters, and unifi apply enforces the same rule for manifests.
--set follows the same rule and refuses a path that names a secret, also a nested one such as securityConfiguration.passphrase. For those there's --set-stdin <path>, which sets the field to what arrives on standard input, and asks for it with hidden input on a terminal:
$ pass show wifi/main | unifi wifi set Nordlicht --set-stdin securityConfiguration.passphrase
✓ Updated the WiFi network "Nordlicht".
~ securityConfiguration.passphrase: <redacted> → <redacted> (changed)create takes the flag too, so a WiFi network gets its passphrase either way:
$ pass show wifi/lab | unifi wifi create Lab --network Servers --security WPA2_PERSONAL --set-stdin securityConfiguration.passphrase
✓ Created the WiFi network "Lab".
→ Inspect it with `unifi wifi describe Lab`.A secret inside a list item, such as the shared secret of one RADIUS server among several, can't be set by path: --set and --set-stdin both refuse a path that goes through a list. Change it with edit, which keeps it out of your shell history too, or in a manifest with unifi apply.
Subject by subject
Networks
unifi networks manages the LANs and VLANs with their subnet, DHCP server and isolation. A network is the layer-3 side of a VLAN; WiFi broadcasts, port profiles and firewall zones refer to networks, so create the network first.
unifi networks create IoT --vlan 20 --subnet 192.168.20.1/24 --isolated
unifi networks set IoT --set ipv4Configuration.dhcpConfiguration.leaseTimeSeconds=86400WiFi
$ unifi wifi get
NAME TYPE SECURITY NETWORK ENABLED
Nordlicht Standard WPA3 Personal Trusted yes
Nordlicht Guest Standard Open Guest yes
Nordlicht IoT Standard WPA2 Personal IoT yesTyped flags: --network, --security (OPEN, WPA2_PERSONAL, WPA3_PERSONAL, WPA2_WPA3_PERSONAL, WPA2_ENTERPRISE, WPA3_ENTERPRISE), --hidden, --client-isolation, --band-steering and --enabled. --network takes the network's name and stores its ID. The passphrase comes from --passphrase-stdin or from a prompt, never from a flag's value; see Secrets.
unifi wifi disable "Nordlicht Guest" # stop broadcasting, keep the configuration; asks first
unifi wifi set "Nordlicht IoT" --hiddenFirewall
The zone-based firewall has two parts. Zones group networks; policies say what may flow from one zone to another.
$ unifi firewall zones get
NAME NETWORKS
DMZ -
External -
Gateway -
Hotspot Guest
Internal Default, Trusted, Management
IoT IoT
Servers Servers
VPN -unifi firewall zones set IoT --networks IoT,Cameras
unifi firewall policies create "Block Guests to Servers" \
--action BLOCK --source Hotspot --destination Servers --logging
unifi firewall policies get --sort source--source and --destination take zone names. Anything finer than zone to zone (ports, addresses, schedules) goes through --set or edit; create one such policy in the web interface and look at it with --output yaml to see the shape.
unifi firewall groups manages the legacy address and port groups (--type address-group|ipv6-address-group|port-group, --members), which port forwards and older rule sets refer to.
VPN
$ unifi vpn servers get
NAME TYPE SUBNET PORT ENABLED
OpenVPN Legacy OpenVPN server 192.168.61.1/24 1194 no
WireGuard WireGuard server 192.168.60.1/24 51820 yesThree subjects share the vpn parent: vpn servers (remote-access servers), vpn clients (tunnels the gateway dials out on) and vpn site-to-site. All three are served by the internal API from the same collection as networks, and their specs carry keys and pre-shared secrets, so prefer edit over long --set lines.
unifi vpn servers disable "OpenVPN Legacy"
unifi vpn site-to-site describe "Lake House"Internet
unifi internet (alias wan) manages the WAN connections: how each gets its address (--type dhcp|static|pppoe), its DNS servers (--dns, --dns2) and its role among several uplinks (--load-balance failover-only|weighted).
$ unifi internet get
NAME TYPE GROUP
LTE Backup DHCP WAN2
Nordlicht Fiber PPPoE WANA wrong WAN setting takes the site offline, and with a cloud context it takes your access to the console with it. Change these from a local context, on site.
DNS
unifi dns manages local DNS records and forward domains. The argument is the domain:
unifi dns create nvr.home.arpa --type A_RECORD --value 192.168.40.50 --ttl 300
unifi dns create photos.home.arpa --type CNAME_RECORD --value nas.home.arpa
unifi dns create corp.example.net --type FORWARD_DOMAIN --value 10.0.0.53--value is the address, the target domain or the DNS server, depending on the record type. Record types are A_RECORD, AAAA_RECORD, CNAME_RECORD, MX_RECORD, TXT_RECORD, SRV_RECORD and FORWARD_DOMAIN. Dynamic DNS is a separate subject, unifi ddns.
Traffic
unifi traffic rules blocks or allows traffic by app, category, domain, region or address (--action, --matching). unifi traffic routes sends matching traffic out through a specific interface, usually a VPN client, and has --kill-switch. unifi traffic lists holds the reusable port and address lists that firewall policies match on:
unifi traffic lists create "Web Ports" --type PORTS --set 'items=[{type: PORT_NUMBER, value: 443}]'
unifi traffic rules enable "Kids bedtime"Rules and routes are named by their description.
Port profiles
A port profile bundles what a switch port should do: which networks it carries (--forward all|native|customize|disabled), its PoE mode (--poe auto|off|passthrough|24v) and isolation. Assign one to a port with unifi ports set <device> <port> --profile <name>.
$ unifi port-profiles get
NAME FORWARD POE
All All auto
Disabled Disabled off
IoT Native auto
Trunk All auto
Trusted Native autoThe rest
port-forwards, routes, acls, radius, ddns and vouchers follow the same pattern with their own typed flags; unifi <subject> create --help lists them.
unifi port-forwards create Minecraft --protocol tcp_udp --port 25565 --to 192.168.40.30 --to-port 25565
unifi routes create "Lab behind Proxmox" --destination 10.99.0.0/24 --next-hop 192.168.40.11
unifi vouchers create Plumber --minutes 120 --guests 1The settings subject
unifi settings is different from the others. The controller keeps site settings as one object per key, each with its own fields, and they always exist: there is no create or delete, only get, describe, set and edit.
$ unifi settings get
KEY FIELDS DESCRIPTION
auto_speedtest 2 Scheduled internet speed tests
connectivity 3 Uplink connectivity monitor
country 1 Regulatory country of the site
dpi 2 Traffic identification and device fingerprinting
global_ap 6 Access point defaults: channel widths, transmit power
guest_access 14 Guest hotspot and captive portal
ips 9 CyberSecure: intrusion detection and prevention
locale 1 Time zone of the site
magic_site_to_site_vpn 1 Site Magic site-to-site VPN
mgmt 14 Device management, SSH, auto-updates
ntp 5 NTP servers handed to devices
radius 6 Built-in RADIUS server
rsyslogd 5 Remote syslog and netconsole
shadow_mode 6 High availability (shadow mode)
snmp 3 SNMP monitoring
super_mgmt 15 Controller management and backups
teleport 2 Teleport one-click VPN
usg 11 Gateway services: mDNS, UPnP, Geo-IP filtering, offloadingThe keys your controller has depend on its model and Network version. unifi settings get <key> shows the fields of one key. Work with a key the way you'd work with any object:
$ unifi settings set mgmt --set led_enabled=false --dry-run
● Would update the setting "mgmt" (dry run):
~ led_enabled: true → falseAll settings come from the internal API. Field names such as x_ssh_enabled are the controller's own and can change between Network versions; unifi settings describe <key> always shows what your controller has today.
Shortcuts
Four areas that people look for by name have shortcuts with typed flags, so you don't need to know which key and field hold a value. Each has get and set, and set takes --dry-run.
Automatic updates
$ unifi settings updates get
Automatic updates
Device auto-update yes
Device update hour 3
Controller auto-update no
Controller update hour 3
Release channel release
$ unifi settings updates set --hour 4 --dry-run
● Would update automatic updates (dry run):
~ Device update hour: 3 → 4Flags: --devices, --hour, --controller, --controller-hour, --channel. The values live in the keys mgmt and super_mgmt.
CyberSecure
unifi settings cybersecure (aliases ips, ids) covers intrusion detection and prevention, ad blocking, DNS filtering and the honeypot:
unifi settings cybersecure get --output wide # also shows where each value lives
unifi settings cybersecure set --mode ips --ad-blocking=trueFlags: --mode disabled|ids|ips, --categories, --ad-blocking, --dns-filtering, --honeypot, --memory-optimized. The list of protected networks is a list of internal network IDs; change it with unifi settings edit ips.
High availability
unifi settings ha (aliases high-availability, shadow-mode) pairs two gateways so that the second takes over when the first fails.
unifi settings ha get
unifi settings ha set --enabled=true --failover-delay 15 --dry-runFlags: --enabled, --role, --peer, --sync-interval, --failover-delay, --vrrp-id.
Device management
unifi settings management (alias mgmt) covers status LEDs, alerts, SSH access to devices and a few optional features:
unifi settings management set --led=false --ssh=trueThe device SSH password has no flag on purpose. Set it with unifi settings edit mgmt.
Change many things at once
For more than a handful of changes, or for changes you want reviewed, export the configuration to files and use unifi diff and unifi apply. That workflow is the subject of Configuration as code.
