What's new

Struggling with dnsmasq

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

NogNeetMachinaal

Occasional Visitor
I'm struggling with dnsmasq and a custom config.

What I'm trying to accomplish:
Porting a working dnsmasq install/config from Ubuntu to Merlin.
On Ubuntu there are 3 config files: dnsmasq.conf, static-hosts.conf and static-dhcp-hosts.conf (attached in zip).
The file static-hosts contains a series of hosts with fixed IP-adresses.
The file static-dhcp-hosts contains a series of hosts, their MAC-address and designated IP-adresses.

What is done on Merlin (running on RT-AC68U with 384.18):
  • Formatted and activated JFFS
  • Created a folder /jffs/configs/dnsmasq.d
  • Copied the 3 conf files to this folder.
  • Reboot
Doing a nslookup with a host in static-hosts.conf returns: nslookup: can't resolve 'as-1.itv.lan'.
Doing a nslookup with 192.168.139.1 (the LAN-IP of the router) returns rtr.itv.lan => correct

Commands:
nslookup as-1.itv.lan 192.168.139.1
nslookup 192.168.139.1 192.168.139.1

Please note that at this time, the router is not connected to the Internet.

Reference: https://github.com/RMerl/asuswrt-merlin.ng/wiki/Custom-domains-with-dnsmasq

Any suggestions?

Cheers - Will

dnsmasq-configs.zip
 
It looks like someone added incorrect information to that wiki page. All config files should go in /jffs/configs.

https://github.com/RMerl/asuswrt-merlin.ng/wiki/Custom-config-files
The zip has a dnsmasq.conf that could go in /jffs/configs directly, but the same conf file points to /jffs/configs/dnsmasq.conf.d as a conf-dir for the remaining files.

But I’m dubious that the dnsmasq.conf would work properly as a full replacement of the built in dnsmasq.conf.
 
The zip has a dnsmasq.conf that could go in /jffs/configs directly, but the same conf file points to /jffs/configs/dnsmasq.conf.d as a conf-dir for the remaining files.

But I’m dubious that the dnsmasq.conf would work properly as a full replacement of the built in dnsmasq.conf.
Agreed. You can't just drop a set of Ubuntu config files into Asuswrt and expect it to work.
 
The only thing I'll add is - the router was not built with you taking control over the config files of the components such as dnsmasq.

Take note of the warning: Note that replacing a config file with your own implies that you properly fill in all the fields usually dynamically created by the firmware. Since some of these entries require dynamic parameters, you might be better using the postconf scripts

And that I too struggle with DNS on this router. It seems disproportionately difficult to simply have a custom local DNS zone eg mylocal.lan and make static entries against it. If you do this in DHCP, then the corresponding DNS entry does not get passed to the resolver *unless* the client has picked up the IP and kept it current via DHCP. Not my desired behaviour personally.
 
Thanks everybody for the feedback.

I have changed things to the extend that:
- the dnsmasq.conf is renamed to dnsmasq.conf.add
- in it, any entries pointing the previous folders and/or interfaces are either renamed or removed
- the conf-files starting with static are now in /jffs/configs as well
- the folder dnsmasq.d is deleted

Meaning all config-files are now in /jffs/configs.

According to the file /tmp/syslog.log it is still not working:
- dnsmasq-error "repeated keyword" referring to line 630 of /etc/dnsmasq.conf
- dnsmasq failed to start

The file /etc/dnsmasq.conf shows the entries of dnsmasq.conf.add.
Line 630 is the entry the overrides/increases the cache-size-parameter.

However, even if I would remove that line and do a reboot, the error pops-up pointing to the same line. In fact, even if the file /etc/dnsmasq.conf is only 45 lines, the error message refers to line 630.

Which makes me wondering - how is it supposed to work?
As in: what would it take to override and/or add dnsmasq parameters?

Please note that I only made changes to dnsmasq.conf.add - nowhere else.
 
Last edited:
I'm struggling with dnsmasq and a custom config.

What I'm trying to accomplish:
Porting a working dnsmasq install/config from Ubuntu to Merlin.
On Ubuntu there are 3 config files: dnsmasq.conf, static-hosts.conf and static-dhcp-hosts.conf (attached in zip).
The file static-hosts contains a series of hosts with fixed IP-adresses.
The file static-dhcp-hosts contains a series of hosts, their MAC-address and designated IP-adresses.

What is done on Merlin (running on RT-AC68U with 384.18):
  • Formatted and activated JFFS
  • Created a folder /jffs/configs/dnsmasq.d
  • Copied the 3 conf files to this folder.
  • Reboot
Doing a nslookup with a host in static-hosts.conf returns: nslookup: can't resolve 'as-1.itv.lan'.
Doing a nslookup with 192.168.139.1 (the LAN-IP of the router) returns rtr.itv.lan => correct

Commands:
nslookup as-1.itv.lan 192.168.139.1
nslookup 192.168.139.1 192.168.139.1

Please note that at this time, the router is not connected to the Internet.

Reference: https://github.com/RMerl/asuswrt-merlin.ng/wiki/Custom-domains-with-dnsmasq

Any suggestions?

Cheers - Will

dnsmasq-configs.zip

As others have said, your dnsmasq.conf file from Ubuntu will likely not work on your Router. At the very least, the interface name that dnsmasq is listening on won't be the same.

If all you want to do is to add additional statically assigned DHCP address to dnsmasq, then create file file "/jffs/configs/dnsmasq.conf.add" and place the following line in it;

Code:
# File /jffs/configs/dnsmasq.conf.add
# This file gets appended to the dynamically created
#/etc/dnsmasq.conf file that the router creates when
# dnsmasq is started

addn-hosts=/jffs/configs/dnsmasq.d/static-dhcp-hosts.conf

