#!/bin/bash

# Description: Script to generate a MAC Address

# Note
# The First 2 digits are fixed as 07 so that it can be identified from other system MAC Addresses
# $RANDOM generates a random number

mac_address=$(echo "$RANDOM"|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/07:\1:\2:\3:\4:\5/')

echo $mac_address
#!/bin/bash

# Description: Script to generate a MAC Address

# Note
# The First 2 digits are fixed as 07 so that it can be identified from other system MAC Addresses
# $RANDOM generates a random number

# Approach 1
mac_address=$(echo "$RANDOM"|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/07:\1:\2:\3:\4:\5/')
echo -e $mac_address "\t<----------------- Random MAC Address Starting With 07"

# Approach 2: This will use hostname instead of Random and it will generate the same MAC everytime on a host reliably
FQDN=`hostname`
mac_address=$(echo $FQDN|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/07:\1:\2:\3:\4:\5/')
echo -e $mac_address "\t<----------------- Fixed MAC Address for This Host Starting With 07"

Add code to generate a fixed MAC Address for a host
Add code to generate a fixed MAC Address for a host
