Subnet question...

WillM

Member
Join Date
Mar 2015
Location
England
Posts
46
Simple question but I want to be certain. Lets say you have 2 separate PLCs on no network with the following configuration...

PLC 1
192.168.1.1
255.255.255.0

PLC 2
192.168.1.2
255.255.0.0


If i set my PC up with the following...
192.168.1.X
255.255.255.0
or
192.168.1.X
255.255.0.0

Will I be able to access both PLCs without having to change the subnet?

I've tested it and it works. I've read up on subnets and in my head it works but someone has told me there may be issues. My understanding is that both IP addresses are within the smaller Subnet of 255.255.255.0 so if my laptop was set to 255.255.0.0 it would be accessible.

Am i missing something or is it ok?

Thanks (y)
 
I really think it depends on the device. It should work. Mathematically, those IP Addresses and Subnets will match up.

I have connected to devices with mismatched, but compatible, subnet masks before. 192.168.1.XXX, and the only thing that really mattered was the subnet mask's last octet was 0, the remaining octets didn't really matter, since those IP Address octets matched anyway.

But I have also had programs which throw a fit if the Subnet Masks do not match, with alarms telling me that the subnet masks are "incompatible", or something along those lines. I think these are in the minority of devices I have connected to though.
 
Sounds right, I'm lazy so I just use one of the subnet calculator on the web.

For a host of 192.168.1.X

- mask of 255.255.255.0 give a host range of 192.168.0.1 - 192.168.255.254
- mask of 255.255.0.0 give a host range of 191.168.1.1 - 191.168.1.254

My understanding is that you may want to change all the mask to 255.255.255.0 to limit your broadcast range unless you have valid reason not to.
 
I really think it depends on the device. It should work. Mathematically, those IP Addresses and Subnets will match up.

I have connected to devices with mismatched, but compatible, subnet masks before. 192.168.1.XXX, and the only thing that really mattered was the subnet mask's last octet was 0, the remaining octets didn't really matter, since those IP Address octets matched anyway.

But I have also had programs which throw a fit if the Subnet Masks do not match, with alarms telling me that the subnet masks are "incompatible", or something along those lines. I think these are in the minority of devices I have connected to though.

Well technically according to the rules a 192.168.1.0 address should have a subnet mask of no less than 255.255.255.0 (a /24 network) meaning a maximum of 254 hosts, some devices know that and wont let you use another mask
 
It kind of works. You can access them but they can't access you.

192.168 are C class ranges so they are supposed to use 255.255.255.0 as subnet.

If you want to use 255.255.0.0 you need a B class range like 172.16.


PS. The subnet is used from the machine that has the subnet setting to check if an IP address is on the same subnet and can be accessed directly or if the request should be routed to the default gateway. So your laptop settings means nothing to the PLCs.
 
Last edited:
Ok, there is some misinformation going on here. Yes, what you described will work. But the mixed subnet masks is usually not a good idea just from a organization aspect. But it is certainly allowed.

So this may be more background than you wanted, but I wanted to set the record straight.

Class A addresses range from 1.0.0.0 - 127.255.255.255. So for example, 10.0.0.1 starts with a 10 so it is a Class A address. Class A addresses use 8 bits to represent the network address and 24 bits to represent the individual hosts. So with Class A I could have 128 individual networks with each network containing over 2 billion host devices.

Class B addresses range from 128.0.0.0 - 191.255.255.255. So for example, 172.16.0.1 starts with a 172 so it is a Class B address. Class B addresses use 16 bits to represent the network address and 16 bits to represent the individual hosts. So with Class B I could have 16,384 individual networks with each network containing over 65,000 host devices.

Class C addresses range from 192.0.0.0 - 223.255.255.255. So for example, 201.35.0.1 starts with a 201 so it is a Class C address. Class C addresses use 24 bits to represent the network address and 8 bits to represent the individual hosts. So with Class C I could have over 2 million individual networks with each network containing over 256 (actually 254) host devices.

We won't get into Class D or E.

Class A Typically use a subnet mask of 255.0.0.0
255 = 8 consecutive 1 bits followed by 24 consecutive 0 bits is often known as "/8"

Class B Typically use a subnet mask of 255.255.0.0
255.255 = 16 consecutive 1 bits followed by 16 consecutive 0 bits is often known as "/16"

