help figuring out CIDR notation and calculations
ladiesman217
Member Posts: 416
in CCNA & CCENT
Address: 192.168.4.161 11000000.10101000.00000100.1 0100001
Netmask: 255.255.255.128 = 25 11111111.11111111.11111111.1 0000000
Wildcard: 0.0.0.127 00000000.00000000.00000000.0 1111111
=>
Network: 192.168.4.128/25 11000000.10101000.00000100.1 0000000 (Class C)
Broadcast: 192.168.4.255 11000000.10101000.00000100.1 1111111
HostMin: 192.168.4.129 11000000.10101000.00000100.1 0000001
HostMax: 192.168.4.254 11000000.10101000.00000100.1 1111110
Hosts/Net: 126 (Private Internet)
I'm confused doing the math in these example. Now, How do you get the net mask =25 (192.168.4.128/25).
I found this table and now I'm curious how to do the math. Lets say /1, what is it's significance to 128.0.0.0?
What would be the easiest way to find the available number of host?
thanks in advance.
CIDR Netmask (Dot Notation) Number of Hosts
/1 128.0.0.0
/2 192.0.0.0
/3 224.0.0.0
/4 240.0.0.0
/5 248.0.0.0
/6 252.0.0.0
/7 254.0.0.0
/8 255.0.0.0
/9 255.128.0.0
/10 255.192.0.0
/11 255.224.0.0
/12 255.240.0.0
/13 255.248.0.0
/14 255.252.0.0
/15 255.254.0.0
/16 255.255.0.0
/17 255.255.128
/18 255.255.192.0
/19 255.255.224.0
/20 255.255.240.0
/21 255.255.248.0
/22 255.255.252.0
/23 255.255.254.0
/24 255.255.255.0 256
/25 255.255.255.128 128
/26 255.255.255.192 64
/27 255.255.255.224 32
/28 255.255.255.240 16
/29 255.255.255.248 8
/30 255.255.255.252 4
/31 255.255.255.254 2
/32 255.255.255.255 1
Netmask: 255.255.255.128 = 25 11111111.11111111.11111111.1 0000000
Wildcard: 0.0.0.127 00000000.00000000.00000000.0 1111111
=>
Network: 192.168.4.128/25 11000000.10101000.00000100.1 0000000 (Class C)
Broadcast: 192.168.4.255 11000000.10101000.00000100.1 1111111
HostMin: 192.168.4.129 11000000.10101000.00000100.1 0000001
HostMax: 192.168.4.254 11000000.10101000.00000100.1 1111110
Hosts/Net: 126 (Private Internet)
I'm confused doing the math in these example. Now, How do you get the net mask =25 (192.168.4.128/25).
I found this table and now I'm curious how to do the math. Lets say /1, what is it's significance to 128.0.0.0?
What would be the easiest way to find the available number of host?
thanks in advance.
CIDR Netmask (Dot Notation) Number of Hosts
/1 128.0.0.0
/2 192.0.0.0
/3 224.0.0.0
/4 240.0.0.0
/5 248.0.0.0
/6 252.0.0.0
/7 254.0.0.0
/8 255.0.0.0
/9 255.128.0.0
/10 255.192.0.0
/11 255.224.0.0
/12 255.240.0.0
/13 255.248.0.0
/14 255.252.0.0
/15 255.254.0.0
/16 255.255.0.0
/17 255.255.128
/18 255.255.192.0
/19 255.255.224.0
/20 255.255.240.0
/21 255.255.248.0
/22 255.255.252.0
/23 255.255.254.0
/24 255.255.255.0 256
/25 255.255.255.128 128
/26 255.255.255.192 64
/27 255.255.255.224 32
/28 255.255.255.240 16
/29 255.255.255.248 8
/30 255.255.255.252 4
/31 255.255.255.254 2
/32 255.255.255.255 1
No Sacrifice, No Victory.
Comments
-
dynamik Banned Posts: 12,312 ■■■■■■■■■□The slash-notation is just a shorthand way of writing out the subnet mask. It represents the number of bits in the mask. For example:
/1 = 100000000.00000000.00000000.00000000 = 128.0.0.0
/2 = 110000000.00000000.00000000.00000000 = 192.0.0.0
etc.
To find the number of host bits, subtract that number from 32. So if you have /28, 32-28=4, you will have 4 host bits. The formula for finding hosts is 2 to the power of the number of bits minus 2. In this example, it'll be 2^4-2, which gives you 14. -
phoeneous Member Posts: 2,333 ■■■■■■■□□□The number in the slash notation represents a number of bits. So a /1 is 1 bit or10000000 00000000 00000000 00000000. A /17 is 17 bits or 11111111 11111111 10000000 00000000. You get the idea.
Just remember that your decimal increments are equivalent to each respective bit. The decimal increments being 128 64 32 16 8 4 2 1
So a /8 would look like this:
[binary] 11111111 . 00000000 . 00000000 . 00000000
[decimal] 128+64+32+16+8+4+2+1 . 0+0+0+0+0+0+0+0 . 0+0+0+0+0+0+0+0 . 0+0+0+0+0+0+0+0
[notation] 255.0.0.0
And a /23 would look like this
[binary] 11111111 . 11111111 . 11111110 . 00000000
[decimal] 128+64+32+16+8+4+2+1 . 128+64+32+16+8+4+2+1 . 128+64+32+16+8+4+2+0 . 0+0+0+0+0+0+0+0
[notation] 255.255.254.0 -
ladiesman217 Member Posts: 416Thanks for replies. Now I have a question.
I need to manually assign IP for Host A
I run Ipconfig and discovers a subnet mask of 255.255.255.128.
Here's the exhibit.
Now what is the range of possible address can be use for Host A?
How do I find the subnet address and the broadcast address?
I've read some procedures but it seems to long. Anyone can show me a short cut?
thanks!No Sacrifice, No Victory. -
chrisb0975 Member Posts: 7 ■□□□□□□□□□Ladiesman, with the scenario you presented I've found the easiest way to find the network range so far is:
Since you have the subnet mask already in decimal, take the last non-255 octet's value and subtract from 256.
256 - 128 = 128
128 is the number of hosts per subnet.
Now take your known network 192.168.4.0 and increment it by the number of hosts to build out the ranges, working in the non-255 octet
192.168.4.0 - 192.168.4.127
192.168.4.128 - 192.168.4.255 <-- this is your range for this scenario
When you build out the network ranges this way, you already see the subnet and broadcast IDs.
The subnet ID is the first IP address in the range. In this case 192.168.4.128
The broadcast ID is the last IP address in the range. In this case 192.168.4.255
That leaves the valid IP address range that can be assigned to hosts:
192.168.4.129 - 192.168.4.254
It took me sometime and trying out various methods with frustrating results before everything clicked. I tend to use subnet-calculator.com as a way to double check my answers for scenarios I test myself on. -
phoeneous Member Posts: 2,333 ■■■■■■■□□□Just so you know, shortcuts arent the answer if you dont fully understand the theory and the math.
But anyway, here you go.
The range of the subnet can be figured out by the last non-zero octet of the mask. First you need to know the range of common subnet masks and the power of 2 range.
128 192 224 240 248 252 254 255
128 64 32 16 8 4 2 1
So, a subnet mask of ending in 240 like 255.240 or even 255.255.240 will go in increments of 16. A subnet mask ending in 192 will go in increments of 64. You get the idea.
In the example you gave, the mask is /25 or 255.255.255.128. This means that your subnet range will be in increments of 128.
Subnet 1:
192.168.4.0 - 192.168.4.128
Subnet 2:
192.168.4.129 - 192.168.4.255
4.0, 4.128, 4.129, and 4.255 cannot be used for hosts since they are network and broadcat address. So theoretically you can only have 126 hosts per subnets.