#!/bin/sh # # @(#) generate-uniq-local-ipv6-unicast-addr.sh # # (c) Sep 2004 Holger Zuleger # # do what the name suggest in coordinance to # draft-ietf-ipv6-unique-local-unicast-addr-05.txt (June 2004) # # firstpart = 64-Bit NTP time # secondpart = EUI-64 Identifier or 48 Bit MAC-Adress # md5 ($firstpart | $secondpart ) # use least significant 40 Bits of md5sum # Build global Prefix (locally assigned == FD00::/8) # NTPSERVER=pool.ntp.org firstpart=`ntpdate -d -q $NTPSERVER | sed -n "/reference/s/^reference time: *\([^ ]*\) .*/\1/p" | tr -d "."` secondpart=`ifconfig eth0 | grep "inet6 addr: fe80" | sed -n "s|^.*::\([^/]*\)/.*|\1|p" | tr -d ":"` echo ${firstpart}${secondpart} | md5sum globalid=`echo ${firstpart}${secondpart} | md5sum | cut -c23-32` echo fd${globalid} | sed "s|\(....\)\(....\)\(....\)|\1:\2:\3::/48|"