Help for this page

Select Code to Download


  1. or download this
    qwurx [shmem] ~ > perl - 172.24.43.226/27
    $m=pack B32,pop=~'/'x$';printf"$` net %vd bc %vd mask %vd\n",($z=eval$
    +`)&$m,$z|~$m,$m
    __END__
    172.24.43.226 net 172.24.43.224 bc 172.24.43.255 mask 255.255.255.224
    
  2. or download this
    sub get_boundaries {
        my ($ip, $bits) = split /\//, $_[0];
    ...
        my $b_bcast     = $b_ip | ~ $b_mask;
        unpack("N", $b_net), unpack("N",  $b_bcast);
    }
    
  3. or download this
    sub in_range {
        my ($cidr, $ip)  = @_;
    ...
        $i_ip > $low && $i_ip < $high;
    }
    print "yup\n" if in_range("172.24.43.226/27", "172.24.43.236");