Is it possible to use a dynamic dns adress instead of ip adress when using modbus tcp? I have tried but i dont get it to work. Anyone got it working?
Example:
modbus:
type: tcp
host: mysite.dyndns-ip.com
port: 502
Is it possible to use a dynamic dns adress instead of ip adress when using modbus tcp? I have tried but i dont get it to work. Anyone got it working?
Example:
modbus:
type: tcp
host: mysite.dyndns-ip.com
port: 502
Looking at the code, there is no reason to assume this wont work. pymodbus can take a hostname or ip address.
What isn’t working? My guess would be the router at ‘mysite.dyndns-ip.com’ doesn’t have port 502 forwarded for that device.
If this is a local device (on your LAN), keep in mind a lot of routers might not be smart enough to keep the traffic local. It will do the DNS lookup, then forward the packet to your modem which will then turn around and send it to your router…but it will be NAT’d so it would look like an external connection to your router.
No port forward for port 502, no worky.
This can be fixed with a router config, with port forwarding, etc. But if it were a LAN device, I would wonder why you would want to use the external hostname for it…so this might not be the problem.
Does it work if you resolve the ip address and use that manually?
Its not local on the same network. The portforward on the
external router (40km away) works if i use ip adress, but if i use the dynamic dns url i get no connection. I have tried to ping the url using telnet and it converts the ddns url to the right ip adress.
Ok. It probably doesn’t work that way then.
You can maybe add an entry to /etc/hosts and have some script auto update that with the dynamic ip address since it doesn’t seem like the modbus implementation will accept a template.