My DHCP server configures Gateway incorrectly and DNS does not forward queries

I needed to make some changes in my openWRT router, and reconfigure it.

IAfter doing it I have a problem: it is the DHCP server of the lan network, I have configured it as DNS server too, but it is not the gateway, the gateway is another router.

So I configured it with an ip the DHCP server to serve IPs from IP net, net mask and gateway (the other router).
It is the only DHCP server in the net, the other router has no DHCP server.

But when a client gets a lease, it configures as the gateway and not
DNS is correctly configured as
I have checked that the lease was served by the DHC server (

Here is the configuration of the lan interface:

Obviously other setting is overriding the gateway, by I cannot find it, never happened this to me.

The DNS does not work either, it responds but do not forward DNS queries (when I use nslookup and make a local query it works, but when I try to resolve an external domain like it answers query refused).

This is the config, is configured as the DNS server in DHCP, as I want to resolve first local queries for domain .home.
So in lan interface adapt oprtions I did not add any DNS.

And in DHCP and DNS config (I am using default dnsMasq as dhcp and dns server):

I cannot find what is wrong either.
Thank you for your help, I've been trying to solve it all the day.
router = gateway.


Thank for the answer.
I have already read the documentation, but it did not help me, because I cannot find what is wrong in my config.
Besides it does not describe the LUCI interface options, only the config files that are quite obscure for me.

I meant the gateway is the device directly connected to the internet where all forwarded packets with no local destination should be sent. I this case is propoerly a gateway as it connects two differente medium, ethernet and fiber.
It has router capabilities too, but is only use for internet connection (well and as access point).

The router does internal net packets distribution (for now there is only one lan, but I am going to create another one soon for iot devices).
Mainly it is the DHCP and DNS server but traffic to internet should be directed to the other device (what I was calling the gateway).

That was what I meant with "router" and "gateway".

It has been working for many time, but I had a problem with the router and had to reset.
Now I have forgotten something that I cannot find, and the DHCP clients are configured with the DHCP server as gateway, instead of the gateway I have put in the interface.

So in the lan interface of the DHCP server I have put the IP of the other device (gateway, as ipV4 gateway.

I cannot find any other place in the DHCP Luci config interface where you can put the gateway/router to serve to the DHCP clients.

In the DNS section I have configured two well known external DNS servers that I have tested are reacheable from the router and from the internal lan. But it does not seem to forward the requests.
Obviously, some parameter is missing.

This is the response I get using nslookup from a PC connected to the lan:

Servidor predeterminado:

Servidor:  []

Addresses:  fdf3:d760:bc14::1


*** no encuentra Query refused
> server
Servidor predeterminado:  []

Servidor:  []

Respuesta no autoritativa:

> quit

As can be seen, it answers internal .casa domain queries, but does not seem to forwared queries for other domains using the configured dns forwareders.
That dns forwareders are accesible from the net, as can be seen using the server command to stablish one of them as dns query and making a query.

I think you need to pass an option through with DHCP. Option 3 is a change for the default gateway for DHCP and there is a place in the DHCP server on LuCi to put that in.

It is not visible if you have configured the upstream dns servers. Network/Interfaces/Edit LAN/ Advanced Settings tab -> Use custom DNS servers
Then go to DHCP Sever tab, Advanced Settings subtab, in DHCP-Options add 3,
Save and apply changes.

1 Like

Thank you both and specially @trendy. It seems that the problem is mostly solved.
Option 3 has solved the DHCP issue, now client DHCP gets the correct gateway.

I have used the same dns servers in the interface config page and the dns server forwarders config (I don't understand why you have to put them twice, may be you don't need to put them as forwarders?)

Now it works, nslookup works from the connected PCs to th lan.

But it seems there remains a slight problem

If I connect to the router using ssh and make a nslookup query from ther, it responds with the correct IPs, but allways ends with error messages.
It seems that after querying the dns forwarders it makes other query that fails, as there remained some other dns that is not working.

Let me put an example . This is the query run in the router connecting through ssh:

root@routerSalon:/etc# nslookup

Address 1:
*** Can't find No answer

root@routerSalon:/etc# nslookup

Address 1:
Address 2:
Address 3:
Address 4:
Address 5:
*** Can't find No answer

It does not happen in all domains.

The DNS forwardings configuration you have is wrong, delete them. Keep only the custom DNS servers entries in LAN interface.

It is the non existing AAAA IPv6 record. Nothing wrong there.

1 Like

Thank a lot, it seems I had misunderstood that dns forwareder were.

I will delete them, then.

Now it seems that openwrt activates IPv6 nameserver by default.
Until now I just ignored IPv6. But may be time I learn a bit about IPv6, as it is getting quite more common, and activated by default in MS windows too.

Some easy tutorial about IPv6 and how to configure openWRT to support it? At a basic level, as documentation in openWRT about it is too deep for me.

It is suppose to not have the problems with assigning IPs, just get a ramdon part of address for your entire internet (be higher part of the addresses) and then the dhcpv6 would give the devices the other part of the 128 bit address. But don't understand how routing or other tasks work.

IPv6 is by default enabled and will work with most common settings. If you are not sure about something, you can open a new topic here.


Thanks, for now I dont't really need IPv6, and as you say new installations of openWRT configured DHCPv6 automatically, it is strange to write nslookup and get the answer for such a large IPv6 address...

Just wanted to know how IPv6 works and the differences in routing and address assigments.
I read about it some years ago, but the info I found was quite obscure an complex.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.