Skip to content

Instantly share code, notes, and snippets.

@qgp9
Created August 27, 2024 16:05
Show Gist options
  • Save qgp9/0d77ce769c03e2d313d72fa1b6582555 to your computer and use it in GitHub Desktop.
Save qgp9/0d77ce769c03e2d313d72fa1b6582555 to your computer and use it in GitHub Desktop.
Fix a mac address using nmcli for some SBCs
#!/bin/sh
DEVICE=end0
MAC="26:6E:FE:5C:CE:38" # prefered mac address
UUID=$(nmcli -f UUID,DEVICE connection show | awk -v dev=$DEVICE '$2==dev{print $1}')
nmcli connection down $UUID
nmcli connection modify $UUID ethernet.cloned-mac-address "$MAC"
nmcli connection up $UUID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment