Summary 

This document describes the procedure to remove a device from the Oxygen IT Unifi Controller (unifi.oxygenit.com.au) by it's MAC address by leveraging SSH and the MongoDB module on the controller. This is to be used if a device will not show up to adopt, even though the normal adoption steps/troubleshooting have been used.


Our responsibilities

Confirm that there is a recent, up to date backup of the controller before proceeding


What we're not responsible for

N/A


What is needed for this procedure

- SSH applications

- Admin credentials for the unifi.oxygenit.com.au controller

- Pin/Paperclip (only if reset is necessary) 

- Anything else required to connect the device to be adopted onto the internet


Procedure

This procedure is separated into three phases;

1. Physically setting up the device/s

2. Tunneling onto the Oxygen IT Unifi Controller to remove the device/s via their MAC address

3. Resetting and adopting the device/s back into the Oxygen IT Controller


Physically setting up the device/s

1. Deploy items near adequate power and network

2. Plug in power

3. Plug in network cable

    - If Unifi switch, any port will do

    - If WAP with more than one port, use primary

    - If USG, use WAN1 port

4. Identify the MAC address of the device/s


Tunneling onto the Oxygen IT Unifi Controller to remove the device/s via their MAC address

1. Connect to the Oxygen IT Unifi Controller (ping unifi.oxygenit.com.au to resolve it's current IP) using SSH

2. Log in as oxyadmin (refer to Keeper)

3. Run the following commands, one after each other, replacing the xx in the last line to the actual MAC address of the device to be remove (case sensitive, use lower case alphanumerals):

mongo --port 27117
use ace
db.device.remove({"mac":"xx:xx:xx:xx:xx:xx"})

4. It should return a line about the removal, with a result of 1 meaning something has been removed (0 means nothing found)

WriteResult({ "nRemoved" : 1 })


5. Repeat the last line for each device you want to remove, changing the MAC address as required

6. Once finished, type the following command:

exit

7. Disconnect from the Unifi Controller

8. Restart the Oxygen IT Controller via the Azure Portal


Resetting and adopting the device/s back into the Oxygen IT Controller

Follow the appropriate configure steps based on the type of device/s you're configuring.


Configure layer 2 device (Switch or WAP)

1. Use a pin and depress the reset button on the device for approximately 15 seconds (lights should cycle)

2. Identify IP address of Unifi device

3. Connect to Unifi device using SSH

4. Log in to the Unifi device using the default credentials

Username: ubnt

Password: ubnt

5. Run this command in the console

set-inform http://unifi.oxygenit.com.au:8080/inform
Generic

6. Re-run the above command, one more time

7. Check portal to see if the Unifi device is showing as adoptable in any of the tenants


Configure layer 3 device (USG)

1. Use a pin and depress the reset button on the device for approximately 15 seconds (lights should cycle)

2. Connect your PC directly to the Unifi device's LAN1 port, using a network cable

3. Connect to the Unifi device at 192.168.1.1 using SSH

4. Log in using default credentials

Username: ubnt

Password: ubnt

5. Run this command in the console

set-inform http://unifi.oxygenit.com.au:8080/inform
Generic

6. Re-run the above command, one more time

7. Check portal to see if the Unifi device is showing as adoptable