Tuesday, January 25, 2022

TCP IP subnetting

 If you can multiply and divide by 2, you can do this on paper or in your head.

I find it's easiest to start from the basic fact of a Class C subnet:

Class C = /24 = 256-2 = 254 hosts  

For more than 254 hosts, you will supernet, for fewer than 254, you will subnet.  
You always use 256 as your base to make the calcs easier.

For supernetting, multiply by 2, then subtract 2 (network and broadcast addresses).  Each time you double the number of class C subnets, you decrease the subnet mask in / notation by 1.
For subnetting, divide by 2, then subtract 2.  Each time you divide by 2, increase the subnet mask in / notation by 1.

Subnet: 256/2 = 128-2 = 126 hosts with a /25 mask (1/2 of a Class C)
Supernet: 2*256 - 2 hosts = 510 hosts with a /23 mask.(2 Class C's)

Keep multiplying or dividing by 2 until you meet your hosts needs.

I'll change your example so that I start at the same place but I need 1100 hosts and 5 networks.  Based on this, /23 isn't enough.  Therefore we repeat the multiplication process:

        2*2*256 = 4*256 = 1024-2 = 1022 hosts with a /22 mask.
        This is 4 Class C's supernetted together.
Still not enough, repeat:
       2*2*2*256 = 8*256 = 2048-2 = 2046 hosts with a /21 mask.
        This is 8 Class C's supernetted together and covers our needs.

So now you need to know where each range starts and stops.

You know your start: is the first subnet so the first usable address is

You know your mask is /21 and you need 8 class-C's.  This means you simply count up 8 subnets from the start, (remembering to include the first 130.131.0 subnet), then put .255 in the last octet for broadcast.  So in my example, I get:
        Subnet 1:   Broadcast:

For the next and subsequent subnets, add the number of class C's to the 3rd octet and repeat:
        Subnet 2:  Broadcast:

Repeat this for however many networks you need.  The pattern becomes pretty clear so you can simply add the number of Class C's to the 3rd Octet of each previous subnet and broadcast

I'm not sure what you mean by first and last IP.  I assumed you meant network and broadcast addresses.

Hope this helps.