Subnet Mask - Complete Practical Explanation For Industrial Automation

 

Understanding-subnet-masks-and-usable-IP-addresses-in-industrial-automation-networks

5th December, 2026.

In this post, we will see the concept of subnet masks and their importance in industrial automation. 

When commissioning an Ethernet link (for instance for a PLC, HMI, SCADA computer, remote I/O or industrial switch), the subnet mask is a significant network related setting. Whilst many automation engineers recognize that a common subnet mask type is ‘255.255.255.0’, not everyone understands that other options such as ‘255.255.255.192’ and ‘255.255.255.224’ are also available. Below, we will explore the topic further and provide industrial automation-oriented explanations and examples.

·         What is a subnet mask?

A subnet mask is employed to distinguish the network and host sections of an IP address.

a.      Network section - indicates which network a device is on.

b.     Host section - specifies the specific device.

As an example, a PLC may be set out as follows:

a.      IP address - 192.168.1.10

b.     Subnet mask - 255.255.255.0

Here the first three octets (192.168.1) define the network section, and the last octet (10) defines the host component. Hence, this PLC is on network 192.168.1.0/24. Should an HMI also have an IP address of 192.168.1.20 and the same subnet mask then it too will be on this network. Assuming that physical and other network connections are correctly made, this means that the PLC and HMI can communicate directly via the local Ethernet network.

·         Understanding the numbers in a subnet mask:

An IPv4 subnet mask is made up of 4 numbers, separated by full stops. Each of these is termed an octet and is comprised of 8 binary digits. For example, 255.255.255.0. It is key to recognize that the network section in a subnet mask is represented using binary 1’s and the host section is represented with binary 0’s. A standard subnet mask can only have 9 different values for each of its octets:

a.      255 = 11111111 (8 network bits)

b.      254 = 11111110 (7 network bits)

c.      252 = 11111100 (6 network bits)

d.      248 = 11111000 (5 network bits)

e.      240 = 11110000 (4 network bits)

f.       224 = 11100000 (3 network bits)

g.      192 = 11000000 (2 network bits)

h.      128 = 10000000 (1 network bit)

i.        0 = 00000000 (0 network bits)

In basic terms this indicates that where the number is 255, all 8 bits of an octet relate to the network. Conversely, if the number is 0, then all 8 bits pertain to the host. The numbers 128, 192, 224, 240, 248 and 252 indicate that the network and host sections are partially separated. Whilst you do not need to recall the binary equivalents immediately, you should at least remember these 9 permitted values. Therefore, 255.255.255.192 is a valid subnet mask. However, 255.255.255.100 is not a standard valid subnet mask.

·         Different subnet masks:

Depending on the number of network bits required, the 9 permitted numbers can occur in various octet locations. For example, 255.0.0.0 is described as /8 since there are 8 network bits. Similarly, 255.255.0.0 is /16, since it includes 16 network bits. Commonly used is the subnet mask of 255.255.255.0 which is /24 as it has 24 network bits. With a subnet mask of 255.255.255.128, there are 24 network bits (from the first 3 octets) and 1 further network bit (from the 128 in the last octet). Therefore, this is denoted by /25. Likewise, 255.255.255.192 is /26, 255.255.255.224 is /27 and 255.255.255.240 is /28.

This is known as CIDR notation. The figure after the forward slash simply shows how many network bits there are. Importantly, network bits need to be consecutive. If a 0 occurs in a subnet mask, then no further octet can have a network bit. So, for example, 255.255.192.0 is valid but 255.192.255.0 is not.

·         How is a subnet mask used to recognize whether two devices are on the same network?

This is arguably the most important area for automation engineers to understand. Firstly, let us examine different device settings.

a.     Example A - Same subnet

1.      PLC: IP address - 192.168.1.10

2.      Subnet mask - 255.255.255.0

3.      HMI: IP address - 192.168.1.20

4.      Subnet mask - 255.255.255.0

Both devices are on network 192.168.1.0/24. Consequently, they can communicate directly via the local Ethernet network (assuming correct physical and other network settings).

b.     Example B - Same subnet mask but different networks

1.      PLC: IP address - 192.168.1.10

2.      Subnet mask - 255.255.255.0

3.      HMI: IP address - 192.168.2.20

4.      Subnet mask - 255.255.255.0

