Workaround for Random MAC Address Generation and Non-fixed IP address at Every Reboot
Few days ago I wrote following latest version of Armbian to microSD Card:
I faced the problem that after every reboot, OPi PC randomly generated a new MAC address, causing SSH to fail.I had to unplug network wire, wait for about a minute, then re-plug the network wire, wait again 30 sec to enable SSH after every re-boot.
I added a line
hwaddress ether xx:xx:xx:xx:xx:xx in file
/etc/network/interfaces, but it did not solve the problem.
I then tried Armbian’s built-in Network Manager by commands
nmcli, both could not solve the issue. This issue is in knowledge of Armbian Developers, and they are trying to fix it. However in the meanwhile I used following fix successfully. Thanks to lukaszjokiel
(1) Create a new file
The file can have any suitable name, (but must end in
The file can be in any suitable location.
I chose file name
mac-spoof.sh , and its location inside folder
Following instructions are based on above choices.
1.1 - Create new file
sudo touch /etc/network/mac-spoof.sh
1.2 - Make new file executable
sudo chmod +x /etc/network/mac-spoof.sh
1.3 - Open new blank file for editing
sudo nano /etc/network/mac-spoof.sh
1.4 - Copy-paste following text in the new blank file
XX:XX:XX:XX:XX:XX by your desired MAC address
/sbin/ifconfig eth0 down
/sbin/ifconfig eth0 hw ether XX:XX:XX:XX:XX:XX
/sbin/ifconfig eth0 up
/bin/systemctl restart NetworkManager
1.5 - Save (Ctrl+o) and Close (Ctrl+x)
(2) Make entry in file
/etc/rc.local to automaticlly fix the MAC at every reboot.
2.1 - Open file
/etc/rc.local for editing
sudo nano /etc/rc.local
2.2 - Scroll-down till you see the last line which is only
exit 0. Just above last line
exit 0, paste following line:
2.3 - Save (Ctrl+o) and Close (Ctrl+x)
2.4 - Reboot Orange Pi
2.5 - Check if you can SSH. Also check your router settings to see what MAC and IP is shown.