Monday, August 28, 2023

Factory reset your Unifi AP or switch and adopt them to your new Unifi Controller setup with the wrong network IP

I am reinstalling my Unifi Controller on Docker and need to re-adopt my Unifi AP devices. There are several ways to do this:

  1. Hard reset your device with a staple
  2. SSH into the device and reset via a command
  3. Forget the device in the Unifi Controller (was never an option for me, but seems possible for others)

With option 1, I ran into the issue that my network is different from the default one that a Unifi AP resets to (default IP = 192.168.1.20) and I wanted a way to change that back to the fixed IP address it had before. Thanks to this article for some help. Later on, it turned out there was even a more convenient way for me to do this, see below.

  1. Reset your Unifi AP device with a staple by pressing the Reset button. When it concerns a switch, follow the special procedure which requires to unplug the power cord and UTP cables, see more information here.
  2. Provide a laptop where you can change the Ethernet IP to a fixed on e.g. 192.168.1.2 (has to be in the 192.168.1.x/24 range) and connect the laptop with your Unifi AP or switch directly through an UTP cable 
  3. SSH into the Unifi AP or switch (ssh -l ubnt 192.168.1.20) with default password ubnt
  4. Change the config file:
  5. vi /etc/udhcpc/udhcpc
    From:
    UDHCPC_FALLBACK_IP="192.168.1.20"UDHCPC_FALLBACK_NETMASK="255.255.255.0"
    Into:
    UDHCPC_FALLBACK_IP="NEW_IP"UDHCPC_FALLBACK_NETMASK="255.255.255.0"
  6. Save your file and wait
A couple of seconds later, the Unifi AP or switch will get a new IP address and you can disconnect the direct UTP cable and hook up the AP or switch again to your normal network. It should be accessible now through the Controller UI and you can adopt it again.

Unfortunately, this did not work 100% for one of my switches, so I searched for a better way.

Now, option 2 is even better and didn't require me to unplug the device and work with 2 UTP cables.
  1. Check in the Unifi Controller for the listed devices that still need to be adopted


  2. SSH into the device with you known (old) admin account and password
  3. Reset the device configuration
    set-default


  4. Wait for the device to come up again in the Unifi Controller and check it's IP address that should have changed now. Select the device and click on 'Adopt'.
  5. SSH into the device with this IP address and the default login: ubnt/ubnt.
  6. Perform an adoption via:
    ping -c 4 unifi.yourdomain.com
    mca-cli
    set-inform http://unifi.yourdomain.com:8080/inform
  7. Check in the Unifi Controller but normally it should start adopting or updating its configuration straight away!

No comments:

Post a Comment