IP address and subnets.
So IP address is 8 bits displayed on 4 octets in 0-255.
IPv4 ranges are: 0.0.0.0 - 255.255.255.255
You have two parts to an IP address. You have the Network Address and you have the Host Address. This is determined by the subnet mask.
If you go to Command Prompt and type in 'ipconfig' you will see your IP address and subnet mask.
My IP address is: 10.0.0.11 with subnet mask: 255.255.255.0.
So I have a Network address of 10.0.0.0 with the Host addresses ranging from 10.0.0.1 - 10.0.0.255.
Another way to write an IP address is: 10.0.0.11/24 which means the /24 is the 255.255.255.0 Subnet.
Now it just so happens that you can make the subnet mask whatever you want. You can have a total of 255 Host addresses to play with and you may want to further divide that into two or more networks.
Now with the way that subnetting works, you basically work in the power of 2's by doubling or halving.
0 - 255 is a total of 256. If I want 5 hosts I will need to have a subnet which will accept 8 total host addresses.
If I have a subnet mask of 255.255.255.128 then that Network has been split in two with 128 Host addresses each.
So if I want a network with a total of 5 host addresses the subnet mask will be 255.255.255.248 or 10.0.0.0/29. The next network address will be: 10.0.0.8/29 then 10.0.0.16/29 etc.
Now you can turn these octets into binary. I said before there are 8 bits in each octet. Binary works in 0 and 1.
255 = 11111111
Think of binary as:
128, 64, 32, 16, 8, 4, 2, 1
...1.....1....1...1..1..1..1..1
1 means on and 0 means off. If all the numbers are 1 then you add up the numbers and you will get 255.
So if I want to get 248 I will take the bits from left to right and try to get 248. So the last subnet in binary will be: 11111000 (128 + 64 + 32 + 16 + 8 = 248)
If you add 4 + 2 + 1 you will have a subnet with a total of 7 host addresses. You have to include the network address which will go up in multiple's of 8 so that's the extra host address.
10.0.0.0 is the Network address and 10.0.0.7 is the last available host address in that network if the subnet mask is 255.255.255.248. (Count up in multiple of 8 to determine each network address).
Now the very first address is the Network address and the very last address is the broadcast address. So every single network will have the grand total of useable addresses - 2 for the Network and broadcast address.
So when you have 8 useable addresses, you will be able to use 6 of those IP addresses for host addresses.
Once you understand this concept then you can use this cheat sheet for help.
https://kthx.at/subnetmask/ I hope this helps.