Highlighted
New Member
Posts: 14
Registered: ‎08-02-2013
Kudos: 1
Solutions: 1

Unifi switch cli vlan ?

The other day we ran into an issue where we lost access to our entire unifi stack.

 And can no longer access our unifi controller to make any configuration changes. Do know that this network had been working for well over a year and then suddenly stopped working.  The switches no longer have ip address and their are multiple of them. I have a concole cable but am trying to find a few things.

 

1.) How from the command line can we add a vlan to a port?

2.) How can we find out who changed the config on the unifi system controller, assuming this is not a bug and someone isn't confessing to doing it.

 

3.) How to set a static IP on the switch directly via the cli?

 

Thanks in advanced.

Regular Member
Posts: 388
Registered: ‎11-11-2015
Kudos: 144
Solutions: 39

Re: Unifi switch cli vlan ?

1.) How from the command line can we add a vlan to a port?

From the CLI.

# telnet localhost

Entering character mode
Escape character is '^]'.

Warning!
The changes may break controller settings and only be effective until reboot.

(UBNT) >enable

(UBNT) #

From there, you can use Cisco IOS familiar syntax commands:

#show running-config interface 0/3

!Current Configuration:
!
interface  0/3
description 'Port 3'
vlan pvid 23
exit

Changing (or setting if unset) the pvid is done as follows:

(UBNT) #configure

(UBNT) (Config)#interface 0/3

(UBNT) (Interface 0/3)#vlan pvid 1000

Above would force vlan 1000 untagged on that port.  Tagging is setup similarly:

vlan participation include 23-25,50
vlan tagging 23-25,50

 

NOTE: Manual CLI configuration does not persist through a Controller provision, so I would first correct the port settings in the controller.

I don't have a good answer for questions 2 or 3, sorry.

 

New Member
Posts: 5
Registered: ‎12-28-2016

Re: Unifi switch cli vlan ?

This got me out of a jam, but I had to configure the vlan that I wanted it put in first.   

 

show configuration

look for "vlan database"

under that is the vlans configured on the switch.

 

copy that line. 

 

now,

 

do vlan database

add the one you want in order, like this example:   vlan 2,5,10,99

 

exit

conf t

 

then go in and add that vlan to the interface like above.