Skip to main content

A tutorial on IP network addressing


Table 1. This table illustrates subnet masks. The number after the “/” in the CIDR notation indicates the total number of IP addresses available. Click here to see an enlarged diagram.

Understanding how computer network addresses work is fundamental to understanding how networked computers communicate. It is important to properly configure your networks, as well as to understand how computers on your network communicate with computers on the Internet. This month and next, we will look at network addressing in detail.

IP addresses

Internet Protocol (IP) addresses take the form xxx.xxx.xxx.xxx, where xxx is a number between zero and 255. There are public IP addresses and private IP addresses. Public IP addresses are assigned by the Internet Corporation for Assigned Names and Numbers (www.icann.org) and are routable over the Internet. Private IP addresses are not routable over the Internet: They are intended to be used within a facility.

In addition to IP addresses, computers use a subnet mask to determine which addresses are valid on a network. Subnets are critical to understanding how the Internet works, so we are going to spend the rest of this month's article on this topic.

Subnet masks defined

A subnet mask is a mask that is applied to an IP address to determine which portion of the address refers to the network and which portion refers to a host on the network. You might wonder why you would ever need to use a subnet mask. In fact, many times a subnet mask is not used. Most computers have their network masks set to 255.255.255.0, which effectively turns the subnet mask off. If this is the case, then what is the subnet mask for?

The primary use of a subnet mask is to apportion network addresses in an environment where these addresses are scarce. If you are working with an internal network where you can create all the addresses you need, then you may never worry about a subnet mask. On the other hand, if you ever work with a piece of equipment that is directly connected to the Internet, then you will almost always need to set the subnet mask appropriately.


Table 2. In binary numbers, the right-most digit represents ones, the next digit to the left represents twos, the next digit to the left represents fours, and so on. Click here to see an enlarged diagram.

Understanding subnet masks

It may be easier to understand subnet masks if we look at an example. Let's say that you are an engineer at a television station that has a T1 connection to the Internet. Your Internet Service Provider (ISP) tells you that you have six public IP addresses and that your CIDR address is 66.235.22.8/29.

If you are not familiar with CIDR, you may be a little confused. First, you should know that CIDR stands for Classless Inter-Domain Routing. CIDR resolved a problem with a shortage in Internet addresses, but more on CIDR next month. As you look over the information from the ISP, you may wonder what the /29 stands for. It means that there are eight IP addresses in this network.

By giving you the CIDR address of 66.235.22.8, the ISP is telling you that your network-addressing block starts at this address. The /29 specifies that there are a total of eight IP addresses in this block. As Table 1 shows, the number after the “/” indicates the total number of IP addresses available.

Why is it that Table 1 shows that you were issued eight addresses, but the ISP told you that you only have six? The reason is that the first and last addresses are reserved. Given the CIDR of 66.235.22.8/29, you would be free to assign the addresses 66.235.22.9 through 66.235.22.14 to host computers you want to connect directly to the Internet.


Table 3. Network addresses assigned by the ISP. Click here to see an enlarged diagram.

Note that you would set the subnet mask on these computers to 255.255.255.248. This would tell these computers that the only valid IP addresses on this network are from 66.235.22.8 to 66.235.22.15.

Why in the world does /29 mean that there are eight addresses available? IP addresses run from 0.0.0.0 through 255.255.255.255. But what is magic about 255? It turns out that this is an easy number to represent in binary. You may remember that in binary, the right most digit represents ones, the next digit to the left represents twos, the next digit to the left represents fours, and so on. (See Table 2.)

As you can see from the table, a binary value of “11111111,” or eight “ones” equals 128+64+32+16+8+4+2+1= 255. With eight bits, you can represent values from zero to 255 (a total of 256 unique values). A group of eight binary digits is sometimes referred to as an octet. Internet addresses are specified by four octets separated by periods. Note that 255.255.255.255 is equal to four octets, with each octet set to a value of all “ones” in binary. The reason 255 is a common number in Internet notation is that it is easy for computers to count from zero to “11111111” in binary and to make decisions based upon values that are all ones or zeros.

Network addresses

Now back to the question: Why would the number /29 be chosen to represent eight addresses on our network? To answer this question, it might be useful to look at the network address assigned by the ISP and its corresponding subnet mask in binary. (See Tables 3 and 4.)

If you count the number of “ones” in the binary representation of the subnet mask, you will find that there are 29 of them. (Ah ha!) Not only that, if you look at the subnet mask, you will see that only three binary numbers are set to zero — the last three. A binary value of 111 equals seven. So, if you use the subnet mask to strip off all but the last three digits of the assigned IP address, the maximum number of values that can be represented is eight (zero through seven).

As you can imagine, it is possible to design logic that can quickly strip off the first 29 bits, or the last three bits. Why would this be important? Because in Internet technology, it can be important to know what addresses are local and what addresses are network. Put in other terms, it may be important to determine whether traffic on the network is meant for a local host or for the Internet.


Table 4. A network address’ corresponding subnet mask in binary numbers. Click here to see an enlarged diagram.

One reason CIDR notation is common is that it is convenient. It is much easier to say “66.235.22.8/29” than it is to say “66.235.22.8 with eight valid IP addresses,” or “66.235.22.8 with a subnet mask of 255.255.255.240.”

Setting the subnet mask

Finally, you may wonder if it is a problem to leave your computers set to a subnet mask of 255.255.255.0. That depends on your situation. If you are working with host computers connected to the Internet, it would be best to set the subnet mask correctly. If you are dealing with workstations connected to a private network, then setting the subnet mask correctly is not as critical.

To learn more about IP addressing, take a look at an article titled “IP addressing and subnetting for new users,” available at www.cisco.com, document number 13788. You may also want to download a free advanced subnet calculator from www.solarwinds.com. The calculator not only does subnet calculations, but also converts between CIDR and conventional subnet notation as well as performs other useful tasks.

Brad Gilmer is a SMPTE Fellow. He is also president of Gilmer & Associates, executive director of the Video Services Forum and executive director of the AAF Association.

Send questions and comments to:brad.gilmer@penton.com