Random mac

This commit is contained in:
Bob Mottram 2015-07-25 14:45:18 +01:00
parent dd11e7c17c
commit 704b55c577
1 changed files with 7 additions and 0 deletions

View File

@ -220,6 +220,13 @@ $SUDO sed -i '/iface eth0 inet static/a\ netmask 255.255.255.0' $MICROSD_MOUN
$SUDO sed -i "/iface eth0 inet static/a\ address $BBB_FIXED_IP_ADDRESS" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
$SUDO sed -i '/iface usb0 inet static/,/ gateway 192.168.7.1/ s/^/#/' $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
hexarray=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )
a=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
b=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
c=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
d=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
$SUDO sed -i "s|#hwaddress ether.*|hwaddress ether DE:AD:$a:$b:$c:$d|g" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
$SUDO sed -i "s/nameserver.*/nameserver $NAMESERVER1/g" $MICROSD_MOUNT_POINT/$ROOTFS/etc/resolv.conf
$SUDO sed -i "/nameserver $NAMESERVER1/a\nameserver $NAMESERVER2" $MICROSD_MOUNT_POINT/$ROOTFS/etc/resolv.conf