So I have gone from a script that had 7 lines to over 200 and it is now at a place I am happy with at v2.1. There are still a couple of things I want to adjust on it but for the most part I feel it is relatively robust and offers what I will need.
I initially wrote the first part of the script to generate random IPv4 addresses with a random CIDR mask, working on the last two octets in order to practice subnetting for the CompTIA Network+ class. I have learnt quite a lot while writing this script and I hope that this may be a useful tool if you are also learning subnetting and need a number of different IP addresses to practice with. For CompTIA Netowrk+ exam prep, the most common octets I have seen were the last two, therefore at this time I will not be editing the CIDR mask settings.
Headings have been added for the different IP classes that are being generated to be able to read the different output easier, however using the -q flag will prevent these headings from appearing. Depending on where the -q flag is, it will mute out different flags. Below is an example output:
I have created a history page of the previous source codes for rand_ip, which also includes the latest version of the code. If you find any bugs or issues, please don’t hesitate to leave a comment.
If you want to skip having to go to the history page, copying and pasting the source code, you can download it here: