How are people using OH2 on their LAN/WAN with DNS

Hi All,

How are you using OH2 when using HabPanel Viewer and the OH2 app ? Do you use a DNS name that is resolved locally when you’re on the LAN and then use public DNS with a domain name for when your on the WAN?

I’ve always struggled with this.

HabPanel viewer only has 1 server connection field, the android app has two for a local/remote setting

Be interested to know.

Thanks!

i am using IOS app only…

for local, just my IP
for public i put https://www.myopenhab.org
with pass and user of myopenhab cloud

not sure why to use private DNS?? can you elaborate maybe i missed something in the three years i am here hhh, also I’ve always struggled with this but its working :slight_smile:

As I have my own domain and a virtual private server
I’ve created my private dynamic DNS service. and a regular update brings my home IP into my public domain entry.
This way I can access OH from wherever I need it.

But it’s clear that this solution is not for everyone. As not everyone would like to spend the money and the time to operate such an environment for it.

I’m using a tomato-based router with free DNS service for WAN. You can use duckdns or no-ip. For example: myhome.duckdns.org. Paid options are available as well if you want to use your own TLD.

On the internal side, the router uses dnsmasq so all requests to myhome.duckdns.org get sent to the router. On the router, nginx runs as a transparent reverse proxy forwarding to all the services I have internally, including openhab.

Takes a bit of time to configure, but it’s effective, affordable, and worthwhile. The end result is you use one single domain to access everything in a clean, easy to remember manner. Reverse proxying isn’t required, but it’s icing on the cake since you can have addresses such as

myhome.duckdns.org/openhab
myhome.duckdns.org/blueiris
myhome.duckdns.org/mediaserver

1 Like

I have my own domain also, but using a Cisco router its an absolute NIGHTMARE. I use my own private OH2 cloud instance also.

I cannot reliability get the cisco router to act as a DNS server for my LAN. My apps fail to connect etc, spent hours on NGINX configuration and it works perfectly when away from the network but at home, its terrible.

Does anyone else use a Cisco router for DNS?

Right now, I can open OH2 on my LAN using the domain name but Android App and HabPanel both fail using my mobile. Go figure!

Dear Kris

In my LAN I do not use DNS at all. To complicated, is probably not right, but it is not really worth to do. from my perspective. I just use a push service (which actually runs on Synology DS) to update the IP address that my internet provider is giving > to my public DNS part which is in a different network.
In other words I access OH from remote as
SUBDOMAIN.DOMAIN.TLD:PORT

Within my LAN I just use IP address or in best cast /etc/hosts to align address to hostname.
So from local I access OH like
HOSTNAME:PORT

And within Android OH app I simply configure both one target for the local one for the remote.
That does what it needs to do.

Hi Stefan, this works but it fails when you need to use HabPanel viewer which only has 1 server

OK

In this case I would simply use the external address, as it is publicly available. :slight_smile:

I don’t use Habpanel. Just installed it right now (from remote) and accessed it after completion.

As the router uses NAT, you cant reach the public IP i’m afraid - not using Cisco anyway

Which type/model of Cisco router do you use?
I think that should work. But you need to configure some port forwarding. Without this my connection would also not work.

From the outside world. A typical home user is having exactly one IP address assigned via DHCP from the internet provider. The device that receives this IP is the gateway to your internal world. And this one device needs to know where to route the traffic to.

If your provider is AOL
You have one DHCP address (assume 152.163.1.67) from AOL assigned to your internet router (Cisco)
On the Cisco you configure that Port (lets say 10234) is forwarded to your local oh server (let’s say 192.1.2.100 port 8080)

Now you could access OH with your public IP address 152.163.1.67:10234

The next bit would be to give this a DNS name, which can only be done externally to your home network.

Maybe just have your Cisco or other internal device be your primary DNS resolver, when you DHCP to your local wifi. Then have your local DNS resolver answer the public DNS of your setup as the local IP instead

I’ve moved this to a more appropriate category. The Development category is intended for discussion about OH development.

1 Like

Cisco IOS is not really intended to do DNS services, but from my experiences you can point to name servers (aka DNS servers). https://www.cisco.com/c/en/us/support/docs/ip/domain-name-system-dns/24182-reversedns.html - And looks like that has changed since I dealt with IOS, looks like you can setup IP to DNS name mappings on devices now, unsure what version of IOS this was introduced or hardware.

If you want/need a local system to run DNS services you can load up Pi-hole and put static entries there (along with various block lists); then all you need to do is update your DHCP services to hand out the IP of the pi-hole system. Or some other DNS server solution of choice.

The wider adoption of ipv6 might simplify things. Right now ipv4 address space has run out, thats the main problem.
Until then, some addon, could be commercial, can provide a simplified and common way to deal with issue.

But isn’t openhab cloud or similar instance providing tunneling to home OH instance over ipv4 right now? Or is it too slow?

Ive managed to get it working using Cisco IOS DNS Split view, but I find IOS very flaky for DNS. I shall see. Using static host entries, hopefully this fixes the issue.

Most routers support hairpinning by default, if this is the case you only need the external IP.
If not you might have to configure this you’re self, I had to do this in my case.

But for different reasons, I myself use a split dns setup.
So when I’m at home it uses a local IP and when I’m not at home it uses the external IP.

I hope this helps you deciding what’s best for you.

Edwin

Hi Edwin yes I’m doing the same thing. Are you using a cisco router? Hair pin Nat is rubbish on cisco. My old cheap $100 adsl modem did it perfectly . Now i just use host entries on the cisco and dns view and it works.

Hi,

I’m using a Mikrotik router, cheap and powerful.
I have less knowledge of Cisco so don’t know what the exact solution is.

In my case I had to make sure to get the correct source IP and not using the interface as source otherwise the port- forwards didn’t work.
To reach this I need an extra Nat masquerade rule applied on source of the local subnet to the local destination.
If I didn’t do this the routing would be wrong because you are referring to your own device the source interface isn’t your wan interface but suddenly the lan interface.
So you can’t route traffic based on a port but need the IP addresses.

In Cisco you use often a masquerade to the dialer but traffic isn’t coming from the dialer in this case, I think.

I hope I explained this right and think this is the same problem in the Cisco.