Hello All, Quick question for you. I wasn't able to find much on this online.
My goal is to generate a list of usable ip addresses within *any* subnets. so far I have the following:
#!/usr/bin/perl use NetAddr::IP; use strict; my $ip = new NetAddr::IP('10.2.9.0/29'); while ($ip < $ip->broadcast) { print "$ip\n"; $ip ++; } exit;
This will generate a list that looks like this:
10.2.9.0/29
10.2.9.1/29
10.2.9.2/29
10.2.9.3/29
10.2.9.4/29
10.2.9.5/29
10.2.9.6/29
but this is not quite what I need.
what i need is a list that would look like this:
10.2.9.2
10.2.9.3
10.2.9.4
10.2.9.5
10.2.9.6
Note that I have removed the /29 and the 10.2.9.1 as this is the gateway address for that subnet.
(all gateway addresses would always be the first available address within a given subnet.)
And this subnet would come from the command line, therefore it would be changing.
How could I achieve this goal?
Thanks,
Marc
In reply to ip address list by mlebel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |