What is the function of Forward/reverse DNS option

I noticed that some of my entries of /etc/config/dhcp have option dns '1' in them and it seem that the GUI checkbox for that is "Forward/reverse DNS" so I googled that term but did not find a good answer for what it does and why would I want it to be enabled. The wiki says that the default is disabled. Can someone answer what and why for me?

You're asking about normal DNS functionality.

  • Forward - resolve hostname to IP
  • Reverse - resolve IP to hostname

Can you show a screenshot of that?

I can't locate that on version 23.05.4.

Yes it is under luci/network/dhcp and dns/static leases then you click edit on one of the entries you defined and at the bottom of the window is the option checkbox

Maybe you don't see it because you have a smaller dnsmasq package. Mine has "dnsmasq-full" for some reason I needed it.

1 Like

I see it.

You didn't mention this was a setting under an individual static lease "entries".

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

The Wiki gives the same description.

I assume it means it will not assign DNS Servers to the device configured in the lease. That should allow you to Statically configure DNS servers on the host.

Have you tested it yet?

I went through and unchecked it for all my entries because it is unchecked by default. I restarted the router and connected devices have a DNS assigned by the router. I do not want to define DNS entries manually on the connected decives.

1 Like

I think it means the following:
If you do not have set a static lease then, if enabled, DNSMasq will add the hostname of the client (if the client provides one) to its DNS so that you can connect to the client by its hostname even if you did not set a static lease

The setting is found under an individual static entry. Can you clarify that?

Good point, maybe only MAC address will do?
Then DNSMasq will handout IP address and adds the clients name to the DNS so that you can do a lookup by its host name?

Behind the scenes, it just adds that entry to a hosts file that dnsmasq will read (/tmp/hosts/dhcp.cfg01411c), regardless if the IP is an actual lease reservation, static assignment on the client, etc.

3 Likes

I haven't had my morning coffee yet...

So what effect does that have on the network or host configured in the lease?

It creates (or doesn't create) a Forward and Reverse record for the host/IP in question?

When this option is off, DNSMASQ will not resolve the name for that device, unless it has requested an IP address using DHCP (for example, after a reboot).

When that option is on, DNSMASQ will always resolve the name for that device, wether or not it has requested an IP address using DHCP.

7 Likes

Exactly - I always enable this for my important services (NAS etc.) because I can then reboot the OpenWrt box and all services are reachable again via DNS.
That's necessary because the server, connected via a switch, does not see a link down event and has no reason to request a new IP.
Without this setting, it can take several hours until the NAS has requested a new IP.

I prefer this over a separate DNS entry.

4 Likes