Class C Typically use a subnet mask of 255.255.255.0
255.255.255 = 24 consecutive 1 bits followed by 8 consecutive 0 bits is often known as "/24"

This is what is known as CLASSFUL Addressing. This basically meant if 192.168.1.1 was your IP address, then 255.255.255.0 was your subnet mask. Automatic, no ifs ands or buts.

But once IP addresses started to dwindle in availability, we saw how wasteful this addressing scheme really can be. So today, it is not required and most networking people have abandoned it. We can instead use CLASSLESS addressing. But, you don't really want to mix methods as it can be very confusing and frustrating.

So with CLASSLESS it is now commonplace to see a mix of address classes and subnets. So your example of 192.168.1.2 with a subnet of 255.255.0.0 is a perfectly acceptable CLASSLESS address. So the whole idea of Class A, B, and C are not terribly relevant with the classless addressing scheme.

Your address of 192.168.1.X with a subnet of 255.255.0.0 is simply saying that this is a network identified as 192.168.0.0. The first IP address in the range is known as the network address. The mask is identifying that the last address on your network would be 192.168.255.255. Now the very first address and the very last are reserved so (256 x 256) - 2 = 65,534 devices could all be on the same network. That is potentially a very large network. One device sending a broadcast message would go to all of those devices.

Your address of 192.168.1.X with a subnet of 255.255.255.0 is saying that this is a network identified as 192.168.1.0. The mask is identifying that the last address on your network would be 192.168.1.255. So 254 devices. That is a much smaller network. One device sending a broadcast message would be contained to only go to those devices. 192.168.0.0 would be a completely separate network as would 192.168.2.0 and so on.

But what if your network didn't require 250+ devices. What if it only needed to handle 10 devices. If we assigned 192.168.1.x with a subnet of 255.255.255.0 we would potentially be wasting 240+ IP addresses that we could use elsewhere.

So the mask of 255.255.255.0 is typically referred to as "/24" as it represents 24 consecutive 1 bits representing the network. The remaining 8 zero bits is where we get how many hosts we can have. But if we change how many network bits are used then we can affect how many host bits are available. So are not stuck with 256 or 65,000 as our only choices.

255.255.252.0 or /22 = 1024 (-2 reserved) hosts per network
255.255.254.0 or /23 = 512 (-2 reserved) hosts per network
255.255.255.0 or /24 = 256 (-2 reserved) hosts per network
255.255.255.128 or /25 = 128 (-2 reserved) hosts per network
255.255.255.192 or /26 = 64 (-2 reserved) hosts per network
255.255.255.224 or /27 = 32 (-2 reserved) hosts per network
255.255.255.240 or /28 = 16 (-2 reserved) hosts per network
255.255.255.248 or /29 = 8 (-2 reserved) hosts per network
255.255.255.252 or /30 = 4 (-2 reserved) hosts per network

So using /28 as our mask we can "sub-network" a typical range into many separate networks.

We could have the network start at 192.168.1.0 and end at 192.168.1.15
We could have another network start at 192.168.1.16 and end at 192.168.1.31
We could have another network start at 192.168.1.32 and end at 192.168.1.47
etc, etc.....

This idea of sub-netting is much more common in the IT world where they have a set number of IP addresses available and they cannot be wasted through a wasteful addressing scheme. In the controls world, we typically have had relatively small networks that have been isolated from the enterprise so our addressing methods didn't really matter all that much. Today though we are seeing our control networks connecting to the enterprise network and knowing these addressing schemes becomes quite important.

So I have gone on much longer than I intended and I am sure I lost people along the way. But I wanted to make sure we understand that classless addressing is here to stay which makes the whole idea of Class A, B, and C mostly irrelevant.

OG
 
It should definitely work. I would be very surprised if it did not. 255.255.255.0 is the default subnet for Class C IP addresses. But there is no reason that 255.255.0.0 will not work for a Class C IP address.

At my work we have Class A IP addresses. 10.32.x.x and we use 255.255.0.0 instead of the defualt subnet of 255.0.0.0

