Subnetting - Subnet Masks
Network IDs, Host IDs, and Subnet IDs
Network ID: Identifies the network itself.
Host ID: Identifies individual devices (hosts) within the network.
Subnet ID: Introduces a division within the network to enable better management and utilization of IP addresses.
IP Address Basics
An IP address is a 32-bit number.
Without subnetting, bits are allocated solely for Network ID and Host ID.
Subnetting allows some bits from the Host ID to represent the Subnet ID, improving routing efficiency.
Routing Process
Core routers utilize Network IDs to direct data to the appropriate gateway for further routing.
The gateway router uses additional data to route the datagram to its final destination.
The Host ID is used by the last router to deliver the data to the specific machine.
Subnet Masks
A subnet mask is also a 32-bit number, written as four octets in decimal format.
It defines which portion of an IP address is the Subnet ID and which portion is the Host ID.
Commonly mischaracterized as a 'magic number,' it requires understanding for effective use.
Binary Representation
Each part of an IP address is an octet (8 bits).
For example, the number 9 in binary is represented as 00001001 to fill the octet.
Subnet masks consist of a string of ones followed by zeros, indicating which bits are relevant for identifying the Subnet ID.
Example of Subnet Mask
Common subnet mask: 255.255.255.0
- Translates to 24 ones followed by 8 zeros.
Differentiates Subnet ID (ones) from Host ID (zeros).
Calculating Subnet Size
The size of a subnet is determined by the subnet mask.
With a mask of 255.255.255.0, the last octet is used for Host IDs, yielding potential addresses 0-255.
However, 0 is not usable, and 255 is typically reserved for broadcast, leaving effective host addresses as 1-254.
Hence, a subnet allows for 254 usable addresses, but it’s common to mention the full number of addresses (256) for simplicity.
Non-Standard Subnet Masks
Masks can also use non-octet boundaries, such as 255.255.255.224 (27 ones + 5 zeros).
This allows 32 total addresses (but typically 30 usable addresses).
Subnet Notation
Subnet masks can be represented in shorthand notation: /27 for the example stated above.
A complete address could be expressed as 9.100.100.100/27, linking IP and subnet mask concisely.
Understanding both traditional and shorthand notations is essential.