An IP address is a 32-bit number assigned to a specific network device. Instead of representing it as a single number, IP addresses are typically displayed in four 8-bit segments, each ranging from 0 to 255.

This format, such as 192.168.0.1, is more user-friendly compared to the binary representation of 11000000101010000000000000000001. To comprehend netmasks, it's crucial to understand that IP addresses essentially form a continuous string of numbers.

What is a Netmask

A netmask indicates the number of IP addresses within a specific block. However, not all netmasks are valid, and you can't pair any netmask with a random IP address.

The commonly encountered netmask, 255.255.255.0, implies 256 usable IP addresses in a network block. For instance, if your machine has the IP address 10.5.3.12 with a netmask of 255.255.255.0, it means your local network accommodates up to 255 other IP addresses.

This netmask was once referred to as a class C network, though such classifications have been obsolete for around a decade.

Bringing them together

A netmask essentially separates the network and host IP addresses.

In a standard 255.255.255.0 netmask, the first 24 bits are fixed, while the last 8 bits can be altered. The netmask size is denoted by the number of 1s in it. For instance, a /24 netmask has 24 1s, and it is often written as 192.168.1.0/24.

While the 8-bit boundary is convenient, netmasks can be valid with different boundaries, as long as they are multiples of two. IP addresses are issued in blocks corresponding to these multiples, such as /27 for 32 addresses or /28 for 256 addresses. The first and last addresses in any block are unusable, and assigning an IP address ending in .0 or .255 is not allowed in a network with a netmask of 255.255.255.0.

Netmask & BGP

For routing with BGP, a network must be at least a /24 in size. Legitimate blocks must be multiples of two, ensuring that each block is a multiple of its own size. For example, the block 192.168.4.0–192.168.5.255 is a legitimate /23 network.

However, assessing legitimacy becomes complex for larger blocks, requiring careful consideration of their size and overlap with other potential networks.

Tagged in: