DNSmasq: How to configure dns without dhcp?

I have two routers at home:
one the gateway from the ISP configure as IP 192.168.2.254
another with openwrt IP 192.168.2.253
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 (192.168.2.253) as the DNS server (and 192.168.2.254 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 (192.168.2.253) 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 192.168.2.254 as the gateway address in the configuration of the lan interface, leases to the hosts are given with 192.168.2.253 as the gateway.

It work, but it has two problems:
1.- all hosts in network will send its outgoing packages to 192.168.2.253 and the openwrt from there to 192.168.2.254, 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.

Yes.

  • 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 (192.168.2.253) 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 192.168.2.254 as the gateway, the hosts receive 192.168.2.253 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?

Go to LUCI > INTERFACE > EDIT > tick IGNORE INTERFACE

easy!

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.

https://openwrt.org/docs/guide-user/services/dns/bind

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 192.168.2.200, 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?
https://openwrt.org/docs/guide-user/services/dns/unbound

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 (192.168.2.254) which serves dhcp config with 192.168.2.254 as the gateway, primary dns server on 192.168.2.253 and secondary on 192.168.2.254.

In my openWRT (192.168.2.253) router I have configured static IP address (192.168.2.253) and 192.168.2.254 as gateway, with same dns servers (192.168.2.253,192.168.2.254).
I configures the DNS to forward unknown dns queries to 192.168.2.254, 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
myserver.mydomain.tld 192.168.2.201

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.