MQTT broker address: FQDN instead of IP

I have a MQTT broker on a VPS and every try to use the domain name was unsuccessful.
The only solution is to use the IP but this can change and then I need to flash again.
I found the same is happening for SNTP, the only solution being to use the router IP (fortunately the router has a NTP server).
Is any solution to use the domain and not IPs for MQTT broker address?
Thank you

1 Like

This sounds like an issue with your network or router, not your ESP.

I have no issues using FQDN to connect to external NTP. Maybe try hard coding a DNS server to start and see if that makes a difference?

Thank you for answer.
Indeed for NTP could be the router. I setup an internal NTP server on router and this could be the reason. I will do some tests.
But this shouldn’t impact MQTT broker. Why when using FQDN for broker name here is no connection to the server?
I have other devices in the network connecting to the same MQTT broker using FQDN and are working fine. Of course these devices aren’t flashed with esphome.