IP addressing basics

Internet Protocol (IP) addresses take the form xxx.xxx.xxx.xxx, where xxx (an octet) is a number from zero through 255. There are public IP addresses and private IP addresses. Public IP addresses are assigned by the Internet Corporation for Assigned Names and Numbers, and are routable over the Internet. Private IP addresses are not routable over the Internet; they are intended to be used within a facility.

As a broadcast engineer, it is important to understand how this process happens and how to assign addresses logically in your own network.

Private IP addresses

If you are building an internal network, how do you know where to start? Fortunately, early on, the Internet Engineering Task Force (IETF) realized it needed documents to describe how the Internet functions. These documents are known as request for comments (RFCs). A good place to find RFCs is www.rfcs.org. One particularly helpful document is RFC 1918. It sets aside three blocks of IP addresses solely for private networks. These blocks are: 10.0.0.0 to 10.255.255.255, 172.16.0.0 to 172.31.255.255 and 192.168.0.0 to 192.168.255.255. Public IP addresses are outside the blocks specified in RFC 1918 and are routable across the Internet.

Introduction to DHCP

When you plug a computer into a local network and it just starts working, how does it get its IP address? How does this new computer not clash with another computer on the network? The answer is found in RFC 2131, which describes Dynamic Host Configuration Protocol (DHCP).

If your computer is set to obtain an IP address automatically when the computer is connected to a network, it begins a series of exchanges with a DHCP server. The server's task is to assign IP addresses according to a predetermined plan established by the network administrator.

The conversation between the DHCP client (your computer) and the DHCP server (the computer responsible for assigning IP addresses) follows a specific pattern. First, your computer sends out a discover message asking DHCP servers to reply with an offer of an IP address. Second, DHCP servers respond to the discover message with an offer message containing an IP address. Third, the client sends a request message back to the DHCP server requesting a specific IP address. Finally, the DHCP server sends an acknowledge message, recognizing the IP address assignment. At a later time, the client may release the IP address when it is no longer needed. (See Figure 1.)

Manual assignment

In many cases, you will want to manually assign IP addresses. Unfortunately, there is no standardized way of configuring client computers. One of the easiest ways to do this is to use an Internet search engine to find out how to manually set IP addresses for your operating system.

In smaller networks with less than 253 computers, you can assign them all to the same private network, meaning that the first three octets are the same, but the last octet is different for each computer. For example, you might select 10.25.56.xxx for your network. All computers on the network would have IP addresses that begin with 10.25.56, but the last three numbers would vary. Larger organizations may want to arrange the networks by department, assigning all computers within that department to the same network. For example, graphics might be 10.25.56.xxx, but news might be 10.25.66.xxx. This would allow you to have a large number of computers in each department.

Stay away from addresses that end in zero, and 254 to 255 inclusive. These addresses are reserved for special network applications. Also note that gateways — routers that allow you to connect to other networks — usually have a LAN address ending in one. In our example, a gateway router would be assigned the address 10.25.56.1.

The role of a subnet mask

A subnet mask is applied to an IP address to determine which portion of the address refers to the network and which portion refers to a specific computer on the network. On most computers, the network mask is set to 255.255.255.0, which effectively turns the subnet mask off.

When working with an internal network where you can create all the addresses needed, you may never have to worry about setting the subnet mask to anything other than 255.255.255.0. On the other hand, if you ever work with a piece of equipment that is directly connected to the Internet, you will almost always need to set the subnet mask appropriately.

It may be easiest to understand subnet masks by looking 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) says you have six public IP addresses and that the address range is 66.235.22.8/29. The ISP is giving you a range of IP addresses in Classless Inter-Domain Routing (CIDR) notation. (Read more about CIDR in RFC 1518 and 1519.) The /29 indicates that there are a total of eight IP addresses in this block. As Table 1 (below) shows, the number after the slash indicates the total number of IP addresses available.

Why does Table 1 show that eight addresses were issued, but the ISP says 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. Note that you would set the subnet mask on these computers to 255.255.255.248.

As you know, 255 is a common number in Internet address notation. What is so magical about 255? It is an easy number to represent in binary.

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. As you can see in Table 2 (below), a binary value of 11111111, or eight ones, equals 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1, which equals 255. A group of eight binary digits is sometimes referred to as an octet. Internet addresses are specified by four octets separated by periods. The reason 255 is a common number in Internet notation is because 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.

Now, let's go back to the number that represents the quantity of public IP addresses at our disposal in this example. Why would the number /29 be chosen to represent eight addresses on the 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 Table 3, below.)

There are 29 ones in the binary representation of the subnet mask. Not only that, but 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). It is possible to design logic that can quickly strip off the first 29 bits, or the last three bits.

One reason CIDR notation is common is because 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.248.

Brad Gilmer is executive director of the Video Services Forum, executive director of the Advanced Media Workflow Association and president of Gilmer & Associates.

CIDR Available addresses Usable Subnet mask /32 1 0 255.255.255.255 /31 2 0 255.255.255.254 /30 4 2 255.255.255.252 /29 8 6 255.255.255.248 /28 16 14 255.255.255.240 … /25 128 126 255.255.255.128 /24 256 254 255.255.255.0

Table 1. An ISP will give you a range of IP addresses in CIDR notation, which defines the available addresses, usable addresses and subnet masks.

Base-10 value 128 64 32 16 8 4 2 1 Binary 1 1 1 1 1 1 1 1

Table 2. An example of binary values

IP address 66 235 22 8 Binary 01000010 11101011 00010110 00001000 Subnet mask 255 255 255 248 Binary 11111111 11111111 11111111 11111000

Table 3. Network address assigned by the ISP and the corresponding subnet mask in binary

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