DNS IP Integration "Invalid Hostname" error
Checklist
- [x] I have updated to the latest available Home Assistant version.
- [x] I have cleared the cache of my browser.
- [x] I have tried a different browser to see if it is related to my browser.
- [x] I have tried reproducing the issue in safe mode to rule out problems with unsupported custom resources.
Describe the issue you are experiencing
When I try to add Integration "DNS IP", I get the error "Invalid Hostname" and so can not add the integration.
Trying Hostname = "https://myipv4.p1.opendns.com/get_my_ip", also auto reverts back to the default of "myip.opendns.com".
Describe the behavior you expected
The default values are reported in the integration documentation are reported to work.
Steps to reproduce the issue
-
Press "Add integration".
-
Make no changes and press "Submit".
-
System reports error "Invalid Hostname".
-
Paste the address "https://myipv4.p1.opendns.com/get_my_ip"
-
Press "Submit"
-
The host name auto reverts back to "myip.opendns.com"
-
System reports error "Invalid Hostname".
What version of Home Assistant Core has the issue?
Core 2025.8.3
What was the last working version of Home Assistant Core?
NA
In which browser are you experiencing the issue?
Google Chrome 139.0.7258.155
Which operating system are you using to run this browser?
Windows 11 Build 26100-4946
State of relevant entities
Problem-relevant frontend configuration
JavaScript errors shown in your browser console/inspector
Additional information
The similar problem as in #144706. This was suppose to be fixed in the next release. aiodns was updated to 3.5.0 in HA 2025.6.1
I have tried HA version 2025.7.0 2025.8.0 2025.8.3
Home Assistant runs in a docker container on a Synology NAS.
#144706 has been locked & limited to collaborators on Jul-5
I'm going to move this to core issue. Frontend submits the URL as you requested to backend.
It is the backend integration that returns the response invalid hostname, and returns the field set back to the default. Both of those problems need to be fixed in backend.
Hey there @gjohansson-st, mind taking a look at this issue as it has been labeled with an integration (dnsip) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of dnsip can trigger bot actions by commenting:
-
@home-assistant closeCloses the issue. -
@home-assistant rename Awesome new titleRenames the issue. -
@home-assistant reopenReopen the issue. -
@home-assistant unassign dnsipRemoves the current integration label and assignees on the issue, add the integration domain after the command. -
@home-assistant add-label needs-more-informationAdd a label (needs-more-information, problem in dependency, problem in custom component) to the issue. -
@home-assistant remove-label needs-more-informationRemove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.
(message by CodeOwnersMention)
dnsip documentation dnsip source (message by IssueLinks)
Now I tried it twice and it works like a charm so there isn't any issue with this integration. Are you perhaps blocking dns in your firewall or something as the myip address requires certain dns servers to be used.
Why you're testing myipv4.p1.opendns.com/get_my_ip I have no idea because that has nothing to do with this integration.
my home assistant is set to resolve DNs on my own router, but is not resolving any local addresses, on the log I get nothing, and when I run ssh to ping some device addresses, is not pinging
@gjohansson-ST Thank you for the advice to check firewall rules. First up I did confirm that my Synology NAS where the Home Assistant Docker container is running was allowing port 53. I have tried again with the same result. I have tried disabling the firewall on the Synology NAS where the Home Assistant Docker container is running. I have tried creating a Firewall rule on my UDM-SE router to allow all traffic to the external zone, with this being the first policy in the list. All with the same result of "Invalid Hostname" After this testing, I have fully re-enabled both firewalls.
The reason why I tried myipv4.p1.opendns.com/get_my_ip is from issue #144706. Also from https://support.opendns.com/hc/en-us/articles/227986687-How-can-I-determine-my-public-IP-Address, this was the new address.
I understand that this integration does not have anything to do with myipv4.p1.opendns.com/get_my_ip
If I put in my domain name, it does accept this and complete the integration setup. However this IP address is a CloudFlare IP address that my domain routes through, as I use a Cloudflare tunnel. When I try to add a domain of myip.opendns.com, I still get the error of "Invalid Hostname".
I am not seeing anything further in the HA logs about this error.
Both myipv4.p1.opendns.com/get_my_ip & https://whatismyipaddress.com/ in a web browser give me the same IP address.
I did use Wireshark to monitor the traffic. When I submitted the add entry in DNS IP to add hostname myip.opendns.com I can see two standard query go to myip.opendns.com, I then get two response from that address. I can see similar traffic for the Hostname that does work.
The response that I get for the query to myip.opendns.com is "SOA auth1.opendns.com OPT" for both queries (both IPV4 & IPV6). The response that I get for the hostname that does work is the IPV4 address, then the IPV6 address, both ending with "OPT". All of this is happening with the firewalls turned ON but allowing port 53.
One other thing that I can say is that my WAN IP does not match my Public IP. I think that is this carrier grade NAT. Does the DNS IP Integration work with carrier grade NAT?
I do understand that the Integration is working. Are you able to clarify if the DNS IP integration works with carrier grade NAT?
If there is anything else you can point me to look at would be great. I appreciate the work that you have done on this integration.
@hiagocosta Sorry, it is not clear to me what you are trying to do and what is not working. However I do not know too much about this. Have you tried using Wireshark to monitor the DNS traffic?
Hi! Are you sure that Home Assistant is using your DNS-server? You can check at "System > Network":
Hello GrumpyMeow, Thank you for your information.
See below what I see for my System > Network page in Home Assistant.
On my NAS (where Home Assistant is running in a Docker container) the DNS is my Router. My router DNS are Primary = 1.1.1.1 Secondary = 8.8.8.8
@gjohansson-ST are you able to clarify if the DNS IP integration have any known issues when working with carrier grade NAT? Also does the DNS IP integration, have any known issues, when the system is using DoT or DoH (DNS over TLS & HTTPS)?
For what it's worth after issues I deleted the sensor and was unable to create it again with the default myip.opendns.com but it added just fine with myip.dnsomatic.com. It isn't my IP address but it didn't give me an error.
@bertramt I checked, myip.opendns.com still returned "invalid hostname", so tried myip.dnsomatic.com, this was accepted as a hostname, however the IP address that it returned, did not match my public IP address or the other IP (CGNAT address).
I was finally able to resolve my issue. In my case I'm using adguard home dns servers in my house. After some discovery I determined that when I "dig +short myip.opendns.com" it was returning nothing. I could "dig +short myip.opendns.com @208.67.222.222" and it returned my IP. So I started chasing that issue and added "/myip.opendns.com/]https://doh.opendns.com/dns-query" as an upstream DNS server. All my upstreams are DNS over HTTPS but this addition should force to to use the opendns servers to make the request to myip.opendns.com. Then I went and added the DNS IP integration again. First I tried leaving everything to defaults and it fails with the invalid hostname. I then switched the resolver to my internal DNS then added. My theory is that the invalid hostname error is happening because the integration isn't getting back an ip when you try to add it. The why is still in question. In theory it's should using opendns servers by default but even if it isn't for some reason when you manually put in 208.67.222.222 it should work. So the only thing I can figure is that something is breaking the addon's ability to reach the opendns servers directly as when I put in my local resolver (after fixing it) then it worked. The invalid hostname error is a very generic error but the long and short of it is if it queries DNS and gets nothing back, it assumes the hostname is invalid.
I was fighting this over the past few days as well. Just this morning I figured out putting the below code in the configuration.yaml solved the problem and no longer need this integration. I did already have the "RESTful Command" integration running so you need it. When you reload HA it will automatically create an entity called "WAN IP ADDRESS". I found the code in a different ticket
sensor:
- platform: rest
name: "WAN IP Address"
resource: https://api.ipify.org?format=json
value_template: "{{ value_json.ip }}"
scan_interval: 300 # time in seconds
unique_id: ipv4
@bertramt I was not able to get that to work correctly. I was getting an IP address but it was not correct. I have been able to get my WAN IP Address using Rest per the above.
@jbonzey I was able to get this to work successfully with the Rest platform
Thank you both for your input.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
My update is that the DNS IP integration still does not work for me with HA Version 2025.12.0. I no longer have carrier grade NAT just a dynamic IP from my ISP, but still get “Invalid Host” error. Per my update (21-Sep) I did try the “Restful” Integration option that @jbonzey (17-Sep) mentions above and that does work for me. So, I do have my Public IP available in my HA system.
I did ask (10-Sep) some questions about the DNS-IP integration and if it had issues with
- Carrier grade NAT (CGNAT)
- DoT or DoH) (DNS over TLS/ & HTTPS) However did not get an answer.
I did try the “myip.dnsomatic.com” as the hostname (17-Sep) but retried this now that I am no longer on CGNAT, however DNS-IP with this hostname still gives me the wrong public IP address. This is the same result that @bertramt found, but shows that the integration can progress through its workflow.
It does seem like may people have this integration working. It seems that some of those who cannot get this integration work have found an option through the RESTful integration.
It would be good to get the DNS-IP integration addressed whether it be a problem in the integration, a problem with my setup or limitations for the integration added to the information page. I am happy to do further testing if someone can tell me what I should try.
Hi, I have installed this today and found that I had to change the URL to "myip.dnsomatic.com" as suggested in this thread. I wonder as a easy first step should the default url be changed to this (especially for new users)?
Hello @mgguinne, “myip.dnsomatic.com”, from what I have tested and seen, this is not a valid Hostname to allow your Home Assistant to show what your Public IP address is. When I used this Hostname it was only to show that the DNS-IP Integration does work correctly once it does have a valid hostname. When I do a dnslookup, from a command prompt, on “myip.dnsomatic.com” I get 146.112.255.205. When I put “myip.dnsomatic.com” as a hostname in the DNS-IP integration it also gives 146.112.255.205. This is the public IP address for the myip.DNSomatic.com service, not my Public IP. If you also get 146.112.255.205 from you DNS-IP integration this is not your public IP address. If I go to the web address myip.dnsomatic.com, then it does display on the result of that web page my correct public IP address.
You can check your public IP address via www.whatismyip.com If the hostname that you put into the DNS-IP integration works correctly it should return the IP that is shown at this website.
Hello @mgguinne, “myip.dnsomatic.com”, from what I have tested and seen, this is not a valid Hostname to allow your Home Assistant to show what your Public IP address is. When I used this Hostname it was only to show that the DNS-IP Integration does work correctly once it does have a valid hostname. When I do a dnslookup, from a command prompt, on “myip.dnsomatic.com” I get 146.112.255.205. When I put “myip.dnsomatic.com” as a hostname in the DNS-IP integration it also gives 146.112.255.205. This is the public IP address for the myip.DNSomatic.com service, not my Public IP. If you also get 146.112.255.205 from you DNS-IP integration this is not your public IP address. If I go to the web address myip.dnsomatic.com, then it does display on the result of that web page my correct public IP address.
You can check your public IP address via www.whatismyip.com If the hostname that you put into the DNS-IP integration works correctly it should return the IP that is shown at this website.
Ah yeah, sorry about that, you are correct. I think I will use the rest method, I haven't been able to get this work for a while. It would be good to know when/if it gets fixed.