Skip to content

Instantly share code, notes, and snippets.

@click0
Created June 8, 2011 11:36
Show Gist options
  • Save click0/1014255 to your computer and use it in GitHub Desktop.
Save click0/1014255 to your computer and use it in GitHub Desktop.
random generator ipv6 address
#!/bin/sh
# Copyright Andrey Mitrofanov
# Copyright pavlinux http://pavlinux.ru
# 2011
MAXCOUNT=20
count=0
network_v6=2a01:7a0:2:12 # your ipv6 network prefix
rnd_ipv6_block () {
HEX="openssl rand -hex 8 | sed 's/..../:&/g'"
ipv6=$network_v6$(eval $HEX);
}
echo "$MAXCOUNT случайных IPv6:"
echo "-----------------"
while [ $count -lt $MAXCOUNT ]
do
count=`expr $count + 1`
rnd_ipv6_block
echo $ipv6
done
#!/bin/sh
# Copyright Andrey Mitrofanov
# Copyright pavlinux http://pavlinux.ru
# 2011
MAXCOUNT=20
count=0
network_v6=2a01:7a0:2:12 # your ipv6 network prefix
rnd_ipv6_block () {
HEX="tr -dc "[:xdigit:]" < /dev/urandom | head -c 16 | sed 's/..../:&/g'"
ipv6=$network_v6$(eval $HEX);
}
echo "$MAXCOUNT случайных IPv6:"
echo "-----------------"
while [ $count -lt $MAXCOUNT ]
do
count=`expr $count + 1`
rnd_ipv6_block
echo $ipv6
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment