DNSmasq: How to configure dns without dhcp?

I have two routers at home:
one the gateway from the ISP configure as IP
another with openwrt IP
The openwrt router is connecte throught the lan interface to the ISP gateway (no through WAN).

The gateway from the ISP does not let me configure DNS.
I need some dns entries in order to provide local access IPs to some hostnames in my TLD that are inside my home.

The DHCP is configure with the openwrt router ( as the DNS server (and as the sencodary dns server).

I would like the gateway from my ISP to continue providing the DHCP service (in order to continue having service and internet access when the other router is down).
But if I deactivate DHCP server in the router with openwrt ( I won't get DNS

Is there anyway to deactivate DHCP service in openwrt but still resolve DNS queries (does from hostnames introduced manually)?

I this is not possible, I will stablish the openwrt router as the DHCP server (as I have it now).

The problem is that although I have stablished as the gateway address in the configuration of the lan interface, leases to the hosts are given with as the gateway.

It work, but it has two problems:
1.- all hosts in network will send its outgoing packages to and the openwrt from there to, which is one more hop than neccesary, as the ISP gateway is the unique with direct access to internet.
2.- If the openwrt router is down no one has access to internet, as they try to send packets throw it.
But the net is still up and working throw the gateway, as it is functional.

Any way to make DHCP sends another IP address as the gateway and not its own IP address?

This is a little murky.

I'm surprised the your ISP router does not support changing DNS.

What router/ISP?

You should try disabling dnsmasq in openwrt.... then rebooting both routers..... have you called the ISP / looked at their docs / manuals?

You either have to work at understanding the abilities of your core router or redefine a solution because alot of what you say is down to the core router and not openwrt.

1 Like

You can't have 2 DHCP servers anyways.


  • since you can't use OpenWrt as the DHCP server (as you want the ISP router to still give you Internet if the OpenWrt does down); and
  • you want custom DNS servers not offered by the ISP router

One option is to to statically assign the DNS servers you desire on all clients.

You can use OpenWrt as the DHCP server, assign the DNSes via DHCP Option 6, and hand out the alternate gateway of your ISP's router. This will also work!

No. As I noted, you can hand out your other gateway in DHCP replies.

Not if you assign the ISP router as your gateway. BTW, a gateway assignment is DHCP Option 3.

1 Like

Let me try to clarify a bit the situation

Most of ISP providers, here in Spain, for home internet access, don't provide you more than basic access to the router.
And if you are not an enterprise you cannot hire products for enterprises (which are probably more expensive).

No, yo cannot change anything in the ISP router about DNS, you can just activate DHCP server or not, and configure the DNS, gateway etc.
That is why I am using DNS and DHCP in my other router (and to get access to wifi and provide more lan ports in the other side of the house).

As the ISP router is the only one that is imprescindible to have basic internet access, I would prefer to serve DHCP from it. So if the second router is down, I may get not access to some services and from some PCs, but others PCs, tablets, etc would have internet access yet.

I don't have two DHCP routers on at the same time, I have just one, the other one is configured as back up just in case (one with leases from 1-100 and the other 101-200).

Now I have configured the openwrt router ( as DHCP server and as primary DNS server (the other as secondary server).
It is configured in DHCP and every PC gets that DNS setting correctly.

THE PROBLEM is that even I configure as the gateway, the hosts receive as gateway.
You say you can change it in openWRT and stablish the correct gateway, how?
I cannot see it in the lucid interface.
You talk about an OPTION 3 and OPTION 6 DHCP parameters, but I cannot see them in the lucid interface (the ISP router has that options).

These are the interface settings of the openwrt router

And these the DHCP configuration

As I have said I would Prefer the ISP router to be the DHCP server.

But If I deactivate DHCP for the openwrt router (in order to not provide DHCP but provide DNS solving) the openWRT router does not solve any DNS queries, even if I have configured some hostname entries.

How may I get it to resolve DNS without providing DHCP?

Thank you.

still murky..... are you trying to say that;

-the routers upstream dns server is not changable?
-the routers dhcp scope DNS server entry is changable?



1 Like

Of course you cannot change DNS upstream in the ISP provider.

But there is no option about DNS in the user interface they provide you in the ISP router.
You can just activate dhcp, use proxy DNS (to solve local names of hosts with assigned leases), stablish the dhcp IP range, and the local domain name, not much more.
I need other things like creating some local IP entries for myser.mydoman.tld that openwrt does provide me.

You have not admin access to the router, just a cropeed down access, and no ssh access.
Beleive it or not, it is like this in many providers here, and even the ones that let you more advance access won't let you make DNS entries or change the firmware in the router.

These are the options:

1 Like

I have found this in documentation.


Is this the way to go to have just DNS installed with no DHCP?

Substitute dnsmasq for bind?

Would bound forward queries of hostnames in a zone configured in it to internet if it does not find them in its config?

I mean if I just declare a zone mydomain.tld with a hostname myserver.mydomain.tld pointing to, when it receives a query for otherserver.mydomain.tld that is not in its database will it forward the query to internet?

Or is unbound more suitable for that?

I don't know why when I checked "deactivate interface" first time it did not work.

But I have tried again, and now it works.

DHCP is activated in my ISP router ( which serves dhcp config with as the gateway, primary dns server on and secondary on

In my openWRT ( router I have configured static IP address ( and as gateway, with same dns servers (,
I configures the DNS to forward unknown dns queries to, and I have configured /lan/ as de local server and lan as domain.
It lets me configure even dhcp leases.

The ISP DHC server does not let you configure the name entry in the lease, so you cannot stablish the names centrally.

I have configured hostnames

And it seems it all works.

queries to server.lan are solved to the local ip address
queries to myserver.mydomain.tld are solved to local ip address to.

queries to otherserver.mydomain.tld (not registered locally) are forwared to internet and solved correctly to the corresponding IP.

So everything seems to work correctly.

1 Like

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