An IPv4 address is used to uniquely identify a host on a TCP/IP network. An IPv4 address is made up of a 32-bit number, which is expressed in four octets. Each octet contains eight bits. When working with an IPv4 address, each octet is converted to base 10 (decimal notation) and is separated by a period (dot).
For example, a typical IP address you may see on a private, local area network (LAN) is
192.168.0.1. This decimal notation is known as the dotted-decimal format. The value in each octet ranges from 0 to 255 decimal, or 00000000 – 11111111 when working with binary notation.
Normally, IPv4 addresses are not represented as a Hexadecimal (HEX) number. However, the newer IPv6 address is generally represented as a HEX number because it is a much larger number (128 bits). IPv6 addresses will not be covered in this article. From this point on IPv4 addresses will simply be referred to as IP addresses.
While it is easy for us to work with decimals, computers work well with binary numbers. IP addresses are made up of 32 bits. Each bit is a binary digit. The value of a bit is either zero (0) or one (1). Having 32 bits allows us to have a total of 4,294,967,296 (2^32) addresses in the IPv4 scheme.
However, removing Class D and E, Network 0 and 127, as well as removing the private IP ranges, we have about 3.7 billion addresses that are useable on the public Internet. If you are not familiar with the binary system, it is easy to learn. However, it does take some practice.
Since an IP address is made up of four octets, each octet will have eight bits. Refer to the following chart which shows the binary and decimal values from 1-15. You can continue the pattern and reach up to a decimal value of 255 if you have eight bits all set to one (1).
There are actually five different classes of IP networks, Class A, B, C, D, and E. For the most part, Classes A to C is discussed for the purposes of designing networks. Class D is reserved for multicasting and Class E is reserved for experimental. Class D and Class E will not be covered in detail in this article.
You should also note that the use of IP classes is now rarely used in practice. However, it is still important to understand this concept with respect to IP addressing and subnetting your network.
With the introduction of classless inter-domain routing (CIDR), classes are no longer a critical factor in your network configuration. To determine which class an IP belongs to, you only have to look at the five high-order bits.
In the graphic shown above, you should quickly note that all Class A addresses have a zero in the first bit of the address. All Class B addresses have one in the first bit and a zero in the second bit.
All Class C addresses have a one in the first bit, a one in the second bit, and a zero in the third bit. Class D and Class E addresses also have their specified bit arrangement.
A subnet mask allows you to determine which portion of the IP address identifies the network and which portion of the address identifies the node. When dealing with classes, A, B, and C networks have default subnet masks.
- Class A:
- Class B:
- Class C:
To determine which portion of an IP address is the network ID and which is the host ID, we apply the subnet mask. Let us take a look at the following example. We will need to convert the IP address and subnet mask to binary numbers and perform an AND operation.
IP: 10.5.15.30 SM: 255.0.0.0 IP: 00001010.00000101.00001111.00011110 SM: 11111111.00000000.00000000.00000000 --------.--------.--------.-------- 00001010.00000000.00000000.00000000
Once you have the address and the mask represented in binary, then identifying the network and the host ID is easy. With the help of the AND operator, we can determine that the network ID of this IP address is
10, and the host ID is
5.15.30. On a local area network, computers generally share the same network ID.
On local area networks that have been subnetted, they continue to share the same network ID, but different areas of the network will have their own subnet IDs. This is called subnetting. Network Administrators who work on TCP/IP networks should be comfortable with working with decimal as well as binary notation.