I had a PLC with an IP address of 10.32.5.20 (255.255.0.0) that could talk to a PLC with an IP address of 10.32.5.30 (255.255.255.0). I could not talk to the 255.255.255.0 PLC from my laptop with the IP address of 10.32.9.151 (255.255.0.0). But I could talk to the PLC with 255.255.0.0 subnet. I had to change the IP address of my laptop so only the last octet was different to talk to the 255.255.255.0 PLC. I changed the IP of my lap top to 10.32.5.151 then I changed the subnet to the correct 255.255.0.0 and I could then communcate with both PLCs with my original laptop IP address of 10.32.9.151
 
If you have a device with a 10.x.x.x address and 255.255.0.0 subnet it is no longer considered Class A. It is considered Classless. This goes to what I said, don't mix methods with the subnet. It is frustrating and confusing.

OG
 
Classful adressing don't use a subnet mask (it is implicitly derived from the IP address). So it's pretty clear that everything today is classless.

However I've never seen anyone put larger subnet mask like 255.255.0.0 on a class C address like 192.168.x.x so I'd consider that bad practice. Always according to class or smaller. For instance 255.255.255.128 subnet mask on 192.168.1.x

Which brings me to an important point - RFC 1918, private address space.
Private (non-internet) ranges is recommended to be put in here:

  • 10.0.0.0 - 10.255.255.255 (10/8 prefix)
  • 172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
  • 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)

That way your private network addresses won't clash with the network addresses on the internet. This is good practice.
 
Last edited:
It kind of works. You can access them but they can't access you.

I want to change what I wrote above because I misread the subnet masks the OP posted.

What the OP posted will work fine. However it is bad practice to have different subnet masks on machines in the same subnet and could lead to routing problems later on.

It's important to realize that the subnet is just a mask that is used to see if an IP address is on the same subnet or if it needs to be routed through the default gateway.
 
PLC 1
192.168.1.1
255.255.255.0

PLC 2
192.168.1.2
255.255.0.0


If i set my PC up with the following...
192.168.1.X
255.255.255.0

Yes, set your PC to 192.168.1.X and subnet mask 255.255.255.0.
Then for consistency and good practice, chance PLC 2 to 255.255.255.0.
 
Also from a terminology standpoint some are confusing the subnet and subnet mask.

The subnet is the part of the IP Address that represents the sub network after the network prefix. The subnet mask is what tells devices which part of the IP Address is the prefix, sub network and node.

Also a subnet mask is also only used in dot- decimal addressing. In CIDR notation a subnet mask is not used but the number after the / like 192.168.1.10/24 tells the system what part of the IP Address is the network prefix | Subnet and which part is the used for node addressing.
 
ok, there is some misinformation going on here. Yes, what you described will work. But the mixed subnet masks is usually not a good idea just from a organization aspect. But it is certainly allowed.

So this may be more background than you wanted, but i wanted to set the record straight.

Class a addresses range from 1.0.0.0 - 127.255.255.255. So for example, 10.0.0.1 starts with a 10 so it is a class a address. Class a addresses use 8 bits to represent the network address and 24 bits to represent the individual hosts. So with class a i could have 128 individual networks with each network containing over 2 billion host devices.

Class b addresses range from 128.0.0.0 - 191.255.255.255. So for example, 172.16.0.1 starts with a 172 so it is a class b address. Class b addresses use 16 bits to represent the network address and 16 bits to represent the individual hosts. So with class b i could have 16,384 individual networks with each network containing over 65,000 host devices.

Class c addresses range from 192.0.0.0 - 223.255.255.255. So for example, 201.35.0.1 starts with a 201 so it is a class c address. Class c addresses use 24 bits to represent the network address and 8 bits to represent the individual hosts. So with class c i could have over 2 million individual networks with each network containing over 256 (actually 254) host devices.

We won't get into class d or e.

Class a typically use a subnet mask of 255.0.0.0
255 = 8 consecutive 1 bits followed by 24 consecutive 0 bits is often known as "/8"

class b typically use a subnet mask of 255.255.0.0
255.255 = 16 consecutive 1 bits followed by 16 consecutive 0 bits is often known as "/16"

class c typically use a subnet mask of 255.255.255.0
255.255.255 = 24 consecutive 1 bits followed by 8 consecutive 0 bits is often known as "/24"

this is what is known as classful addressing. This basically meant if 192.168.1.1 was your ip address, then 255.255.255.0 was your subnet mask. Automatic, no ifs ands or buts.

