Every device on the Internet needs a unique address to communicate with each other. This address is called the Internet Protocol (IP) Address.
An IPv4 address is 32 bits long -- thirty-two 1s and 0s. For example:
|IPv4 Address 192.168.0.1|
|Binary||1100 0000||1010 1000||0000 0000||0000 0001|
and is expressed in 4 doted octets format. An (unsigned) octet is 8 bits in size thus the smallest value (where all 8 bits are 0) is 0 (in decimal) while the largest value (while all 8 bits are 1) is 255.
IPv6 address however is 128 bits long and is expressed in 8 groups of 4 hexadecimal digits. A hexadecimal digit can hold up to 16 unique values thus it is represented in 0 (when all 4 bits are 0) and F (when all 4 bits are 1).
IP prefix is an IP address expressed in CIDR notation. It carries two (2) information important information for routers on the internet to be able to deliver the traffic to its destination. These information are: (a) Network ID (or network prefix) and (b) Host ID. Network ID represents which network the address belongs to while Host ID represents end device (within the network) it is intended for. Keep in mind that the last address in a network is used as broadcast address (sending traffic to all the hosts within the same network).
The prefix in CIDR notation indicates the number of bits (from left to right) is used to identify the network. Following are examples of IPv4 prefix in CIRD notation:
Example 1: a prefix of 192.168.0.1/24 dictates that the first 24 bits represents the network while the remaining 8 (32-8) bits represents the host. In this case Network ID is 192.168.0.0 and the host address starts from 192.168.0.0 and ends at 192.168.0.254 (.255 is broadcast).
Example 2: a prefix of 192.168.0.129/25 dictates that the first 25 bits represents the network and therefore the Network ID is 192.168.0.128 and the host address starts from 192.168.0.129 and ends at 192.168.0.254 (.255 is broadcast). This is because the first 25 bits of 192.168.0.129 (11000000.10101000.00000000.10000001) summed up to 192.168.0.128 (11000000.10101000.00000000.10000000).
Example 3: a prefix of 192.168.3.88/23 dictate that the first 23 bits represents the network and therefore the Network ID is 192.168.2.0 and the host address starts from 192.168.2.1 and ends at 192.168.3.254 (.255 is broadcast). This is because the first 23 bits of 192.168.3.88 (11000000.10101000.00000011.00101100) summed up to 192.168.2.0 (11000000.10101000.00000010.00000000).
Example 4: a prefix of 192.168.123.123/32 dictates that the first 32 bits represents the network and therefore both the Network ID and Host ID will be 192.168.123.123.
While it is true that any IP address (if it follows the rules above) can be used as valid IP address, however some of the addresses are reserved for special purpose. Table below lists all the IP prefixes that have special purpose are not routable over the internet.
|127.0.53.53||Name collision occurrence|
|192.0.0.0/24||IETF protocol assignments|
|198.18.0.0/15||Network interconnect device benchmark testing|
|240.0.0.0/4||Reserved for future use|
Below is a table to inter-convert between CIDR and sub net mask:
|CIDR prefix||Sub net mask||Number of IP addresses|