A Subnet Mask separates the Network ID from the Host ID in an IP address.
When written in binary, 255.255.255.0 becomes 11111111.11111111.11111111.00000000.
- Where the Subnet Mask has 255 (or 11111111 in binary), that part of the IP address is the Network ID.
- Where the Subnet Mask has 0 (or 00000000 in binary), that part of the IP address is the Host ID.
Example:
IP Address: 192.168.0.1/24
Subnet Mask in CIDR notation: /24
Subnet Mask in Decimal notation: 255.255.255.0
Subnet Mask in Binary: 11111111.11111111.11111111.00000000
So it implies that 1st, 2nd and 3rd Octets of the IP address denotes Network ID and the last 4th Octet of the IP address is the Host part as shown below:
Network ID - 192.168.0
Host ID - 1