# Cannot Resolve Hostname on LAN

**URL:** <https://help.nextcloud.com/t/cannot-resolve-hostname-on-lan/215883>\
**Category:** ℹ️ Support\
**Tags:** local\_network, rebind\_protection, ncp\
**Created:** [January 24, 2025, 10:13pm UTC](https://help.nextcloud.com/t/cannot-resolve-hostname-on-lan/215883 "2025-01-24T22:13:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cweinhofer](https://help.nextcloud.com/user_avatar/help.nextcloud.com/cweinhofer/32/14996_2.png) [@cweinhofer](https://help.nextcloud.com/u/cweinhofer)\
**Post date:** [January 24, 2025, 10:13pm UTC](https://help.nextcloud.com/t/cannot-resolve-hostname-on-lan/215883/1 "2025-01-24T22:13:08Z")

</div>

I having a strange issue with my NextCloudPi that’s prohibiting me from accessing it on my LAN via its hostname or FQDN (e.g. [nextcloud.mydomain.com](http://nextcloud.mydomain.com)). Here’s some notes and/or things I’ve tried:

1. I can access it via it’s IP address just fine. Also, I have external port forwarding set up and it resolves when accessing externally, just not on LAN.

2. Router is OpenWRT 21.02. I have double checked that NAT loopback is enabled and I don’t think this is an issue with the general router setup. All of my other internal server-like machines (HomeAssistant, MagicMirror, Linux file server) resolve in the LAN just fine.

3. If I do an nslookup for the hostname on Win 11 cmd, the router returns the FQDN but no IP address.

Appreciate any help!

---

<div class="post-metadata">

**Author:** ![wbk](https://help.nextcloud.com/letter_avatar/wbk/32/6_449c533f586939b6e5f246632a46421f.png) [@wbk](https://help.nextcloud.com/u/wbk)\
**Post date:** [January 24, 2025, 10:49pm UTC](https://help.nextcloud.com/t/cannot-resolve-hostname-on-lan/215883/2 "2025-01-24T22:49:03Z")

</div>

Hi cweinhofer,

My first reaction was “DNS rebind protection”, if you have not looked into that. OpenWRT

It _may_ be that the other servers run mDNS to be reachable on their domain name, without using DNS and thus without triggering the DNS rebind protection in the first place. On second thought… that would place them at `homeassistant.local`, not at `homeassistant.mydomain.com`

Having said that, _does_ mDNS work for your NC Pi?

Some other thoughts:

- does configuring another DNS on your cliest give other behaviour?
- as troubleshooting point, does entering the details for your NC Pi in `hosts` at your client provide access

Just checking: externally the FQDN _does_ resolve to your NC Pi, doesn’t it?

---

<div class="post-metadata">

**Author:** ![cweinhofer](https://help.nextcloud.com/user_avatar/help.nextcloud.com/cweinhofer/32/14996_2.png) [@cweinhofer](https://help.nextcloud.com/u/cweinhofer)\
**Post date:** [January 26, 2025, 12:59pm UTC](https://help.nextcloud.com/t/cannot-resolve-hostname-on-lan/215883/3 "2025-01-26T12:59:31Z")

</div>

Thanks for all your suggestions. Sorry for the late reply, but I wanted to make sure I investigated them all before I responded.

> [@wbk](#):
>
> My first reaction was “DNS rebind protection”

I found the rebind protection box in the DHCP seeting in OpenWRT and it was unchecked? Assuming that’s correct, right?

> [@wbk](#):
>
> Having said that, _does_ mDNS work for your NC Pi?

mDNS would be accessing it via `<hostname>.local` right?  
I do get a response from that address, but it has a certificate error. If I tell the browser to ignore the “bad” cert, it then gives gives the error

```auto
Internal Server Error
The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

```

presumably becuase nextcloud.local is not in the trusted domains list (only nextcloud_pi_.local). And while I was looking at the config.php, I did verify that both `nextcloud.mydomain.com` and the assigned LAN IP address are listed.

> [@wbk](#):
>
> - does configuring another DNS on your cliest give other behaviour?

Yes. If I manually switch to 8.8.8.8 the FQDN resolves

> [@wbk](#):
>
> - as troubleshooting point, does entering the details for your NC Pi in `hosts` at your client provide access

Yes, this also allows be to bring up the site.

> [@wbk](#):
>
> Just checking: externally the FQDN _does_ resolve to your NC Pi, doesn’t it?

Correct

Also an additional piece of info. I just noticed that there is a line for NAT loopback on the NCP system info screen and it says “no”  
As I said above, I double checked this (and rebind protection) on the router, but I’ve attached the relevant screens in case I missed something.

 ![ncp-80](https://help.nextcloud.com/uploads/default/original/3X/a/b/abd88f9ca48eab29edcf14fbf892ec69ea3e1734.png)  
 ![ncp-443](https://help.nextcloud.com/uploads/default/original/3X/2/8/286a683cf12eb95adda23391138457daaac2e16b.png)  
 ![ncp-dhcp](https://help.nextcloud.com/uploads/default/original/3X/5/a/5afaf20f74efe92bc36b1fd978d7553997cf1225.png)

---

<div class="post-metadata">

**Author:** ![wbk](https://help.nextcloud.com/letter_avatar/wbk/32/6_449c533f586939b6e5f246632a46421f.png) [@wbk](https://help.nextcloud.com/u/wbk)\
**Post date:** [January 27, 2025, 7:24am UTC](https://help.nextcloud.com/t/cannot-resolve-hostname-on-lan/215883/4 "2025-01-27T07:24:47Z")

</div>

> [@cweinhofer](#):
>
> > [@wbk](#):
> >
> > My first reaction was “DNS rebind protection”
> 
> I found the rebind protection box in the DHCP seeting in OpenWRT and it was unchecked? Assuming that’s correct, right?  
> ![image](https://help.nextcloud.com/uploads/default/original/3X/d/5/d52e1679df312dfc1b767725fd792aa7c7fbecc8.png)

I would say so, yes.

Even so,

> [@](#):
>
> > [@](#):
> >
> > - does configuring another DNS on your cliest give other behaviour?
> 
> Yes. If I manually switch to 8.8.8.8 the FQDN resolves

If using DNS on your router does _not_ resolve, but using an external DNS _does_ resolve, that very much sounds like DNS rebind protection in action.

Some thoughts:

- Has the internal IP of your NCPi been changed, recently, giving possible caching a chance to mess things up?
- Have you had a look at OpenWRT logging while trying to reach your NCPi?
- Is your NCPi configured with hostname and static IPv4/IPv6 in OpenWRT?

---

<div class="post-metadata">

**Author:** ![cweinhofer](https://help.nextcloud.com/user_avatar/help.nextcloud.com/cweinhofer/32/14996_2.png) [@cweinhofer](https://help.nextcloud.com/u/cweinhofer)\
**Post date:** [January 27, 2025, 5:24pm UTC](https://help.nextcloud.com/t/cannot-resolve-hostname-on-lan/215883/5 "2025-01-27T17:24:28Z")

</div>

Thanks, @wbk. Happy to report that this is now working. It was partly your suggestion to check the OpenWRT logs that set me off in the right direction.

The DNS queries doen’t show up in the OpenWRT logs by default, so I hadn’t noticed anything when I checked earlier. But your question made me look again and I saw in the OpenWRT documentation that you have to enable DNS logging by SSHing into the router and entering:

```auto
uci set dhcp.@dnsmasq[0].logqueries="1"
uci commit dhcp
service dnsmasq restart

```

[https://openwrt.org/docs/guide-user/base-system/dhcp\_configuration#logging\_dns\_queries](https://openwrt.org/docs/guide-user/base-system/dhcp_configuration#logging_dns_queries)

Them you can see the entries in Status \> System Log

Also, for anyone reading this thread later, the logs get filled up quickly, so you’ll want to check immediately after doing anything.

In my case it was that a CNAME entry I had set up earlier when I was trying a different tact with my setup was causing a conflict with the assignment of the hostname to the NCPi .

Also, just for reference, it seems like the rebind protection wasn’t playing a factor at all. Both pre-fix and post-fix having it on or off seems to make no difference.

Anyway, thanks again.

---

<div class="post-metadata">

**Author:** ![wbk](https://help.nextcloud.com/letter_avatar/wbk/32/6_449c533f586939b6e5f246632a46421f.png) [@wbk](https://help.nextcloud.com/u/wbk)\
**Post date:** [January 27, 2025, 7:14pm UTC](https://help.nextcloud.com/t/cannot-resolve-hostname-on-lan/215883/6 "2025-01-27T19:14:42Z")

</div>

Thanks for posting back the solution and the helpful tips 🙂

> [@cweinhofer](#):
>
> In my case it was that a CNAME entry I had set up earlier when I was trying a different tact with my setup was causing a conflict with the assignment of the hostname to the NCPi .

Good catch!

> [@](#):
>
> the logs get filled up quickly, so you’ll want to check immediately after doing anything.

and, after that you may switch off logging DNS queries (it may well be the reason they’re off by default)

> [@](#):
>
> Also, just for reference, it seems like the rebind protection wasn’t playing a factor at all. Both pre-fix and post-fix having it on or off seems to make no difference.

That is good to know, thanks!

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [February 4, 2025, 7:15pm UTC](https://help.nextcloud.com/t/cannot-resolve-hostname-on-lan/215883/7 "2025-02-04T19:15:17Z")

</div>

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.
