The Nitty Gritty of Address Classes

IP address notation

It’s very difficult for us to imagine, but just two hundred years ago it was common to identify a building by the crest or figure on the building. Packages would be addressed to Emily Ward at the two-horse building, the Williamson crest shop, or the crossed swords building.

We are a long way from that, especially when it comes to addressing our Ethernet devices. Ethernet devices all have two addresses. There is a Layer 2, Link layer address, and a Layer 3, IP layer address. The layer 2 address is 48-bits and called the MacID or Media Access Controller ID. The Layer 3 address is the a.b.c.d address most of us know. In this article, we’ll look at the background information on IP address notation.

DOTTED DECIMAL NOTATION

Everyone is familiar with the IPv4 (version 4) address composed of four numbers with a single dot separating each number such as 10.4.14.83. This notation, known as “dotted decimal notation,” consists of four numbers with values between 0 and 255. In other words, the total address space is 0.0.0.0 to 255.255.255.255. However, some numbers in that range are reserved for specific purposes on IP networks. The Internet Assigned Numbers Authority (IANA) identifies four specific reserved address:

0.0.0.0 – Usually, an address a device uses when it has no address. It also has other uses that aren’t usually applicable to industrial automation.

255.255.255.255 – An address used to signal network broadcasts or messages that should go to all computers on the network.

127.0.0.1 – A loopback address used by a device to send a message to itself.

169.254.0.1 to 169.254.255.254 – Addresses representing the Automatic Private IP Addressing (APIPA) range of addresses assigned automatically when a computer is unsuccessful in getting an address from a DHCP server.

NETWORK CONFIGURATION

Networks can be any size, from two nodes to hundreds or thousands of nodes, and it’s the job of a router to move packets between these networks. For this to work efficiently, IP addresses are divided into a network component and a host component. The first part of an IP address always identifies the network component while the remainder identifies the host or end device component on that network. The parts of the address assigned to the network and to the host vary. A small network component (fewer networks) means many hosts. A larger network component (many networks) implies a small number of hosts.

Address classes assist the router in identifying the size of a network. In control networks where we use EtherNet/IP, PROFINET IO, and Modbus TCP, small networks are typical. Control devices often have limited processing power and are unable to process the many broadcast messages that can be present on a larger network (see my article here on broadcast domains).

A number called the subnet mask determines how much of an IP address is used for the network and how much is used for the host. If you Exclusive OR the subnet mask with the IP address, you can identify the network portion of an IP address. For example:

IP Address:192.168.1.13

CD A8 01 0D

1100 1101 1010 1000 0000 0001 0000 1101

Subnet Mask:255.255.255.248

FF FF FF F8

1111 1111 1111 1111 1111 1111 1111 1000

nnnn nnnn nnnn nnnn nnnn nnnn nnnn nhhh

Exclusive OR:1100 1101 1010 1000 0000 0001 0000 1101 OR’d with

1111 1111 1111 1111 1111 1111 1111 1000

Result:1100 1101 1010 1000 0000 0001 0000 1000

CD A8 01 08

192.168.1.8

In this example, the network subnet mask is configured to use 29 bits for the network portion of the address, providing over 536 thousand hosts (229). That leaves only 3 bits for the host portion, meaning that there can be only 8 hosts on any of those networks (23). IP Address 192.168.1.13 addresses host 5 (bits 101).

In the next article in this series, we’ll look at what this all means for industrial control systems.