In the test, I’ll change the MAC address on Ubiquiti Rocket M5.
To do this, edit the configuration file.
You can download the configuration file via the web interface, edit and then upload it back, or you can edit it online by connecting to the device via SSH or telnet.
We’ll back up the configuration just in case through the web interface or as I described in this article:
Backup Ubiquiti Device Configuration (UBNT)
In fact, you need to find construction sites:
netconf.1.devname=eth0 netconf.1.hwaddr.mac= netconf.1.hwaddr.status=disabled ... netconf.2.devname=ath0 netconf.2.hwaddr.mac= netconf.2.hwaddr.status=disabled
eth0 is LAN, ath0 is WLAN.
When editing in the vi editor, use the x key to delete the word disable, and then press the a key to write enable instead. after mac= specify the desired mac-address. Mac LAN must be different from mac WLAN. After editing, press Esc to return to command mode, type: x and press Enter to save the changes to the file and exit the editor.
Something like this should be spelled out:
netconf.1.devname=eth0 netconf.1.hwaddr.mac=00:11:11:22:22:33 netconf.1.hwaddr.status=enable ... netconf.2.devname=ath0 netconf.2.hwaddr.mac=00:11:11:22:22:34 netconf.2.hwaddr.status=enable
After the change, apply the changes with the commands:
cfgmtd -f /tmp/system.cfg -w /usr/etc/rc.d/rc.softrestart save
You can temporarily change the MAC address until the device is rebooted; for this, we’ll see the names of the network interfaces:
And change, for example for wifi0:
ifconfig wifi0 down ifconfig wifi0 hw ether 11:22:33:44:55:66 ifconfig wifi0 up
You can also try adding the commands above to the script so that they are executed when the device is turned on:
vi /etc/persistent/rc.poststart press i ifconfig wifi0 down ifconfig wifi0 hw ether 11:22:33:44:55:66 ifconfig wifi0 up press the ESC key type :wq and press Enter
Save and reboot the device:
cfgmtd -w -p /etc/ reboot
See also my article:
Ubiquiti SSH Management