You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old March 30th, 2016, 09:25 AM   #1
WillM
Member
United Kingdom

WillM is offline
 
Join Date: Mar 2015
Location: England
Posts: 45
Subnet question...

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
  Reply With Quote
Old March 30th, 2016, 09:51 AM   #2
Tharon
Member
United States

Tharon is offline
 
Join Date: Jan 2007
Location: Michigan
Posts: 1,414
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.
  Reply With Quote
Old March 30th, 2016, 09:59 AM   #3
harryting
Lifetime Supporting Member
United States

harryting is offline
 
harryting's Avatar
 
Join Date: May 2002
Location: Puget Sound
Posts: 1,604
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.
  Reply With Quote
Old March 30th, 2016, 10:03 AM   #4
tragically1969
Member
United Kingdom

tragically1969 is offline
 
Join Date: Jun 2007
Location: uk
Posts: 1,192
Quote:
Originally Posted by Tharon View Post
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
  Reply With Quote
Old March 30th, 2016, 10:07 AM   #5
Pete.S.
Member
United States

Pete.S. is offline
 
Join Date: Mar 2016
Location: Fl
Posts: 373
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 by Pete.S.; March 30th, 2016 at 10:09 AM.
  Reply With Quote
Old March 30th, 2016, 05:05 PM   #6
Operaghost
Member
United States

Operaghost is offline
 
Operaghost's Avatar
 
Join Date: Apr 2002
Location: Seattle, WA USA
Posts: 2,522
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
  Reply With Quote
Old March 30th, 2016, 05:20 PM   #7
zach_zachary1@yahoo
Member
United States

zach_zachary1@yahoo is offline
 
Join Date: Feb 2015
Location: NC
Posts: 18
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
  Reply With Quote
Old March 30th, 2016, 05:29 PM   #8
Operaghost
Member
United States

Operaghost is offline
 
Operaghost's Avatar
 
Join Date: Apr 2002
Location: Seattle, WA USA
Posts: 2,522
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
  Reply With Quote
Old March 30th, 2016, 07:17 PM   #9
Pete.S.
Member
United States

Pete.S. is offline
 
Join Date: Mar 2016
Location: Fl
Posts: 373
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 by Pete.S.; March 30th, 2016 at 07:19 PM.
  Reply With Quote
Old March 30th, 2016, 07:34 PM   #10
Pete.S.
Member
United States

Pete.S. is offline
 
Join Date: Mar 2016
Location: Fl
Posts: 373
Quote:
Originally Posted by Pete.S. View Post
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.
  Reply With Quote
Old March 30th, 2016, 07:37 PM   #11
Pete.S.
Member
United States

Pete.S. is offline
 
Join Date: Mar 2016
Location: Fl
Posts: 373
Quote:
Originally Posted by WillM View Post
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.
  Reply With Quote
Old March 30th, 2016, 08:54 PM   #12
PBuchanan
Lifetime Supporting Member
United States

PBuchanan is offline
 
PBuchanan's Avatar
 
Join Date: Jun 2015
Location: Atlanta, Georgia
Posts: 346
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.
  Reply With Quote
Old March 30th, 2016, 08:55 PM   #13
PBuchanan
Lifetime Supporting Member
United States

PBuchanan is offline
 
PBuchanan's Avatar
 
Join Date: Jun 2015
Location: Atlanta, Georgia
Posts: 346
Quote:
Originally Posted by operaghost View Post
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
  Reply With Quote
Old March 31st, 2016, 05:27 AM   #14
WillM
Member
United Kingdom

WillM is offline
 
Join Date: Mar 2015
Location: England
Posts: 45
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.
  Reply With Quote
Old March 31st, 2016, 04:13 PM   #15
widelto
Member
Colombia

widelto is offline
 
widelto's Avatar
 
Join Date: Jul 2005
Location: barranquilla
Posts: 2,451
For those who want to go beyond normal knowledge please go to:
http://www.freesoft.org/CIE/Course/index.htm
It's an Internet Encyclopedia, go to Subnetting and CIDR section.
__________________
My two cents.

Last edited by widelto; March 31st, 2016 at 04:19 PM.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Recent testing question mrtweaver LIVE PLC Questions And Answers 19 August 28th, 2009 02:14 PM
This is less of a PLC question and more an AutoCad Electrical Question Controls_Engineer79 LIVE PLC Questions And Answers 2 March 31st, 2009 12:47 PM
DH + Question kbradray LIVE PLC Questions And Answers 3 August 1st, 2008 01:02 PM
Integrator Business Question mjrx LIVE PLC Questions And Answers 3 April 12th, 2007 05:37 AM
How to Ask Questions The Smart Way Ken Roach LIVE PLC Questions And Answers 14 March 26th, 2007 08:12 AM


All times are GMT -5. The time now is 09:43 PM.


.