Unifi Controller Mac

In a situation, where spoofing or cloning the MAC address of the WAN port is something you need to do, it’s usually needed to be done immediately after setup, yet on the Ubiquiti USG there is no way to do it in the controller’s GUI (as of January 2019), so I decided to write up quick step-by-step recipe since I haven’t found one simple enough for people entirely new to the Ubiquiti’s ecosystem (like I was), its Controller and whatnot. Though I do assume you’ve used ssh before.

  1. Unifi
  2. Unifi V4.7.5 Controller For Windows

Loading Ubiquiti Community Ubiquiti Community. May 20, 2020 We have a few MAC Addresses that refuse to show hostname, is there any specific reason for this? Any way to resolve it? Spicework Mods: Can we get a Unifi topic Lol - feel it could be helpful being how diverse of a company they are:).

So we have the Ubiquiti UniFi Security Gateway (USG) and we want to spoof (clone) MAC address of the WAN port – usually when you need to clone the address of the old router (or else the internet won’t work).

How to spoof MAC address of WAN port on the USG:

If the new UniFi AP is in the same network as your UniFi controller, your controller should automatically detect the new device with it’s MAC address. The status message notifies you with “ Pending Adoption (UPDATE REQUIRED) “. Simply select Adopt and Upgrade and wait a few minutes until the process is finished.

1. Log in directly into the USG using ssh

You can use Putty on Windows or Terminal on UNIX/macOS.

To log in, use the credentials created during initial setup (these are different from UniFi Controller login credentials – i.e. not the email):

ssh admin@192.168.1.1 (I am using Mac & Terminal)

After login, you will be greeted by a UniFi text art, where there is one sentence worth noting: *NOTE*: Configuration changes made here are not persistent. They will be overwritten by the controller on next provision.

(It basically says that anything we’ll do here won’t last past the device’s next full reboot. I did not noticed that the first time and the WAN’s port MAC address returned to default when the USG’s rebooted after the next firmware update few weeks later and suddenly the internet was down and I didn’t know why.)

2. Change the MAC address temporarily

Theoretically you can go directly to step #3, but this is a good step to make sure you are cloning the correct MAC address to the correct physical port, and also it works immediately without the need to reboot the USG and Controller.

So once in the command line, issue this sequence of commands:

Controller

configure
set interfaces ethernet eth0 mac 10:7B:EF:2F:3C:38 (of course change the MAC)
commit
save
exit

The USG has three ports, where the WAN port (the first one) is eth0, you can also change the MAC address of the other two ports as well by doing eth1 (the default LAN port) or eth2 (LAN/WAN).

Now check if the new MAC address works (I did it simply by observing if the internet started pouring in… :D). If it does, you can proceed to the final step #3:

3. Save the settings for good

The quickest way is simply to take this piece of json, edit the MAC address (to match the one above) and then save it somewhere as config.gateway.json file.

It is recommend to double check the validity of the file, e.g. on jsonlint.com to avoid any issues.

Now place this file in the UniFi Controller’s site folder. Depending on where you installed the controller, this most likely will be the default folder in these locations:
* Windows:C:Users<username>Ubiquiti UniFidatasitesdefault
* Linux:/usr/lib/unifi/data/sites/default/
* Mac:~/Library/Application Support/UniFi/data/sites/default/
* Cloud Key:/srv/unifi/data/sites/default/

That’s it. Now the MAC setting will be loaded even after the reboot. You can test and verify that everything works as it should by forcing provision (described here), tl;dr: UniFi Controller Devices > USG > Config > Manage Device > Force provision, or by simply rebooting the USG.

The json file is basically for pieces of settings that cannot (yet) be done through the UI. It is all well described in the official documentation.

UniFi by Ubiquiti Networks, inc. is a software that binds gateways, switches and wireless access points together with one graphical front end.

There is currently support for the following device types within Home Assistant:

Configuration

Home Assistant offers UniFi integration through Configuration -> Integrations -> UniFi Controller. Follow the instructions to get it set up.

The user needs administrator privileges in order to control switches.

Extra configuration of the integration

All configuration options are offered from the front end. Enter what UniFi integration you want to change options on and press the cog wheel.

Configuring Users

The UniFi controller allows you to create multiple users on it besides the main administrator. If all you want to use is the device tracker then it is recommended that you create a limited user that has read-only permissions for the UniFi device tracker. If you want blocking of network access or POE control as well you would need to have ‘admin’ permissions.

UniFi OS

For UniFi OS a local-only user needs to be created. A user who uses the Ubiquiti cloud will not work. You can do this in the manage users section on the UniFi OS dashboard. Make sure to give it the right permissions for the functions you want to use. Note the Dream Machine Pro needs the port to be 443.

Conflicts with MQTT

The UniFi controller can either be a dedicated hardware device (UniFi’s cloud key), or as software on any Linux system. If you run the UniFi controller on the same operating system as Home Assistant there may be conflicts in ports if you have the MQTT integration as well.

It is recommended that you run the UniFi controller in a dedicated virtual machine to avoid that situation.

Presence detection

This platform allows you to detect presence by looking at devices connected to a UbiquitiUniFi controller.

Troubleshooting and Time Synchronization

Presence detection depends on accurate time configuration between Home Assistant and the UniFi controller.

If Home Assistant and the UniFi controller are running on separate machines or VMs ensure that all clocks are synchronized. Failing to have synchronized clocks will lead to Home Assistant failing to mark a device as home.

Switch

Block network access for clients

Allow control of network access to clients configured in the integration options by adding MAC addresses. Items in this list will have a Home Assistant switch created, using the UniFi Device name, allowing for blocking and unblocking.

Control clients powered by POE

Entities appear automatically for each connected POE client. If no POE client device is in operation, no entity will be visible. Note: UniFi infrastructure devices such as access points and other switches are not (yet) supported, even if they are powered over ethernet themselves.

Note that POE control actually configures the network port of the switch which the client is connected to.

Control DPI Traffic Restrictions

Entities appear automatically for each restriction group. If there are no restrictions in a group, no entity will be visible. Toggling the switch in Home Assistant will enable or disable all restrictions inside a group.

Sensor

Bandwidth sensor

Unifi

Get entities reporting receiving and transmitting bandwidth per network client.

Uptime sensor

Unifi V4.7.5 Controller For Windows

Get entities reporting uptime per network client.

Debugging integration

If you have problems with UniFi or the integration you can add debug prints to the log.