Then put your static-dhcp-hosts.conf file where you are suggesting. My self, I like to keep the "/jffs/configs" directory for its intended purpose, so if it were me, I would have put my ststic-hosts.conf file in /jffs.
I'm struggling with dnsmasq and a custom config.

What I'm trying to accomplish:
Porting a working dnsmasq install/config from Ubuntu to Merlin.
On Ubuntu there are 3 config files: dnsmasq.conf, static-hosts.conf and static-dhcp-hosts.conf (attached in zip).
The file static-hosts contains a series of hosts with fixed IP-adresses.
The file static-dhcp-hosts contains a series of hosts, their MAC-address and designated IP-adresses.

What is done on Merlin (running on RT-AC68U with 384.18):
  • Formatted and activated JFFS
  • Created a folder /jffs/configs/dnsmasq.d
  • Copied the 3 conf files to this folder.
  • Reboot
Doing a nslookup with a host in static-hosts.conf returns: nslookup: can't resolve 'as-1.itv.lan'.
Doing a nslookup with 192.168.139.1 (the LAN-IP of the router) returns rtr.itv.lan => correct

Commands:
nslookup as-1.itv.lan 192.168.139.1
nslookup 192.168.139.1 192.168.139.1

Please note that at this time, the router is not connected to the Internet.

Reference: https://github.com/RMerl/asuswrt-merlin.ng/wiki/Custom-domains-with-dnsmasq

Any suggestions?

Cheers - Will

dnsmasq-configs.zip

OK, so I have been trying to build a post to explain what you need to do to add your static-dhcp-hosts file to the existing /etc/dnsmasq.conf file on the router, which is dynamically created. However, snbforums keeps popping up a message that says I am blocked due to wording I am using.

So, all I can say is that you need to create the file "/jffs/configs/dnsmasq.conf.add" and "/jffs/configs/hosts.add" and place the appropriate information there (hint - you only need one line in dnsmasq.conf.add wish I could say more, but this site won't let me).

Wish I could be more detailed, but for the life of me, I don't know what snbforums is not liking about my instructions that I am writing out.
 
Wish I could be more detailed, but for the life of me, I don't know what snbforums is not liking about my instructions that I am writing out.
If you are using etc and hosts together, it will block that unless you add a space in between.
 
If you are using etc and hosts together, it will block that unless you add a space in between.

Thanks @dave14305 - that indeed is what was doing - you knew where I was going with this.

Thanks
 
@NogNeetMachinaal ,

I will try this another way,

If all you want to do is add the ststic-dhcp-hosts.conf to dnsmasq.conf, create the file "/jffs/configs/dnsmasq.conf.add" and add the following;

Code:
addn-hosts=/jffs/configs/dnsmasq.d/static-dhcp-hosts.conf

Then put your static-dhcp-hosts.conf file where you suggest. Personally, I would have put the static-dhcp-hosts.conf in "/jffs" as I like to keep "/jffs/configs" only for the purpose it was intended for.

Check too the syntax of your entries in static-dhcp-hosts.conf as they don't look right to me. The manual page for dnsmasq is online.
 
For your static-hosts.conf contents, put that content in /jffs/configs/hosts.add.

The router will add the contents to the routers internal hosts file (That which must not be named/hosts).

Cheers
 
Got things working now.

In the end, the content of the log put me in the wrong direction.
One reason was because of the timestamps => the router wasn't sync-ed with ntp.
The other was the content of /tmp: as opposed to Ubuntu, it looks as if this folder is not cleared on a warm boot; only on a powercycle.

The endresult (see also further below):
- dnsmasq.postconf overwriting Merlin-dnsmasq defaults
- dnsmasq.conf.add for adding dnsmasq parameters
- adjusted the Ubuntu settings referencing both the "static"-files

Which pretty much boiles down to what was explained here:
https://github.com/RMerl/asuswrt-merlin.ng/wiki/Custom-config-files

Thanks everybody for the help and patience.

=====

Added:
- stop-dns-rebind
- dns-loop-detect
- dns-forward-max=300
- addn-hosts=/jffs/configs/dnsmasq/static-hosts.conf
- dhcp-hostsfile=/jffs/configs/dnsmasq/static-dhcp-hosts.conf
- add-cpe-id

Replaced:
- cache-size

Removed:
- the listen-entries
- bind-interfaces
- conf-dir=/etc/dnsmasq.d,*.conf

=====
 
Got things working now.

In the end, the content of the log put me in the wrong direction.
One reason was because of the timestamps => the router wasn't sync-ed with ntp.
The other was the content of /tmp: as opposed to Ubuntu, it looks as if this folder is not cleared on a warm boot; only on a powercycle.

The endresult (see also further below):
- dnsmasq.postconf overwriting Merlin-dnsmasq defaults
- dnsmasq.conf.add for adding dnsmasq parameters
- adjusted the Ubuntu settings referencing both the "static"-files

Which pretty much boiles down to what was explained here:
https://github.com/RMerl/asuswrt-merlin.ng/wiki/Custom-config-files

Thanks everybody for the help and patience.

=====

Added:
- stop-dns-rebind
- dns-loop-detect
- dns-forward-max=300
- addn-hosts=/jffs/configs/dnsmasq/static-hosts.conf
- dhcp-hostsfile=/jffs/configs/dnsmasq/static-dhcp-hosts.conf
- add-cpe-id

Replaced:
- cache-size

Removed:
- the listen-entries
- bind-interfaces
- conf-dir=/etc/dnsmasq.d,*.conf

=====
Where did you locate that zip file that appears to be hosted on Merlin's GitHub?
https://github.com/RMerl/asuswrt-merlin.ng/files/4873507/dnsmasq-configs.zip
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top