Makers Blog

Access to PlcNext webserver on DHCP

Martin PLCnext Team 24 November 2020 min. read
451 views 0 comments

 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.

Note:

The Makers Blog shows applications and user stories of community members that are not tested or reviewed by Phoenix Contact. Use them at your own risk.

Discussion

Please login/register to comment

Login/Register

Leave a Reply

Newsletter
Never miss a new article
Sign up for the newsletter
Never miss news about PLCnext Technology
Get interesting content via newsletter four times a year
Receive exclusive information before all other users