DNS queries made across inconsistent interfaces on OH with multiple interfaces

  • Platform information:
    • Hardware: Intel/8Gb Ram
    • OS: Ubuntu 20.04.5 LTS
    • Java Runtime Environment: OpenJDK Runtime Environment Zulu11.60+19-CA (build 11.0.17+8-LTS)
    • openHAB version: openHAB 3.4.0.M6

I’ve a VM setup that has two NICs exposed to it, one for LAN and the other an IOT specific network. This all works fine and in the Settings/Network page of OH I have the LAN address selected at the Primary IP.

On my IOT network, I route all DNS queries via NextDNS so I can do some DNS management and I get lots of traffic from the OpenHAB server via this path which is not expected. How is OH determining which IP address to use for name resolution and why is this (at least sometimes) not the Primary IP/Network?

This is causing many more DNS requests to go to NextDNS that are subject to the DNS rules I have there which is intended for the other clients on that network, not OH itself.

I shouldn’t think this is any of openHAB’s business. Managed in Java, perhaps? Or better, by Docker? Keyword default gateway?

Answer here maybe

Thanks for the suggestion - but it’s in a VM not a container. So no Docker involved at all.

Okay, continue that thought … what controls how the real host resources, like networking, are presented to the virtualized application?

DNS is controlled at the operating system level. All OH is doing is asking the OS what’s the IP of the DNS server to use and using what gets returned. Or it might be that OH asks the OS and the OS makes the query on it’s behalf (I admit I don’t know DNS down to that level but it seems like this this would be the latter).

take a look here this is a good overview of how it works and how to specifically define a DNS server. Don’t let references to docker through you off. Docker also depends on the host OS for DNS lookups just like OpenHab does. :wink:

Many thanks @rossko57 @justaoldman @rlkoshak that helped me prod in the right direction.

I’ve updated the netplan.yml file for the nic to direct all DNS queries for that subnet back to the LAN DNS server. Obvious once you think about it. I was confused because I’d expect OpenHAB to select that LAN IP as origination for any requests but it seems that’s not the case.

Thanks again.