unifi ports
About 1293 words
See and change switch ports by name: PoE, profiles, names.
Aliases: port
See and change the ports of switches and gateways.
Devices and ports are named the way you named them: "Core Switch" NAS is the port called NAS on the Core Switch. A port also answers to its number, and verbs that act on several ports take lists and ranges such as 5,6,7 or 1-4,NAS.
Commands
unifi ports cycle: Power-cycle the PoE device on a portunifi ports disable: Turn ports offunifi ports enable: Turn ports back onunifi ports get: Show the ports of every switch, of one device, or single portsunifi ports poe: Turn PoE on or off, or power-cycle what a port powersunifi ports rename: Give a port a new nameunifi ports set: Change a port: name, PoE, profile, network, on or off
unifi ports cycle
Power-cycle the PoE device on a port.
Usage
unifi ports cycle <device> <ports> [flags]Cut the PoE power of one or more ports for a moment, which restarts the camera, access point or phone they power. It is the short form of unifi ports poe <device> <ports> cycle.
Name one port by its name or number, or several at once as a list (5,6,7), a range (5-8) or a mix (1-4,NAS).
Examples
unifi ports cycle "Core Switch" "AP Living Room"
unifi ports cycle "Core Switch" 9-11 --yesFlags
| Flag | Description |
|---|---|
-y, --yes | do not ask for confirmation |
unifi ports disable
Turn ports off.
Usage
unifi ports disable <device> <ports> [flags]Disable one or more ports. Whatever is connected to them goes offline, so the command asks for confirmation when a port has link or delivers power; ports nothing hangs on are disabled without a question.
Name one port by its name or number, or several at once as a list (5,6,7), a range (5-8) or a mix (1-4,NAS).
Disabling the port a device reaches the network through would cut the device off for good, so it is refused unless you pass --force.
Examples
unifi ports disable "Core Switch" Spare
unifi ports disable "Core Switch" 20-24 --yesFlags
| Flag | Description |
|---|---|
--force | allow disabling the device's uplink port |
-y, --yes | do not ask for confirmation |
unifi ports enable
Turn ports back on.
Usage
unifi ports enable <device> <ports> [flags]Enable one or more ports that were disabled.
Name one port by its name or number, or several at once as a list (5,6,7), a range (5-8) or a mix (1-4,NAS).
Examples
unifi ports enable "Garage Switch" "Old Printer"
unifi ports enable "Core Switch" 20-24Flags
| Flag | Description |
|---|---|
-y, --yes | do not ask for confirmation |
unifi ports get
Show the ports of every switch, of one device, or single ports.
Usage
unifi ports get [device] [ports] [flags]Aliases: list, ls
Show switch ports.
Without arguments every switch and gateway is drawn as its faceplate, with how many ports are up and how much PoE power it delivers. With a device the faceplate is followed by a table of its ports. With a device and a port, named by its name or its number, that port is shown in full; a list or a range of ports (5,6,7, 1-4,NAS) gives a table of those.
--poe without a device is the PoE budget of the site: for every switch the power it delivers and what each port draws, the hungriest first.
Narrow the ports with --up, --down and --poe, or with --filter, which takes a filter expression such as speedMbps < 1000 && profile == "IoT". Fields:
connectedTo connector enabled fullDuplex idx
maxSpeedMbps name nativeNetwork poeActive poeCapable
poeMode poeWatts profile rxBytes rxRateBps
speedMbps txBytes txRateBps up uplinkExamples
unifi ports get
unifi ports get "Core Switch"
unifi ports get "Core Switch" --poe
unifi ports get "Core Switch" --down --output wide
unifi ports get "Core Switch" NAS
unifi ports get "Core Switch" 17 --output yaml
unifi ports get "Core Switch" 9-12
unifi ports get --poe
unifi ports get --poe --output jsonFlags
| Flag | Description |
|---|---|
--down | only ports without link |
--filter <string> | filter expression, such as 'speedMbps < 1000 && profile == "IoT"' |
--poe | only ports that deliver PoE power |
--up | only ports with link |
unifi ports poe
Turn PoE on or off, or power-cycle what a port powers.
Usage
unifi ports poe <device> <ports> <on|off|auto|cycle> [flags]Control Power over Ethernet on one or more ports.
on, auto supply power when a PoE device asks for it
off stop supplying power
cycle cut the power for a moment, restarting the powered deviceName one port by its name or number, or several at once as a list (5,6,7), a range (5-8) or a mix (1-4,NAS).
Cutting power to a port that is powering something asks for confirmation; a port that already is in the wanted mode is left alone.
Examples
unifi ports poe "Core Switch" "Camera Driveway" off
unifi ports poe "Core Switch" 9 on
unifi ports poe "Core Switch" 9-12 off --yes
unifi ports poe "Core Switch" 5,6,7 auto
unifi ports poe "Core Switch" "AP Living Room" cycleFlags
| Flag | Description |
|---|---|
-y, --yes | do not ask for confirmation |
unifi ports rename
Give a port a new name.
Usage
unifi ports rename <device> <port> <new name> [flags]Rename one port. It is the short form of unifi ports set <device> <port> --name <new name>.
Ports are managed by name, so a name has to identify one port: a name another port of the device already has is refused, and so is a name that reads as another port's number, such as 5 or port 5.
Examples
unifi ports rename "Core Switch" 5 Printer
unifi ports rename "Core Switch" Printer "Printer Hallway"Flags
| Flag | Description |
|---|---|
-y, --yes | do not ask for confirmation |
unifi ports set
Change a port: name, PoE, profile, network, on or off.
Usage
unifi ports set <device> <port> [flags]Change the configuration of one port. Name the port by its name or its number and pass a flag for everything that should change; whatever you leave out stays as it is.
PoE modes: auto, off, passthrough, 24v. Disabling a port asks for confirmation, and disabling a device's uplink is refused unless you pass --force.
Examples
unifi ports set "Core Switch" 5 --name Printer
unifi ports set "Core Switch" NAS --poe off
unifi ports set "Core Switch" 8 --name "Camera Porch" --profile IoT --poe auto
unifi ports set "Office Switch" 7 --network Trusted
unifi ports set "Garage Switch" "Old Printer" --enableFlags
| Flag | Description |
|---|---|
--disable | disable the port |
--enable | enable the port |
--force | allow disabling the device's uplink port |
--name <string> | new name of the port |
--network <string> | native network of the port |
--poe <string> | PoE mode: auto, off, passthrough, 24v |
--profile <string> | port profile to assign |
-y, --yes | do not ask for confirmation |
Global flags
These flags are accepted by every command.
| Flag | Description |
|---|---|
--color-scheme <string> | color scheme: auto, dark or light |
--context <string> | context to use instead of the current one |
--no-cache | ask the controller for everything instead of using cached answers |
-o, --output <string> | output format: text, wide, json, yaml (table is another name for text) |
-s, --site <string> | site to act on instead of the context's default site |
--theme <string> | theme to render with instead of the configured one |
