The process of learning how to subnet IP addresses begins with understanding binary numbers and decimal conversions along with the basic structure of IPv4 addresses. This paper focuses on the mathematics of binary numbering and IP address structure.
The process of subnetting is both a mathematical process and a network design process. Mathematics drive how subnets are calculated, identified, and assigned.
The network design determines how many subnets are needed and how many hosts an individual subnet needs to support based on the requirements of the organization.
This paper focuses on the mathematics of binary numbering and IP address structure. It covers the following topics:
1. Construct and representation of an IPv4 address.
2. Binary numbering system.
3. Process to convert a decimal number to a binary number.
4. Process to convert a binary number to a decimal number.
5. Fundamental aspects of an IPv4 address.
Note: Throughout this document, the term IP address refers to an IPv4 address. This document does not include IPv6.
IP Address Construct and Representation
An IP address is a thirty-two-bit binary number. The thirty two bits are separated into four groups of eight bits called octets. However, an IP address is represented as a dotted decimal number (for example: 126.96.36.199). Since an IP address is a binary number represented in dotted decimal format, an examination of the binary numbering system is needed.
The Binary Numbering System
Numbering systems have a base, which indicates how many unique numbers they have. For example, humans use the decimal numbering system, which is a base ten numbering system. In the decimal numbering system there are only ten base numbers-zero through nine. All other numbers are created from these ten numbers. The position of a number determines its value. For example, the number 2,534 means the following: there are two thousands; five hundreds; three tens; and four ones. The table below shows each number, its position, and the value of the position.
Computers, routers, and switches use the binary numbering system. The binary numbering system is a base two numbering system, meaning there are only two base numbers-zero and one. All other numbers are created from these two numbers. Just like in the decimal numbering system, the location of the number determines its value. The table below shows the value of the first eight binary positions. For exponents above 7, double the previous place value. For example, 28 = 256, 29 = 512, 210 = 1,024, and so on.
Decimal to Binary Conversion
Since IP addresses are a binary number represented in dotted decimal format, it is often necessary to convert a decimal number to a binary number.
In the figure above, the decimal number 35 is converted to the binary number 00100011. The steps to perform this conversion are below.
1. Determine your decimal number. In this scenario, it is 35.
2. Write out the base number and its exponent. Since an IP address uses groups of eight binary bits, eight base two exponents are listed.
3. Below the base number and its exponent, write the place value. For example, 20 has a value of 1; 22 has a value of 4; 23 has a value of 8; etc.
4. Compare the value of the decimal number to the value of the highest bit position. If the value of the highest bit position is greater than the decimal number, place a 0 below the bit position. A 0 below the bit position means that position is not used.
However, if the value of the highest bit position is less than or equal to the decimal number, place a 1 below the bit position. A 1 below the bit position means that position is used.