DNS Server Forwarding for *.mydomain.lan

Try to Consider a scenario where the OpenWRT IS the client.

To make it more plastic for you, let's imagine there is a port forward, across my OpenWRT Gateway, through HAPROXY, VLANS,... where a OpenWRT Device is listening on SSH, and is used somewhere deep down as a Jumphost to other networks. Domain-Name-System was invented for a reason.

is it only pointing to the main DNS, or does it contain device specific configuration, that should only be available to the device it's running on ?

i switched it back on, otherwise the whole DNS Lookup would have been broken.

As we search here a "split domain DNS functionality", to specify a different DNS Server for a different domain.

i'll do that.

That would be the "Hammer" to just change /etc/resolv.conf as i would do it on all other systems.

root@ap:~# cat /etc/resolv.conf
nameserver 192.168.100.1

Unfortunately, i'd like to forward a specific domain (*.mydomain.lan) to another DNS:53 Server. it seems the DNS-Server/dnsmasq is dropping .lan lookups and does not forward.
nslookup to localhost:127.0.0.1:53 and forward *.mydomain.lan to a different DNS Server.

As all hostnames/domains/etc/hosts are managed on the 192.168.100.1 System. Finally i'd like to move directly to /etc/hosts instead of domain in /etc/config/dhcp

config domain
	option name 'ap'
	option ip '192.168.100.2'

I expect there is a config which is done via UCI, /etc/config or Luci.

it should point to the main DNS. => /etc/resolve.conf is the solution.

then there's no point in having it running, sorry if it makes things more plastic to you.
and by putting the upstream DNS in resolv.conf you're bypassing it completely.

Thats probably the solution.

`/etc/dnsmasq.conf`:
server=/freenode.net/8.8.8.8
server=/freenode.net/8.8.4.4
2 Likes

now you're bypassing your main LAN DNS too ... but hey, whatever floats your boat.

@frollic

image

root@ap:~# cat /etc/config/dhcp  | grep server
	list server '/mydomain.lan/192.168.100.1'

For some reason, i think this is the setting.

local string (none) -S Look up DNS entries for this domain from /etc/hosts. This follows the same syntax as server entries, see the man page.

man page from dnsmasq explains the --server directive. https://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

-S, --local, --server=[/[]/[domain/]][[#]][@][@[#]]
Specify upstream servers directly. Setting this flag does not suppress reading of /etc/resolv.conf, use --no-resolv to do that. If one or more optional domains are given, that server is used only for those domains and they are queried only using the specified server. This is intended for private nameservers: if you have a nameserver on your network which deals with names of the form xxx.internal.thekelleys.org.uk at 192.168.1.1 then giving the flag --server=/internal.thekelleys.org.uk/192.168.1.1 will send all queries for internal machines to that nameserver, everything else will go to the servers in /etc/resolv.conf.

1 Like

Is there a particular reason you're so hellbent on running a DNS server on the AP? Why do you want name lookups to go to an internal server on the device and then be forwarded to the main DNS server, rather than just asking the main server directly (like all other clients)?

because of the non-answer in DNS Server Forwarding for *.mydomain.lan - #21 by cavebeat

`/etc/dnsmasq.conf`:
server=/freenode.net/8.8.8.8
server=/freenode.net/8.8.4.4

to

`/etc/dnsmasq.conf`:
server=/mydomain.lan/192.168.100.1

better?

that would be better, or just drop the whole thing and use resolv.conf.

Sometimes it's worth digging into a topic to understand it.

Thats already the directive to use. Unfortunately, i do not understand how to pass the "server" in front of the /mydomain.lan/192.168.100.1 to match the dnsmasq syntax.

Changing the DNS directly in resolve.conf is easy. in all full blown *nix systems that would have been my first idea.

But here we have a Luci option, with the setting already moved via UCI to /etc/config/dhcp and translated to dnsmasq service when it is started.

somehow, the /etc/config/dhcp list server directive does not allow the --server directive to match the full syntax.

So why is there this option, if it's not working?

it's an option i expect to use.

Still it bugs me, there is a "list server" option in /etc/config/dhcp but it's not working as expected.
The Syntax as described in the man page from dnsmasq does not work. The dnsmasq does not restart.

Well I suppose that's kind of an answer.... Anyway, I'm done here. You're clearly fixated on making this far more difficult than it needs to be. I'll leave this to those with more patience.

nope, the /etc/resolve.conf is for me the way to go.

Actually it was you which provided the/an answer. Thank you for that.

The question has now changed. Why does "list server" does not work as expected.

Anyhow, that's a Community Driven Project.
Understand it, fix it, build it, test it, create a pull request to master so it will be fixed in the future. <= thats my approach.

If it's an implemented option which never worked, get rid of it. Remove it from Master.

1 Like

DNS Server Forwarding for *.mydomain.lan - #6 by frollic, but you're welcome anyway :wink:

1 Like

hmm, doesnt survive reboot or restart of dnsmasq...

so actually, it's not a solution. :melting_face:

echo "nameserver 192.168.100.1" >> /etc/resolv.conf in /etc/init.d/rc.local.

agian, your AP probably doesn't need this.

you're welcome, again.

1 Like