- Posts: 34
- Thank you received: 0
How to calculate valid CIDR block
15 years 7 months ago #30235
by lav_plsb1
How to calculate valid CIDR block was created by lav_plsb1
Hi,
www.firewall.cx/supernetting-chart.php
From the above mentioned link, could you plz explain how to calculate the no. of networks from /24 and number of hosts from /14 again how come class c has /14 thru /30 as a valid blocks.
From CIDR block /25 we are subnetting not supernetting but we still include as a valid CIDR block.
i had gone thru the below mentioned link
www.firewall.cx/ftopict-5756-supernetting.html
www.firewall.cx/supernetting-chart.php
From the above mentioned link, could you plz explain how to calculate the no. of networks from /24 and number of hosts from /14 again how come class c has /14 thru /30 as a valid blocks.
From CIDR block /25 we are subnetting not supernetting but we still include as a valid CIDR block.
i had gone thru the below mentioned link
www.firewall.cx/ftopict-5756-supernetting.html
15 years 7 months ago #30269
by lav_plsb1
Replied by lav_plsb1 on topic Re: How to calculate valid CIDR block
Hi,
I am looking for your answer guys..
I am looking for your answer guys..
- broadcaststorm
- Offline
- Junior Member
Less
More
- Posts: 79
- Thank you received: 0
15 years 7 months ago #30270
by broadcaststorm
Replied by broadcaststorm on topic Re: How to calculate valid CIDR block
My first post, and it's going to be controversial!!!
I'm not sure I like the supernetting example as it has been set out. I ALWAYS work on the principle that you cannot, and indeed should not, use fewer bits in the subnet mask than would be allowed by the classful address. In other words, if you have a class C address to subnet, you should not use a mask or a prefix length that has less than 24 bits. So for a class B address, a mask of not less than 16 bits is appropriate, and for class A, no less than 8 bits. Why? Well, if you are unfortunate enough to forget to switch off Auto-Summarisation in EIGRP, if you try to apply, for example, a class C address (lets say 192.168.10.0/22), then when it hits the auto-summarisation part, EIGRP will summarise it back to a 24 bit mask, effectively invalidating all your subnetting/supernetting calculations and making a big mess of your addressing scheme.
So whilst you can do the maths and calculate the subnets and hosts, applying an address with an invalid subnet mask may not work as you expect.
Or I've missed something important!!!!
As for calculating the number of networks and/or number of hosts, it's easy. The subnet mask value or prefix length gives you the number of bits that are used for the network portion of the address.
The last bit in the subnet mask that is switched on (set to 1) will equate to a binary value in whichever octet is being used for the network portion of the address. That bit value gives us the block size. The block size is the number we use to give us our network numbers, and from there we can calculate the hosts and how many there may be. For example, lets imagine we have a /27 number. /27 means 27 bits in the subnet mask are switched to 1. The 27th bit is the third bit along in the last octet. The octet values are:
128 64 32 16 8 4 2 1
So we can design a look up chart/network chart to help us with our calculations:
[code:1]
128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 0
128 64 32 16 8 4 2 1
128 64 32 16 8 4 2
192 96 64 32 12 8 3
128 96 48 16 12 4
[/code:1]
The patterns should be evident from this, and this gives us our networks numbers, based on the bit value. The numbers are our network "block sizes"
If this is the last octet, then counting left to right, bit number 25 gives us a vlaue and a block size of 128. Bit 26 gives us a bit value and a block size of 64, and bit number 27 (our /27 number) gives us a value of 32. So we have values starting from 0, and going up in lumps of 32, 32, 64, 96, 128, 160, 192 and 224, giving us 8 networks. If we draw a chart using those known numbers as our networks addresses (which they are) we can also calculate the valid host numbers, like this:
[code:1]
Network First Host Last Host Broadcast
0 1 30 31
32 33 62 63
64 65 94 95
96 97 126 127
128 129 158 159
160
192
224
[/code:1]
There are some easy to follow rules to work these numbers out, so try the last few for yourself.
Start with the network address. The first host is always the network number + 1.
Then do the broadcast address. The broadcast address is always the NEXT network number -1.
Then do the last host. The last host is always the broadcast address -1. The numbers between the first host and the last host are all valid hosts in the network range, and of course you have already calculated the broadcast and network addresses which cannot be used for host addresses. Easy. No binary, no 2 to the powers of, just adding up and subtracting 1 from known numbers, and a little multiplaction required from the bit value block size. Easy!
I'm not sure I like the supernetting example as it has been set out. I ALWAYS work on the principle that you cannot, and indeed should not, use fewer bits in the subnet mask than would be allowed by the classful address. In other words, if you have a class C address to subnet, you should not use a mask or a prefix length that has less than 24 bits. So for a class B address, a mask of not less than 16 bits is appropriate, and for class A, no less than 8 bits. Why? Well, if you are unfortunate enough to forget to switch off Auto-Summarisation in EIGRP, if you try to apply, for example, a class C address (lets say 192.168.10.0/22), then when it hits the auto-summarisation part, EIGRP will summarise it back to a 24 bit mask, effectively invalidating all your subnetting/supernetting calculations and making a big mess of your addressing scheme.
So whilst you can do the maths and calculate the subnets and hosts, applying an address with an invalid subnet mask may not work as you expect.
Or I've missed something important!!!!
As for calculating the number of networks and/or number of hosts, it's easy. The subnet mask value or prefix length gives you the number of bits that are used for the network portion of the address.
The last bit in the subnet mask that is switched on (set to 1) will equate to a binary value in whichever octet is being used for the network portion of the address. That bit value gives us the block size. The block size is the number we use to give us our network numbers, and from there we can calculate the hosts and how many there may be. For example, lets imagine we have a /27 number. /27 means 27 bits in the subnet mask are switched to 1. The 27th bit is the third bit along in the last octet. The octet values are:
128 64 32 16 8 4 2 1
So we can design a look up chart/network chart to help us with our calculations:
[code:1]
128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 0
128 64 32 16 8 4 2 1
128 64 32 16 8 4 2
192 96 64 32 12 8 3
128 96 48 16 12 4
[/code:1]
The patterns should be evident from this, and this gives us our networks numbers, based on the bit value. The numbers are our network "block sizes"
If this is the last octet, then counting left to right, bit number 25 gives us a vlaue and a block size of 128. Bit 26 gives us a bit value and a block size of 64, and bit number 27 (our /27 number) gives us a value of 32. So we have values starting from 0, and going up in lumps of 32, 32, 64, 96, 128, 160, 192 and 224, giving us 8 networks. If we draw a chart using those known numbers as our networks addresses (which they are) we can also calculate the valid host numbers, like this:
[code:1]
Network First Host Last Host Broadcast
0 1 30 31
32 33 62 63
64 65 94 95
96 97 126 127
128 129 158 159
160
192
224
[/code:1]
There are some easy to follow rules to work these numbers out, so try the last few for yourself.
Start with the network address. The first host is always the network number + 1.
Then do the broadcast address. The broadcast address is always the NEXT network number -1.
Then do the last host. The last host is always the broadcast address -1. The numbers between the first host and the last host are all valid hosts in the network range, and of course you have already calculated the broadcast and network addresses which cannot be used for host addresses. Easy. No binary, no 2 to the powers of, just adding up and subtracting 1 from known numbers, and a little multiplaction required from the bit value block size. Easy!
Time to create page: 0.150 seconds