The task: generate random mac when an interfaces comes up.
#this does work to generate a random mac
echo '00 60 2f'$(od -An -N3 -t xC /dev/urandom) | sed -e 's/ /:/g'
the inside of /etc/network/interfaces:
auto eth0
iface eth0 inet dhcp
#This works:
hw-mac-address aa:bb:cc:dd:ee:ff
#while this does not when I ifup eth0:
hw-mac-address $(echo '00 60 2f'$(od -An -N3 -t xC /dev/urandom) | sed -e 's/ /:/g')
Any thoughts or suggestions?
I found multiple solutions. 1 of them is with pre-up, (Thansk fkraiem)
This requires that macchanger is installed. /etc/network/interfaces looks like this:
The second solution is the correction of my originally incorrect configuration.
This solution doesn't require that macchanger is installed