Category Archives: ipv4

Perl code to find an IP A in subnet B/C

my $ip = ‘1.2.3.4’; my $block1 = ‘1.2.3.0/27’; if(checkip($ip, $block1)) { print STDOUT “$ip is in $block1\n”; } else { print STDOUT “$ip is not in $block1\n”; } sub checkip() { my $ip = shift; my $block = shift; @ip1 … Continue reading

Posted in How Tos, ip addressing, ipv4, networking, perl, Programming | Leave a comment