[olug] Subnet mask

Jay Hannah jay at jays.net
Tue Dec 16 04:26:10 UTC 2003


Subnets for that range:
http://jays.net/cgi-bin/ipr.pl?ip1=205.202.101.64&ip2=205.202.101.93

Source code:
http://jays.net/ipr.pl.txt

Omaha Perl Mongers:*
http://omaha.pm.org

j

* Anyone sick of me plugging this yet? If so I'll quit.


On Saturday, December 13, 2003, at 04:11 PM, Daniel Linder wrote:

>> I am having a brain freeze and I cannot for the life of me figure this
>> out.  I have been given a range of numbers to use at my job and I 
>> cannot
>> figure out the subnet mask...Help!
>> The numbers are 205.202.101.64-205.202.101.93.  Class C address from
>> authority.  I know that by thinking about it, it is divided into 4
>> subnets, right? (30 numbers into 128 is 4 times+).  ugh.  My head 
>> hurts
>> today...
>
> Here is a handy perl code snippet to help in times like these...
> (Might need to run "perl -MCPAN -e 'install Net::CIDR'" to install the
> Net::CIDR module.)
>
> --- Begin perl code ---
> #!/usr/bin/perl
> use Net::CIDR;
> use Net::CIDR ':all';
>
>
> @list2=();
> $x=64;
> while ($x <= 93) {
>         $line = "205.202.101.".$x;
>         push(@list2,$line);
>         $x++;
> }
>
> printf ("These addresses:\n");
> foreach (@list2) {
>         @cidr_list=Net::CIDR::cidradd($_, @cidr_list);
>         printf ("$_, ");
> }
> printf ("\n\nSummarize to the following:\n");
>
> foreach (@cidr_list) {
>                 printf ("-->$_\n");
> }
> --- End perl code ---
>
> This program roduces this output:
> --- Begin output ---
> These addresses:
> 205.202.101.64, 205.202.101.65, 205.202.101.66, 205.202.101.67,
> 205.202.101.68, 205.202.101.69, 205.202.101.70, 205.202.101.71,
> 205.202.101.72, 205.202.101.73, 205.202.101.74, 205.202.101.75,
> 205.202.101.76, 205.202.101.77, 205.202.101.78, 205.202.101.79,
> 205.202.101.80, 205.202.101.81, 205.202.101.82, 205.202.101.83,
> 205.202.101.84, 205.202.101.85, 205.202.101.86, 205.202.101.87,
> 205.202.101.88, 205.202.101.89, 205.202.101.90, 205.202.101.91,
> 205.202.101.92, 205.202.101.93,
>
> Summarize to the following:
> -->205.202.101.64/28
> -->205.202.101.80/29
> -->205.202.101.88/30
> -->205.202.101.92/31
> --- End output ---
>
> So, these are the four subnet ranges that cover the .64 through .93
> inclusively.
>
> Dan
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug



More information about the OLUG mailing list