# In Depth of Subnet , Subnet Masks

Before we begin, you need to refresh your math on power. Following is an illustration.

2^0 = 1
2^1 = 2
2^2 = 2 x 2 = 4
2^3 = 2 x 2 x 2 = 8
2^4 = 2 x 2 x 2 x 2 = 16
2^5 = 32
2^6 = 64
2^7 = 128
2^8 = 256

In terms of subnetting,

```1   = /32 = 255.255.255.255
2   = /31 = 255.255.255.254
4   = /30 = 255.255.255.252
8   = /29 = 255.255.255.248
16  = /28 = 255.255.255.240
32  = /27 = 255.255.255.224
64  = /26 = 255.255.255.192
128 = /25 = 255.255.255.128
256 = /24 = 255.255.255.0

In terms of IP address quantity```
```/32: 2^0 = 1                        =   1 IP address within the subnet
/31: 2^1 = 2 of /32 = 2 x   1 =   2 =   2 IP addresses within the subnet
/30: 2^2 = 2 of /31 = 2 x   2 =   4 =   4 IP addresses within the subnet
/29: 2^3 = 2 of /30 = 2 x   4 =   8 =   8 IP addresses within the subnet
/28: 2^4 = 2 of /29 = 2 x   8 =  16 =  16 IP addresses within the subnet
/27: 2^5 = 2 of /28 = 2 x  16 =  32 =  32 IP addresses within the subnet
/26: 2^6 = 2 of /27 = 2 x  32 =  64 =  64 IP addresses within the subnet
/25: 2^7 = 2 of /26 = 2 x  64 = 128 = 128 IP addresses within the subnet
/24: 2^8 = 2 of /25 = 2 x 128 = 256 = 256 IP addresses within the subnet

For /24 to /32 subnets, the 1st three octets remain the same. The only octet that changes is the 4th octet (the last octet).

Subnetting always relates to something called Subnet Mask. Subnet Mask is the way an IP address represent which subnet it is under.

To show you how a subnet mask looks like, let's review the previous table.

```
```1   = /32 = 255.255.255.255
2   = /31 = 255.255.255.254
4   = /30 = 255.255.255.252
8   = /29 = 255.255.255.248
16  = /28 = 255.255.255.240
32  = /27 = 255.255.255.224
64  = /26 = 255.255.255.192
128 = /25 = 255.255.255.128
256 = /24 = 255.255.255.0```
```IP Address Quantity    CIDR format subnet mask      4-tuple octet format subnet mask
Within Subnet             (Prefix)
1                      /32                         255.255.255.255
2                      /31                         255.255.255.254
4                      /30                         255.255.255.252
8                      /29                         255.255.255.248
16                      /28                         255.255.255.240
32                      /27                         255.255.255.224
64                      /26                         255.255.255.192
128                      /25                         255.255.255.128
256                      /24                         255.255.255.0```