ipv6gen - IPv6 prefix generator.
ipv6gen [ -d ] [ -lmr ] [ -s <num> ]
<prefix> <prefix_length>
ipv6gen is tool which generates list of IPv6 prefixes of given prefix
length from certain prefix according to RFC 3531.
- -d
- debug mode. Displays allocated prefix as bit array.
- -l
- allocate bits from the left. e.g. for delta 4, the bit array looks like
this:
0000
1000
0100
1100
0010
1010
0110
1110
0001
1001
0101
1101
0011
1011
0111
1111
- -r
- allocate bits from the right. This is the same as allocation from the left
but reversed. e.g. again for delta of value 4:
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
- -m
- allocate bits from the middle. This method tries to allocate bits close to
the axis of delta first and then proceeds to sides. For delta of value 4
it is:
0000
0100
0010
0110
1000
1100
1010
1110
0001
0011
0101
0111
1001
1011
1101
1111
For delta of value 5, it is:
00000
00100
01000
01100
00010
00110
01010
01110
...
00001
00011
00101
00111
01001
01011
01101
01111
10001
10011
10101
10111
11001
11011
11101
11111
- -s <num>
- set step between generated prefixes. It will leave out step-1 prefixes
between each two generated prefixes. default step value is 1.
If we need to to split /48 prefix into two prefixes:
worm[~/IPv6/ipv6gen]> ./ipv6gen.pl 2001:1508:1003::/48 49
2001:1508:1003:0000::/49
2001:1508:1003:8000::/49
To allocate bits from the middle from /32 prefix with 4-bits wide
delta:
worm[~/IPv6/ipv6gen]> ./ipv6gen.pl -m 2001:1508::/32 36
2001:1508:0000::/36
2001:1508:4000::/36
2001:1508:2000::/36
2001:1508:6000::/36
2001:1508:8000::/36
2001:1508:C000::/36
2001:1508:A000::/36
2001:1508:E000::/36
2001:1508:1000::/36
2001:1508:3000::/36
2001:1508:5000::/36
2001:1508:7000::/36
2001:1508:9000::/36
2001:1508:B000::/36
2001:1508:D000::/36
2001:1508:F000::/36
Vladimir Kotal <vlada@devnull.cz>
http://techie.devnull.cz/ipv6/ipv6gen
ipv6gen should be converted to Perl library/module.