Whilst the PLC is on network 192.168.1.0/24, the HMI is on network 192.168.2.0/24. Despite having the same subnet mask then, these two devices are on separate networks. To enable communication between these devices, a router or Layer 3 device is required. It is important to note that, although devices may share the same subnet mask, they may be on separate networks.

5.      Example C - Different subnet masks but still direct communication

Please see below:

1.      PLC: IP address - 192.168.1.10

2.      Subnet mask - 255.255.255.0

3.      HMI: IP address - 192.168.1.20

4.      Subnet mask - 255.255.0.0

The PLC recognizes that the HMI is on its local network as the HMI’s IP address lies within 192.168.1.0/24. Furthermore, the HMI recognizes the PLC as being on its own local network as its subnet encompasses 192.168.0.0/16. Therefore, even with differing subnet masks, communication can occur directly between the two devices. Clearly then, device subnet masks do not necessarily need to be identical for direct communication to be achieved. Nevertheless, it is generally not advisable for devices to have differing subnet masks as this can cause issues within more complex networks.

6.      Example D - One device perceives the other to be on a separate network

Please see below:

1.      PLC: IP address - 192.168.1.10

2.      Subnet mask - 255.255.255.0

3.      HMI: IP address - 192.168.2.20

4.      Subnet mask - 255.255.0.0

Whilst the PLC sees that the HMI is not on its local network as the first 3 octets differ, the HMI recognizes that the PLC is on its own network as its subnet mask enables it to encompass the first two octets. This creates an asymmetrical communications scenario. The PLC may attempt to route information to its default gateway, and the HMI may seek to communicate directly with the PLC across Ethernet. Depending upon the network configuration, communication may thus not be successful. As such, it is good practice to ensure that all devices on an industrial network share the same subnet mask.

·         How many IP addresses can be supported in a subnet?

This is affected by the quantity of host bits. As each bit can have a value of either 0 or 1, the following equation can be used to determine the total number of IP addresses:

Total IP addresses = 2^ {Number of host bits}

Typically, for standard IPv4 subnets, 2 addresses are not available for use; one for the network ID and another for broadcasting. Therefore,

Usable IP addresses = 2 ^ {Host bits-2

We will now look at an example of this in practice. If a PLC has a subnet mask of 255.255.255.192 then the binary equivalent is:

11111111.11111111.11111111.11000000

This comprises 26 networks and 6 host bits. Thus, there are:

2^6 = 64 IP addresses in total

Of these, one is allocated to the network, and another is designated for broadcasting. Therefore: 64 - 2 = 62. Hence, there are 62 usable IP addresses in this subnet.

For example, if the network is 192.168.1.0/26 then its network ID is 192.168.1.0. Usable IP addresses are those from 192.168.1.1 to 192.168.1.62. Finally, 192.168.1.63 is used for broadcasting. The next network commences on 192.168.1.64. So, we can see how the subnet mask is used to establish how many devices can be supported on a network.

·         How do you determine a network range?

There is a straightforward way to calculate this. The formula for applying is:

Subnet increment = 256 - Mask value}

Using a subnet mask of 255.255.255.192, the last octet is valued at 192. Hence, 256 - 192 = 64. The subnet increment is 64. This indicates that successive subnets are 64 apart.

For the network 192.168.1.0/26, the first subnet spans 192.168.1.0 to 192.168.1.63. Usable IP addresses in this network are therefore 192.168.1.1 to 192.168.1.62.

The second subnet runs from 192.168.1.64 to 192.168.1.127. Usable IP addresses here are 192.168.1.65 to 192.168.1.126.

Then, the third subnet extends from 192.168.1.128 to 192.168.1.191. Usable IP addresses are 192.168.1.129 to 192.168.1.190.

Finally, the fourth subnet is from 192.168.1.192 to 192.168.1.255. Usable IP addresses in this instance are 192.168.1.193 to 192.168.1.254.

Such calculations are especially valuable for segmenting a wider industrial network into sub-networks.

·         Using various subnet masks:

Below are explanations of, and some industrial automation applications for, several frequently used subnet masks.

a.      255.255.255.0 (/24)

This is commonly utilized for machine level networks (for instance those for a PLC and HMI). It provides 254 usable IP addresses and so is usually adequate to support many smaller industrial networks.

b.     255.255.255.128 (/25)

This divides a /24 network into 2 sub-networks, and each supports 126 usable IP addresses. It can be helpful in isolating 2 collections of industrial devices. For example, 192.168.1.0/25 has usable IP addresses from 192.168.1.1 to 192.168.1.126. Likewise, 192.168.1.128/25 has usable IP addresses from 192.168.1.129 to 192.168.1.254.

c.      255.255.255.192 (/26)

This splits a /24 network into 4 sub-networks. Each of these supports 62 usable IP addresses. It may be beneficial for further partitioning an industrial network into machine and/or equipment sub-networks.

d.     255.255.255.224 (/27)

Within each subnetwork there are 30 usable IP addresses. This may be appropriate for a relatively small network, which consists of a PLC, HMI, remote I/O and a small number of additional devices.

e.      255.255.255.240 (/28)

Each subnetwork can support 14 usable IP addresses. Such a subnet mask could be employed to form smaller network sections for environments where only a limited number of devices are required.

f.        255.255.0.0 (/16)

This allows for 65,534 usable IP addresses. Some devices for example, a PLC (172.16.1.10), an HMI (172.16.2.10) and a SCADA PC (172.16.10.10), all with this subnet mask, are all on the same network – 172.16.0.0/16.

Nevertheless, large industrial networks are often segmented into sub-networks. This is done to enhance network management, improve security and control data flow. Whilst the number of devices on a network is relevant to the choice of subnet mask, the network layout is also a crucial consideration.

·         Consequences of an incorrectly set subnet mask:

Take a PLC with the following settings:

1.      IP address - 192.168.1.10

2.      Subnet mask - 255.255.255.0

Should an HMI have the following settings:

1.      IP address - 192.168.2.20

2.      Subnet mask - 255.255.0.0

The PLC will consider that the HMI is on a different network. However, the HMI will perceive that the PLC is on its own network. Such situations can lead to communications issues. Common issues relating to incorrect subnet masks include:

a.      PLCs and HMIs are not communicating with each other, despite both being attached to the same Ethernet switch.

b.     Communication in only one direction between devices.

c.      Local communication functioning but long-range communication is not.

d.     Devices being unable to communicate across networks which are routed.

Always check devices’ IP address and subnet mask as part of your investigation into more complex network issues. Bear in mind too that even if two devices are physically connected to the same switch they may still be on different VLANs. Consequently, inter-VLAN routing is necessary to facilitate communication between these devices.

·         Key points:

Below are the key takeaways for automation engineers.

1.      An IP address identifies a device.

2.      A subnet mask is comprised of 4 octets. Each octet can have a value of 0, 128, 192, 224, 240, 248, 252, 254 or 255. A /24 subnet mask comprises 24 network bits and /26 has 26 network bits.

3.      Even if 2 devices share the same subnet mask, they may be on separate networks.

4.      Despite having different subnet masks, 2 devices can still consider each other to be on their local network.

5.      The number of host bits dictates how many IP addresses can be supported.

6.      For standard IPv4 subnets, subtract 2 from the overall number of addresses to obtain the number of available host addresses. The subnet increment can be determined by subtracting the value of the relevant octet in the subnet mask from 256.

7.      Generally, devices on the same subnet can communicate directly and do not need a default gateway.

8.      Please note that there are exceptions to the ‘minus 2’ rule, such as with /31 point-to-point links and /32 host routes.

A subnet mask enables a PLC, HMI or SCADA computer to recognize whether another device is on the same or different network. In addition, it is used to sub-divide a wider range of IP addresses into sub-networks and to establish how many devices can be supported on each sub-network. Understanding subnets is vital for automation engineers when commissioning a variety of industrial automation devices (such as PLCs, HMIs, SCADA computers, remote I/O and industrial Ethernet). Simply, a subnet mask enables a device to recognize whether another device is on the same or different network.

I have covered the general theory on understanding the use of subnet masks in industrial automation. I have also not attempted to cover all the topics related to it, as it can vary from case to case. Once you are familiar with this type of technology, you can easily troubleshoot any issues related to it.

Thank you for reading the post. I hope you liked it and will find a new way in this type of technology.




Written by Viral Nagda, Industrial Automation Engineer with 12+ years of experience…

Comments