:::: MENU ::::

IPv6 Generator

Background – IPv6

A good systems/security/network administrator has a slew of tools up their sleeves to support their specialty. Unfortunately, many tools still do not support IPv6; those that do put a hurting on your wallet. The below was used to test connectivity across a router using iptables, to make sure the IPv6 addresses were successfully blocked.

The IPv6 Generator

<?php
$startime = microtime(true);

$prefix = "fe80:1234:";
$octets = 6;
$fin = pow($octets, 65536);
echo "Resolving $fin IPv6 Addressesnn";

for($i = 0; $i<= $fin;$i++){
        $oct = dechex($i);
        $addytmp = str_pad($oct, ($octets*3), "0", STR_PAD_LEFT);
        $addytmp = str_split($addytmp, 4);
        $addy = implode(":", $addytmp);
        echo $prefix.$addy."n";
}

echo "It took ".(microtime(true)-$startime)." seconds";

Other Uses

You can even do something like the following to test IPv6 ranges for port scanning:

<?php
$prefix = "fe80:1234:";
$octets = 6;
$fin = pow($octets, 65536);

for($i = 0; $i<= $fin;$i++){
        $oct = dechex($i);
        $addytmp = str_pad($oct, ($octets*3), "0", STR_PAD_LEFT);
        $addytmp = str_split($addytmp, 4);
        $addy = implode(":", $addytmp);
        $fs = fsockopen($addy, 22);
        if($fs){
              echo $addy." has port 22 openn"; 
        }

        fclose($fs);
}

How long does it take you to run the above?

Update: I will be updating this script shortly to support automatic detection of provided octets and adding a multiplier to speed it up.


24 Comments

  • Reply Tuan Leverich |

    Some truly nice and utilitarian info on this site, also I conceive the design holds fantastic features. I enjoy your script, my job is made easier with IPv6.

  • Reply NetMast3r |

    Awesome article man, searched for your blog post ongoogle. Going to add it to my rss feed reader!

  • Reply zakłady sportowe |

    I think other web site proprietors should take this website as an model, very clean and excellent user friendly style and design, let alone the content. You are an expert in this topic!

  • Reply moncler doudoune |

    I am often to blogging and i really appreciate your content. The article has really peaks my interest. I am going to bookmark your site and keep checking for new information.

  • Reply Chio5475 |

    You should engage in a contest for one of the highest quality personal blogs on the internet. I’m going to suggest this particular site!

  • Reply Ogłoszenia Kielce |

    hello there and thank you for your info – I’ve certainly picked up anything new from right here. I did however expertise some technical points using this site, as I experienced to reload the website many times previous to I could get it to load correctly. I had been wondering if your web host is OK? Not that I am complaining, but slow loading instances times will sometimes affect your placement in google and can damage your quality score if ads and marketing with Adwords. Anyway I’m adding this RSS to my email and can look out for much more of your respective exciting content. Ensure that you update this again very soon..

  • Reply Torella |

    I truly appreciate this post. I have been looking all over for this! Thank goodness I found it on Bing. You’ve made my day! Thanks again!

  • Reply Takaful Kenderaan |

    Simply want to say your article is as amazing. The clearness in your put up is simply cool and that i could suppose you are an expert in this subject. Well together with your permission allow me to grab your feed to stay updated with approaching post. Thanks one million and please keep up the rewarding work.

  • Reply Melaine Mako |

    Wow! Thank you! I always needed to write on my site something like that. Can I implement a portion of your post to my site?

  • Reply pat neaude |

    We’re a group of volunteers and opening a new scheme in our community. Your web site offered us with valuable info to work on. You’ve done a formidable job and our entire community will be grateful to you.

  • Reply Chung Casarz |

    I just want to tell you that I’m newbie to blogging and site-building and truly enjoyed you’re page. Most likely I’m going to bookmark your site . You surely have perfect well written articles. Regards for revealing your blog.

  • Reply Rasey |

    Hey! I just would like to give you a huge thumbs up for the very nice info you have in this article on this posting. I’ll be returning to your blog for more soon.

  • Reply Wenimont97122 |

    Hello There. I discovered your blog using msn. This is a really smartly written article. I¡¦ll make sure to bookmark it and come back to learn extra of your helpful information. Thanks for the post. I will definitely comeback.

  • Reply Chester Landherr |

    Hey there, noticed this web site from a community forum I visit, and had been wanting to know if I could possibly use the web page for a resource in one of my own websites. Any credit will be given to the original website, i.e. : http://www.highonphp.com/ipv6-generator . Would love to be able to, so please make sure to contact me by my email address in the event that I aren’t able to: Estrella@gmail.com . Thanks a lot :)

  • Reply Joesph Posen |

    Great blog here! Also your web site loads up fast! What web host are you using? Can I get your affiliate link to your host? I wish my website loaded up as quickly as yours lol

  • Reply Hermine Blackbird |

    Howdy just wanted to give you a quick heads up. The words in your post seem to be running off the screen in Safari. I’m not sure if this is a format issue or something to do with browser compatibility but I figured I’d post to let you know. The design look great though! Hope you get the problem fixed soon. Many thanks

  • Reply Ran Ban Sunglasses |

    Howdy! Someone in my Facebook group shared this website with us
    so I came to look it over. I’m definitely loving the information. I’m bookmarking
    and will be tweeting this to my followers! Excellent blog and outstanding style and design.

So, what do you think ?

  • *