Friday, October 15, 2010

Generate IPV6 Addresses with BASH

A fast way to generate some IPV6 addresses via BASH, with tool called "wcalc" that will help generating hexadecimal values.
First make sure "Wcalc" package is installed on your system:

root@paul-laptop:~# rpm -qa Wcalc
Wcalc-1.6.2-1


Next, using bash "for" loop let's generate some addresses (values selected randomly):

root@paul-laptop:~# for i in $(seq 600 610) ;do echo -n '2001:fade:28e1:3712::1'; echo ${i} |wcalc -h|awk -F x '{print $2}';done

Output:

2001:fade:28e1:3712::1258
2001:fade:28e1:3712::1259
2001:fade:28e1:3712::125a
2001:fade:28e1:3712::125b
2001:fade:28e1:3712::125c
2001:fade:28e1:3712::125d
2001:fade:28e1:3712::125e
2001:fade:28e1:3712::125f
2001:fade:28e1:3712::1260
2001:fade:28e1:3712::1261
2001:fade:28e1:3712::1262

No comments: