Dnsmasq resolving for router name limit to one interface IP

Openwrt installed on device called, creatively enough, openwrt.

It is also a DNS server via DNSMasq.

It resolves its own name as each IP address on each internal interface, which is probably a decent default. So let's say I have /24's on 10.1.1.0, 10.1.2.0, 10.1.3.0 and 10.1.4.0, and it is .1 on each. When I resolve the router name it gives all four addresses. If I set the "localise" option it resolves to a single one but different based on which subnet I am using.

I want it to always give ou 10.1.1.1, none of the others.

I've tried putting it into the hostname tab; no change. Same with a hosts entry. I tried a few other possible options without change.

Is there a way to have the forward DNS name of the router resolve to only one of its interfaces?

@vgaetera, my apologies for the delay, I have been away quite a bit.

I tried the above, specifically I tried, one at a time:

root@OpenWRT:~# uci set dhcp.@domain[-1].name="OpenWRT"
root@OpenWRT:~# uci set dhcp.@domain[-1].ip="192.168.130.1"
root@OpenWRT:~# uci commit dhcp
root@OpenWRT:~# uci add_list dhcp.@dnsmasq[0].address="/OpenWRT/192.168.130.1"
root@OpenWRT:~# uci commit dhcp
root@OpenWRT:~# uci dnsmasq restart

In both cases I still get:

> OpenWRT
Server:  OpenWRT.redacted
Address:  redacted

Name:    OpenWRT.redacted
Addresses:  redacted-IPv6
          192.168.130.1
          192.168.134.1
          192.168.131.1
          192.168.132.1

Did I misunderstand what to enter? Note (lacking creativity) that "OpenWRT" is the system name of the router, and the four addresses represent four internal VLAN's and their respective addresses of the router on those VLAN's.

https://openwrt.org/docs/guide-user/base-system/dhcp

uci set dhcp.@dnsmasq[0].add_local_fqdn="0"
uci commit dhcp
service dnsmasq restart

Perfect.

And my apologies, I should have dug deeper into the pointers on the first document you sent, I would have found the complete list of options.

1 Like

It's nothing, I missed it as well, but found while debugging the init script.