Converting Between Binary and Prefix Masks

Converting between binary and prefix masks should be relatively intuitive after you know that the prefix value is simply the number of binary 1s in the binary mask. For the sake of completeness, the processes to convert in each direction are

Image

Binary to prefix: Count the number of binary 1s in the binary mask, and write the total, in decimal, after a /. Prefix to binary: Write P binary 1s, where P is the prefix value, followed by as many binary 0s as required to create a 32-bit number.

Tables 15-2 and 15-3 show some examples.

Table 15-2 Example Conversions: Binary to Prefix

Table 15-3 Example Conversions: ...

Get CCNA Data Center DCICN 640-911 Official Cert Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.