But once ip addresses started to dwindle in availability, we saw how wasteful this addressing scheme really can be. So today, it is not required and most networking people have abandoned it. We can instead use classless addressing. But, you don't really want to mix methods as it can be very confusing and frustrating.

So with classless it is now commonplace to see a mix of address classes and subnets. So your example of 192.168.1.2 with a subnet of 255.255.0.0 is a perfectly acceptable classless address. So the whole idea of class a, b, and c are not terribly relevant with the classless addressing scheme.

Your address of 192.168.1.x with a subnet of 255.255.0.0 is simply saying that this is a network identified as 192.168.0.0. The first ip address in the range is known as the network address. The mask is identifying that the last address on your network would be 192.168.255.255. Now the very first address and the very last are reserved so (256 x 256) - 2 = 65,534 devices could all be on the same network. That is potentially a very large network. One device sending a broadcast message would go to all of those devices.

Your address of 192.168.1.x with a subnet of 255.255.255.0 is saying that this is a network identified as 192.168.1.0. The mask is identifying that the last address on your network would be 192.168.1.255. So 254 devices. That is a much smaller network. One device sending a broadcast message would be contained to only go to those devices. 192.168.0.0 would be a completely separate network as would 192.168.2.0 and so on.

But what if your network didn't require 250+ devices. What if it only needed to handle 10 devices. If we assigned 192.168.1.x with a subnet of 255.255.255.0 we would potentially be wasting 240+ ip addresses that we could use elsewhere.

So the mask of 255.255.255.0 is typically referred to as "/24" as it represents 24 consecutive 1 bits representing the network. The remaining 8 zero bits is where we get how many hosts we can have. But if we change how many network bits are used then we can affect how many host bits are available. So are not stuck with 256 or 65,000 as our only choices.

255.255.252.0 or /22 = 1024 (-2 reserved) hosts per network
255.255.254.0 or /23 = 512 (-2 reserved) hosts per network
255.255.255.0 or /24 = 256 (-2 reserved) hosts per network
255.255.255.128 or /25 = 128 (-2 reserved) hosts per network
255.255.255.192 or /26 = 64 (-2 reserved) hosts per network
255.255.255.224 or /27 = 32 (-2 reserved) hosts per network
255.255.255.240 or /28 = 16 (-2 reserved) hosts per network
255.255.255.248 or /29 = 8 (-2 reserved) hosts per network
255.255.255.252 or /30 = 4 (-2 reserved) hosts per network

so using /28 as our mask we can "sub-network" a typical range into many separate networks.

We could have the network start at 192.168.1.0 and end at 192.168.1.15
we could have another network start at 192.168.1.16 and end at 192.168.1.31
we could have another network start at 192.168.1.32 and end at 192.168.1.47
etc, etc.....

This idea of sub-netting is much more common in the it world where they have a set number of ip addresses available and they cannot be wasted through a wasteful addressing scheme. In the controls world, we typically have had relatively small networks that have been isolated from the enterprise so our addressing methods didn't really matter all that much. Today though we are seeing our control networks connecting to the enterprise network and knowing these addressing schemes becomes quite important.

So i have gone on much longer than i intended and i am sure i lost people along the way. But i wanted to make sure we understand that classless addressing is here to stay which makes the whole idea of class a, b, and c mostly irrelevant.

Og

+1
 
Thanks all for the replies. Very helpful info.

The responses are pretty much what I was expecting/hoping for.

The reasoning behind this was to condense the amount of network configurations required to get online and then write a batch file for easy access to our PLC's.
 

Similar Topics

Hi everyone, I am relatively new to the controls world and I am needing some help on something. We have a pretty new piece of equipment installed...
Replies
1
Views
1,307
I have 3 racks(1756). The 1st rack has PLC and one ENBT module with a subnet of 172.10.10.X. The second rack has 2 ENBT modules + IO, one with...
Replies
14
Views
4,554
In our production plant we have multiple different networks (subnets). IT dept have setup routing between them so different subnets can...
Replies
0
Views
49
Is it possible to connect a PC with running WinCC Advanced or Unified to a siemens PLC such as S7-1200 across different subnets? The computers can...
Replies
0
Views
53
Hi. Rockwell learning curve 132-1b. I was having trouble to change IP address on a EN2TR. Finally found out that I need to change the IP...
Replies
1
Views
734
Back
Top Bottom