Your solution works, but I need to add 1 to the address of the broadcast address, so I can begin the next sub-network. Your solution returns the numberic() of the current address field, which is the base network address.
amt
Comment on Re^2: NetAddr::IP Automated Subnet Allocation
Your solution returns the numberic() of the current address field, which is the base network address.
Not so. Did you type in $net_addr where you should have typed $net_broadcast?
use NetAddr::IP ();
my $net_addr = NetAddr::IP->new('192.168.1.0/29');
my $net_broadcast = $net_addr->broadcast();
my $net_newaddr;
{
my ($addr, $mask) = $net_broadcast->numeric();
$net_newaddr = NetAddr::IP->new($addr+1, $mask);
}
print("$net_addr\n"); # prints 192.168.1.0/29
print("$net_broadcast\n"); # prints 192.168.1.7/29
print("$net_newaddr\n"); # prints 192.168.1.8/29