Everything is working on binary number system in computers, so it is valid in IP addresses as well.
Assume that IP address is 192.168.1.0
in dotted-decimal format is equal to 11000000.10101000.00000001.00000000
in dotted-binary format.
Assume that Subnet Mask is 255.255.255.0
in dotted-decimal format is equal to 11111111.11111111.11111111.00000000
in dotted-binary format. Subnet Mask is shown in /24
in slash notation(known as CIDR notation)
IP Address with Subnet Mask can be shown in CIDR notation 192.168.1.0/24
CIDR gives a concise way to represent both an IP network and its size using a combination of an IP address and a number after a slash.
Subnet Mask is 24
after slash in decimal representation. In order to find out 24
, Subnet mask should be represented in binary number system like 11111111.11111111.11111111.00000000
. So, just count how many 1
bit there are in Subnet Mask.
IP Address and Subnet Mask in Decimal format:
IP Address: 192.168.1.0
Subnet Mask: 255.255.255.0
IP Address and Subnet Mask in CIDR format:
192.168.1.0/24
IP Address and Subnet Mask in Binary format:
IP Address: 11000000.10101000.00000001.00000000
Subnet Mask: 11111111.11111111.11111111.00000000