Urgent.News

What's breaking now, across thousands of outlets.

Tech

CIDR and Subnet Mask

Hello All, I would like to share something I learned while preparing for the AWS Certified Advanced Networking - Specialty (ANS-C01) certification. One of the topics that took me some time to fully understand was: Decimal-to-binary conversion How CIDR notation works How to determine the network and broadcast address of a subnet This may be a topic that others have already covered, but I thought…

To grasp CIDR notation and subnet masks, one must first convert decimal IP addresses into binary format, as computers process binary data (bits). Each octet of an IP address consists of 8 bits, with place values of 128, 64, 32, 16, 8, 4, 2, and 1. For instance, the decimal value 192 converts to binary as 11000000 by comparing it against the place values and writing either a 1 or a 0 based on whether the remaining number is greater than or equal to the column value.

When dealing with a CIDR notation like /18, this indicates that the first 18 bits of the IP address are designated for the network portion. This translates to a subnet mask of 255.255.192.0 in dotted decimal format. To determine the network and broadcast addresses of a subnet, one must perform a bitwise AND operation between the IP address and the subnet mask.

This operation compares the binary representations of the IP address and subnet mask, resulting in a new binary number where the network bits remain unchanged, and the host bits are set to zero.

By converting this binary result back to dotted decimal format, we obtain the network address (192.168.0.0), which is the first address in the subnet. The broadcast address, the last address in the subnet, is found by setting all host bits to 1, leading to a broadcast address of 192.168.63.255. The usable host range within this subnet then spans from 192.168.0.1 to 192.168.63.254, excluding the network and broadcast addresses.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

How big is a Git commit? - ratfactor

  • Git stores objects as zlib-compressed data, affecting commit size
  • Packfiles eliminate redundancy, saving space across objects
  • Commit size varies greatly based on file size and compressibility

More from Sunday 11 October →