Previous in Forum: Python Programming Question   Next in Forum: What is a Virus?
Close
Close
Close
10 comments
Rate Comments: Nested
Active Contributor

Join Date: May 2013
Posts: 18

PLC Programming and Network Help

06/21/2013 10:08 AM

Hello I have a question regarding PLC and DHCP programming. I think I'm in the right place but if not please feel free to point me in the proper direction.

So I have a PLC that is connected to a switch with a couple static address items and then one item that uses DHCP and it is looking for an address. I guess the question I have is how would I find this device with the PLC if it doesn't already have an IP address? I understand how to send it one once I find it, but finding it is the problem. I am not great with wireshark (just started learning it since this is out of my wheelhouse) but I do have some screen caps of the traffic going on between the devices.

Thank you for the help everyone.

Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Guru

Join Date: Oct 2008
Posts: 42355
Good Answers: 1693
#1

Re: PLC programming and network help

06/21/2013 10:14 AM

I hope this isn't another DC Breaker in AC Circuit type question.

Register to Reply
Active Contributor

Join Date: May 2013
Posts: 18
#2
In reply to #1

Re: PLC programming and network help

06/21/2013 10:23 AM

Not really sure what that is supposed to mean, however, I'm just looking for help not criticism. Thank you.

Register to Reply
Guru

Join Date: Oct 2008
Posts: 42355
Good Answers: 1693
#3
In reply to #2

Re: PLC programming and network help

06/21/2013 10:40 AM

That wasn't criticism, yet.

My point was last time you came here for "help" you wanted documentary proof that what you were told here was correct and then it turned out that you were merely experimenting.

So, are you really doing something with this equipment, or are you just curious.

<unsubscribe>

Register to Reply
Active Contributor

Join Date: May 2013
Posts: 18
#4
In reply to #3

Re: PLC programming and network help

06/21/2013 11:04 AM

I am really doing something with this equipment as I mentioned before I have screen caps of wireshark to help facilitate any questions someone might have about the devices.

Register to Reply
Active Contributor

Join Date: May 2013
Posts: 18
#5

Re: PLC programming and network help

06/21/2013 11:22 AM

So this is a screen cap of what I am seeing on wireshark. .252 is the PLC controller I'm using and .146 is my computer. The rest of the IP addresses are static addresses that I am currently looking for (not being found because they are all off). But now I have frame 64 where the new device using DHCP comes online. I'm not sure how to communicate with this device if I doesn't yet have an IP address or what I should be looking for in terms of communication type things with the PLC. I'm sure I left something out but this should get things moving in the right direction I hope.

Register to Reply
Active Contributor

Join Date: Jun 2013
Posts: 14
Good Answers: 2
#6
In reply to #5

Re: PLC programming and network help

06/22/2013 5:39 PM

Looking at the Wireshark trace, the DHCP packets are IPv6 and therefore nothing to do with what you are doing. These DHCP requests are probably coming from PCs that have IPv6 enabled.

If you have a device which needs to use DHCP, but you want it to have the same IP address every time it applies to the DHCP server, you need to create a Reservation in the DHCP server. If you go into the settings of the DHCP server, you can enter a mapping between a device's MAC address and the IP address you want it to have. Every time the devices applies for a lease from the DHCP server, the server matches the MAC address in the Reservations table and allocates the corresponding IP address.

Register to Reply
Active Contributor

Join Date: May 2013
Posts: 18
#7
In reply to #6

Re: PLC programming and network help

06/24/2013 12:10 PM

So after some research it seems I can't really do this from a PLC and I in fact need some type of DHCP server. It should be possible though to program individual ports to still use DHCP but always provide the same IP address correct? i.e. port 1 always gives out 192.168.1.194 port 2 is .195 etc? I want to use the assumption that the MAC address could be anything, but knowing that it would be wired to the same VLAN always

Register to Reply
Active Contributor

Join Date: Jun 2013
Posts: 14
Good Answers: 2
#8
In reply to #7

Re: PLC programming and network help

06/24/2013 4:07 PM

No, DHCP is not related to the port on the switch and a switch will not allocate IP addresses based on port. This is not how DHCP is designed to work. When a device requests an IP address from a DHCP server (I use server here to describe the function - this might be a process running in a router or switch) the device sends a MAC level broadcast in search of a DHCP server. The switch would forward this broadcast out of all ports.

Register to Reply
Active Contributor

Join Date: May 2013
Posts: 18
#9
In reply to #8

Re: PLC programming and network help

06/25/2013 11:21 AM

So I understand that DCHP is not designed to work on specific ports. However, I have found white papers that talk about local address allocation where the switch recognizes a DHCP request from a client and based on what port that came in on assigns a specific address to that client. I provided a link below of where I found this and it was on page 4. I think that idea is along the lines of what I need to do with whatever switch I find.

So its not necessarily a server I need but more of a switch that recognizes DHCP commands...

Here's the link:

http://www.n-tron.com/pdf/dhcp_white_paper.pdf

Register to Reply
Member

Join Date: Aug 2011
Posts: 7
#10
In reply to #9

Re: PLC programming and network help

06/25/2013 2:53 PM

You still need a DHCP server. The example you're showing just has the DHCP server built into a switch. On the DHCP server itself, you should be able to assign an IP address reservation. Each time a network card sends out a DHCP request, it sends it's MAC address. This address is also known as the hardware address and shouldn't change (unless you spoof it for a reason or something, but that's probably beyond what you're doing here.) By setting a reservation on the server to a particular MAC address, that network card will always get the same IP address from the DHCP serer. The other option would be to set a static IP address on the PLC itself. I'm not sure where to point you on that one, as it's not my field, but I would imagine you should be able to program it via another interface (serial, USB, or something else?) in the event you were running it without a network, but again this is just a guess. Perhaps someone more knowledgeable on PLC's could chime in?

Jarred

Register to Reply
Register to Reply 10 comments
Copy to Clipboard

Users who posted comments:

Beynona (2); jfaris (1); jxm1092 (5); lyn (2)

Previous in Forum: Python Programming Question   Next in Forum: What is a Virus?

Advertisement