January 1, 2021

#43 - Subnet Masks /24 /22 and /20

It is usually necessary to configure the following parameters on an Ethernet network device , according to the Internet Protocol IPv4:

  • gateway IP address (for example, managed switch or router)
  • device's IP address
  • subnet mask address

The architecture of an industrial network can be segmented into VLANs, for security reasons. Below, an example of configuring a VLAN:
  • Gateway IP: 192.168.50.1

IP devices (PLC, VFDs, HMI, Remote IO, robot, etc.): 192.168.50.2 to 255 
  • Subnet Mask: 255.255.255.0

In this example, the IP values ​​of this VLAN network are part of a local private network, with no internet access, as the address is in the 192.168.xx range

The IP addresses and subnet mask are 32-bit numbers, divided into 4 bytes, where each byte is represented in decimal format. The subnet mask address is very important, as it will allow communication between devices depending on the configured values. Converting each byte from decimal to binary format  helps to understand how it works.

Examples of a PLC with IP 192.168.50.2:
  • If subnet mask is 255.255.255.0:

255.255.255.0:  11111111. 11111111 . 11111111 .00000000 (also called / 24)
192.168.50.2:  11000000.10101000.00110010 .00000010

The PLC can communicate with all IP addresses that have the first 24 bits (from left to right) equal, that is, 192.168.50.X
  • If subnet mask is 255.255.252.0:

255.255.252.0:  11111111. 11111111 . 11111100 .00000000    (also called / 22)
192.168.50.2: 11000000.10101000.001100 10.00000010

The PLC can communicate with all IP addresses that have the first 22 bits (from left to right) equal, that is:
192.168.48.X,  192.168.49.X,  192.168.50.X,  192.168.51.X
  • If subnet mask is 255.255.240.0:

255.255.240.0:  11111111. 11111111 . 11110000 .00000000    (also called / 20)
192.168.50.2:  11000000.10101000.0011 0010.00000010

The PLC can communicate with all IP addresses that have the first 20 bits (from left to right) equal, that is:
192.168.48.X,  192.168.49.X,  192.168.50.X,  192.168.51.X,  192.168.52.X,  192.168.53.X,  192.168.54.X,  192.168.55.X,  192.168.56.X,  192.168.57.X,  192.168.58.X,  192.168.59.X,  192.168. 60.X,  192.168.61.X,  192.168.62.X,  192.168.63.X.    

No comments:

Post a Comment