Skip to main content

DNS

The DNS feature resolves hostnames such as api.example.com into IP addresses. Any feature that connects to a server by name depends on it, including the HTTP Client, MQTT and the SMTP Client.

DNS is added to the project automatically when a feature that needs it is enabled. You only need to open it to change the name servers or the timeout.

Configuration​

  • DNS Enabled: turns the resolver on. The other properties are hidden while it is off.
  • Server 1: primary DNS server. Defaults to 8.8.8.8 (Google Public DNS).
  • Server 2: optional secondary DNS server, used if the primary does not answer.
  • DNS Reply Timeout(ms): how long to wait for a DNS reply before the lookup fails. Defaults to 5000.
tip

On a private network without internet access, point Server 1 at your local DNS server, often your router's address, so local hostnames resolve.

Troubleshooting​

If requests to a hostname fail but requests to the same server by IP address succeed:

  • Check that the device has a working network connection and gateway.
  • Confirm the DNS server is reachable from the device's network. Some networks block outside DNS servers such as 8.8.8.8.
  • Increase DNS Reply Timeout on slow or cellular links.

See Also​