Cannot access home assistant from local network

Hello,
I met a strange problem since 2 days ago, please kindly help!

I have Home assistant installed on raspberry pi 4. Current version 0.114.4 (didn’t update or change anything for long time).
Configured ddns and ssl certificate. Can access via URL.

Problem:
Since 2 days ago I cannot open the home assistant only from local network. Which is:

  1. open https://url from mobile phone with home wifi – Unable to connect to Home Assistant.
  2. open https://url from computer Chrome with home LAN cable/wifi – Unable to connect to Home Assistant.
  3. open https://url from mobile phone with 4g network – works without problem
  4. open https://192.168.x.x:8123 from mobile phone/computer with home wifi/LAN – works without problem
  5. open https://my_wan_ip_address from mobile phone with home wifi – Unable to connect to Home Assistant.

What I tried:

  1. use no matter external url or ip address, doesn’t work. So I think it is not ddns problem.
  2. I have also NAS access with the same url and another portal, works fine. So should not be port mapping problem.
  3. I have reset the router according to some suggestions searched from other posts. didn’t help.
  4. I first opened the home assisatant on mobile phone with 4G correctly, and then connent to home wifi, immediately lost connection of home assistant.
  5. I checked iptables, no ip address is blocked. Also restartes router many times to refresh a new wan ip address. no help.
  6. All automations and alexa voice control still work fine. The home assistant is actually working. Just cannot open the frontend when I am in local network environment.

I don’t know what I can do more. Please kindly help. Thanks a lot!

BR
Mike

Has this worked in the past?

The reason I ask is because some routers do not support NAT loopback. If your router doesnt support this I will suggest getting a new router or setup HA properly with an internal and external url.

Within the HA app on your phone you can also set these (though you must have it configured first).

This way, whenever you are on your home network it will prioritise the internal url over the external url and vice versa.

So make absolutely sure that your router (and isp) supports nat loopback or else you will find yourself having a very very hard time finding a solution.

Is there anything in your home-assistant.log or Notifications indicating there’s an access problem? Can you ping HA from another computer on the local network?

yes, it worked for years. and just started 2 days ago, suddenly cannot open in local network. Like I said, if I open it from other network, it works fine.

No, the home assistant runs well, I didn’t see any error log for this. I can ping the url from local computer, responses fast without problem.

Is it your router, or a provider router ? Could be your provider pushed a firmware update that disables Nat hairpinning.

So #4 says you can connect with an IP address but using your local host name it’s unresponsive. If that’s the case, it could be an issue with mDNS. Can you ping with with the host_name.local address? Have you tried a non-secure URL (use http, not https)?

#4 I mean I can open it with internal ip address (192.168.x.x:8123) from internal LAN (for example computer with internal address 192.168.x.y) Nothing about host name, I didn’t try that.
My problem is the access with url (e.g. https://xxx.ddns.net). If I connencted to my home LAN, then I cannot open home assistant with the url. If I am not in my LAN (e.g. using cellular data), then it works.

Not sure. I tried reset my router to factory mode, but the problem is the same. The firmware version is the same as before reset. Maybe it was updated but the factory reset doesn’t really reset the firmware version? I will later try to search when this version is published. Thanks!

No, it only resets the user settings, never the firmware.

See if any of this helps:

https://peyanski.com/home-assistant-remote-access/#What_if_Home_Assistant_Remote_Access_is_not_working_or_you_loose_your_local_access

I checked my routers, no firmware update in at least last 12 months…

I have the same issue and it started after I updated HA Core yesterday. I can access it externally no problem, but using the IP address and port number via the LAN I get the HA logo and the the error “Unable to connect to Home Assistant.” with a retry link underneath. Has worked fine for months and no recent router update.

I don’t even update anything. suddenly cannot open…

I’m wondering if it has something to do with your browser. Every once in a while, I have to clear the cash to get a proper update to a page.

I don’t think so, because I tried both on computer and mobile phone. not on one single device

1 Like

I’m running out of ideas, likely because I just don’t know enough.

I think the next place I’d look is at your DNS and the router. Try to ping https://xxx.ddns.net and see how it resolves. If it doesn’t resolve to a local address, I’d take @jimz011’s and @francisp’s advice and determine if NAT loopback (sometimes called Hairpin NAT or NAT Reflection) can be configured in your router. Perhaps your ISP provided a hairpin path and disabled it two days ago.

https://en.wikipedia.org/wiki/Network_address_translation#NAT_loopback

I will try to investigate more. But like I mentioned, I also have my NAS access with the same url and another portal
(https://external_url:xxxx ) That works without problem. If it is the NAT loopback problem, that should also not work, right?

By the way, when I ping the url from local computer, I get the external ip address.

Is your NAS on the same host as HA? If not, I believe there should be separate routing rules for each destination that’s forwarded. If the two messages appear identical (e.g. both use port 443), there’s no way for the rule to know which forward IP to use.

Has the Duck DNS add-on changed? It’s currently at version 1.13.0. If it was recently updated, some configuration requirement might’ve changed. Have you looked at the tutorial link in post #15? Note there are separate configuration.yaml entries for local vs external URLs. I also see what looks like an instance of fail2ban in the add-on. If it detects 5 invalid attempt to log into HA, it will create an IP ban and prohibit further communication from that source .

Seriously, all we can do is guess what could be wrong. FYI, the publisher of the tutorial seems willing to provide support.