Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I need to increase the network address of a subnet, rather than increasing the ip address
ex: 20.20.20.1/24, the next should be 20.20.21.1/24, 20.20.255.1/24, 20.21.20.1/24 and so on. I have user NetAddr::IP, which only increments ip address. Is there any function to increment the network address
my $ip_add = NetAddr::IP->new('20.20.20.1/24'); for (my $ip = 1; $ip<=2000; $ip++) { my $iponly = (split '/', $ip_add)[0]; print "$iponly\n";
the above code prints from 20.20.20.1- 20.20.20.255
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Increasing the network space in IP
by salva (Canon) on Jan 28, 2016 at 09:19 UTC | |
|
Re: Increasing the network space in IP
by poj (Abbot) on Jan 28, 2016 at 08:56 UTC |