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.
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.
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.