This is for IPV4
only. IPV6 is a completely different breed of horse. I won't cover it
here. IPV4 is still in use and will be for awhile.
I hope this is understandable.
Stay with BINARY. It is the only sure and safe way to go when working with IP addressing.
RULES FOR SUBNETTING
Default masks Address
Max hosts w/0 bits borrowed -2
Class A 1 - 126 (First bit = 0) 0xxxxxx
Class B 128 - 191 (first 2 bits = 10) 10xxxxxx
Class C 192- 223 (First 3 bits = 110) 110xxxxx
Finding the number of the subnet a given address is on for Class A (see Long Division for Class B)
What subnet is 22.214.171.124/27 on?
The /27 tells us that 27 bits are used for networks, or 19 bits were borrowed, this means all of the 2nd and 3rd octets and 3 bits of the 4th octet were borrowed for networks. 122 is the assigned network address so this is left alone. Work only with the last 3 octets - 10.10.156
Lay it out in binary as follows -
Put the numbers 10.10.156 into the 2nd, 3rd and 4th octets
Discarding the leading zeros in the 2nd octet, we have:
then add the binary number up
126.96.36.199/27 is on the 20564th subnet.
What is the subnet mask of 188.8.131.52/27?
Using Binary math with the subnet mask you will be able to find the wire address of this subnet.
Subnet mask = 255.255.255.224
We know the wire address starts with 122.10.10 so all we have to add is the 4th octets
11100000 = 224
10000000 = 128
184.108.40.206 is the wire address for 220.127.116.11/27.
A class B address is done the same way. Just use the last 2 octets
What is the 565th subnet of 18.104.22.168/27?
Again, we know that 19 bits were borrowed, giving us
122. _ _ _ _ _ _ _ _ ._ _ _ _ _ _ _ _ . _ _ _
Starting with the LAST bit borrowed in the 4th octet, plug in 565
122 . _ _ _ _ _ _ _ _ . 01000110 . 101
We now know that the address starts with 122.0
We now have 122 . 0. 01000110.10100000
Convert octets 3 and 4 to decimal and we have the address:
01000110 = 70
The address for the 565th subnet of 22.214.171.124/27 is 126.96.36.199
What is the 4050th subnet of 188.8.131.52/20?
How can we determine if an address is a valid Host, Wire or Broadcast
193.10.10._ _ _ _ | _ _ _ _
There is a '1' in the host portion of the address, so this makes 184.108.40.206 a valid host address.
(You must have at LEAST a single "1" in the host portion to make it a valid host address)
If we have 220.127.116.11/28, we get 193.10.10.0011|0000 so this makes
it a Wire address.
All 1's in the HOST portion indicates a broadcast address.
30 bits for networks (22 bits borrowed) and 2 bits for hosts. Plug
the '50' in like before.
What would be the first usable network address for 18.104.22.168/30?
4 is the decimal value of the LAST bit borrowed so our first usable network (wire) address would be 22.214.171.124, our first host address on this wire would be 126.96.36.199, the last host address on this wire would be 188.8.131.52 and the broadcast address for this wire would be 184.108.40.206. The second wire address would be 220.127.116.11 (increment of 4 from the first usable wire address.
Can we subnet private addresses? Yes. You can do the same thing with private addresses that you can do with public addresses - except go out on the internet with them.