Access to PlcNext webserver on DHCP

Print

I would like to share an application story from Ignacio Aláez, a Solution Engineering Expert from Phoenix Contact Spain, which might be of interest to the PLCnext Community.



As part of a project we have the problem of accessing a Plcnext webserver when the IP is assigned via DHCP.

We found a workaround using the free service Duckdns : https://www.duckdns.org/

There is a variety of ways to login, for instance via Google account. You get a token and aftewards you can select a domain like : http:// yourdomainforplcnext.duckdns.org.

The service has an API that can be used from Plcnext Engineer.

With the help of FB PBCL_SysNetwork ( part of PlcnextBase library ), you can readout the IP that has been assigned to the plc by the DHCP server.

Using again a FB from the same library, PBCL_SysLinuxShell, this command can be sent to Duckdns:

curl -s --connect-timeout 5 -m 15 "https://www.duckdns.org/updat...n>&ip=<your_local_ip>&verbose=true"

The trick is to update your host not with the public address of your router ( this is the normal use of this service ), but with you local address assigned by DHCP.

You have to type https://yourdomain.duckdns.org in a browser running in a pc in the local network. This browser will go to Duckdkns to resolve the IP and it will answer with the local IP.