Based on RFC 4193 and this guide.
This should work anywhere coreutils is available.
date +%s%N | tr -d '\n' | cat - /etc/machine-id | sha1sum | cut -c 31-40 | sed 's|^|fd|; s|.\{4\}|&:|g; s|$|:/64|'date +%s%N # get current unix timestamp at nanosecond accuracy
| tr -d '\n' # trim trailing new line character
| cat - /etc/machine-id # concatenate with local machine ID
| sha1sum # compute SHA-1 digest
| cut -c 31-40 # take the least significant 40 bits (10 hex digits)
| sed 's|^|fd|; s|.\{4\}|&:|g; s|$|:/64|' # append 'fd'; insert separators; append subnet mask