What's new

dnsmasq config overwritten

  • 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!

TheGrave

Occasional Visitor
I'm having hard times forcing the router to stop advertising itself as a DNS server. I edited the /etc/dnsmasq.conf file which by default reads:

dhcp-option=lan,6,x.x.x.x,0.0.0.0

Replacing 0.0.0.0 with another IP or removing it doesn't help as this file is overwritten on reboot (probably by NVRAM settings). The chattr utility is not available so there is no simple way to prevent this. Are you aware of any other trick that might do the job? I'm running a RT-AC66R box on 3.0.0.4.374.39.
 
I'm having hard times forcing the router to stop advertising itself as a DNS server. I edited the /etc/dnsmasq.conf file which by default reads:

dhcp-option=lan,6,x.x.x.x,0.0.0.0

Replacing 0.0.0.0 with another IP or removing it doesn't help as this file is overwritten on reboot (probably by NVRAM settings). The chattr utility is not available so there is no simple way to prevent this. Are you aware of any other trick that might do the job? I'm running a RT-AC66R box on 3.0.0.4.374.39.

RTFM?

dnsmasq.postconf

https://github.com/RMerl/asuswrt-merlin/wiki/Custom-config-files

Regards,
 
The chattr utility is not available so there is no simple way to prevent this.

This wouldn't have helped (and chmod is available as far as I know), all editable files on the router are stored on a RAM-disk. The disk thus gets wiped each time you reboot and the files are recreated during boot from data in NVRAM.

This is a very important thing to understand when you are trying to reconfigure things on the router: No editable files except those stored in /jffs or any USB drive will be retained during reboot.

The root drive is all read-only, but it has a bunch of symlinks to files and directories in /tmp, and a RAM-disk is mounted as /tmp during boot.

This is the output of "ls -l /" on my router, note that even though the attributes say RW they are NOT writable.

Code:
drwxr-xr-x    2 admin    root           524 Oct 23  2012 bin
drwxr-xr-x   15 admin    root             0 Nov 29  2012 cifs1
drwxr-xr-x    2 admin    root             3 Oct 23  2012 cifs2
drwxrwxrwt    4 admin    root          1780 Jan  1  2011 dev
lrwxrwxrwx    1 admin    root             7 Oct 23  2012 etc -> tmp/etc
lrwxrwxrwx    1 admin    root             8 Oct 23  2012 home -> tmp/home
drwxr-xr-x    6 admin    root             0 Jan  1  1970 jffs
drwxr-xr-x    3 admin    root           345 Oct 23  2012 lib
drwxr-xr-x    2 admin    root             3 Oct 23  2012 mmc
lrwxrwxrwx    1 admin    root             7 Oct 23  2012 mnt -> tmp/mnt
lrwxrwxrwx    1 admin    root             7 Oct 23  2012 opt -> tmp/opt
dr-xr-xr-x   66 admin    root             0 Jan  1  2000 proc
drwxr-xr-x    6 admin    root           538 Oct 23  2012 rom
lrwxrwxrwx    1 admin    root            13 Oct 23  2012 root -> tmp/home/root
drwxr-xr-x    2 admin    root          1694 Oct 23  2012 sbin
drwxr-xr-x   10 admin    root             0 Jan  1  2000 sys
drwxrwxrwx    9 admin    root           620 Feb 14 14:55 tmp
drwxr-xr-x    9 admin    root            98 Oct 23  2012 usr
lrwxrwxrwx    1 admin    root             7 Oct 23  2012 var -> tmp/var
drwxr-xr-x    9 admin    root          4286 Oct 23  2012 www

Some of these directories are writable, but only because they are mountpoints:

Code:
proc on /proc type proc (rw)
tmpfs on /tmp type tmpfs (rw)
devfs on /dev type tmpfs (rw,noatime)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw)
/dev/mtdblock5 on /jffs type jffs2 (rw,noatime)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /tmp/mnt/optware type ext2 (rw,nodev,noatime)
 
Last edited:
Is this an additional command, or are you trying to change a default one that is in there?

I wonder if you can create it in /jffs/configs/dnsmasq.conf.add - but as per another thread I saw if you include something in the .add that is already in the main .conf, it might conflict (and most likely the .conf one will get used first).
 
Is this an additional command, or are you trying to change a default one that is in there?

I wonder if you can create it in /jffs/configs/dnsmasq.conf.add - but as per another thread I saw if you include something in the .add that is already in the main .conf, it might conflict (and most likely the .conf one will get used first).

The new postconf mechanism is the way to go for changing any existing config entry.

https://github.com/RMerl/asuswrt-merlin/wiki/Custom-config-files#wiki-postconf-scripts
 
This wouldn't have helped (and chmod is available as far as I know), all editable files on the router are stored on a RAM-disk. The disk thus gets wiped each time you reboot and the files are recreated during boot from data in NVRAM.

This is a very important thing to understand when you are trying to reconfigure things on the router: No editable files except those stored in /jffs or any USB drive will be retained during reboot.

The root drive is all read-only, but it has a bunch of symlinks to files and directories in /tmp, and a RAM-disk is mounted as /tmp during boot.

Very important to know, thanks very much. I'm still a newbie at this firmware and I was treating everything as a standard Linux firmware. I'd rather replace whole config files instead of modifying several parameters and wondering how the end config looks like. Much cleaner way to work in my opinion.
 
It took me a while too to learn how things worked, understanding how "bind mounts" works etc.

And without Merlins customization fixes things would be a lot harder! :)
 

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