Overwrite dnsmasq.conf?

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions
Author Message
Floprott
DD-WRT Novice


Joined: 11 Aug 2018
Posts: 2

PostPosted: Sat Aug 11, 2018 17:18    Post subject: Overwrite dnsmasq.conf? Reply with quote
Hello!

First, I'm quite new to custom router firmware, so please don't blame me for not knowing how that works.

How can I overwrite the dnsmasq.conf? Everytime I click "apply settings" or reboot the router it will overwrite the /tmp/dnsmasq.conf (which is logical because it's in /tmp).

I know there is a "Additional DNSMasq Options" option under "Services", but it only appends the options instead of overwriting them. So I cannot change something which was already configured by the automatically created config.

My dd-wrt version: v3.0-r36527 std (08/09/1Cool
Device: TL-WR1043ND V2
Sponsor
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 4153
Location: Netherlands

PostPosted: Sat Aug 11, 2018 18:10    Post subject: Reply with quote
)ptions placed in additional config should precede the options already in the conf file (but I have never checked if it really does)

If it does not you can stop dnsmasq with:
Code:
stopservice dnsmasq


and start it with your own conf file:
Code:
dnsmasq --conf-file=/tmp/myown_dnsmasq.conf


If you have an usb stick you can of course place your own conf file there or you can just write your own at startup to /tmp. Below an example, place in Administratio/Commands and save as Startup:
Code:
cat << "EOF" > /tmp/myown_dnsmasq.conf
interface=br0,wl0.1
resolv-file=/tmp/resolv.dnsmasq
strict-order
domain=home
dhcp-leasefile=/tmp/dnsmasq.leases
dhcp-lease-max=101
dhcp-option=br0,3,192.168.1.1
dhcp-option=wl0.1,3,0.0.0.0
dhcp-authoritative
dhcp-range=br0,192.168.1.100,192.168.1.149,255.255.255.0,1440m
dhcp-range=wl0.1,0.0.0.100,0.0.0.149,0.0.0.0,1440m
dhcp-host=00:xx:yy:zz:aa:81,PCDownload,192.168.1.89,1440m
bogus-priv
stop-dns-rebind
EOF


I have not tested any of this but I am sure the more knowledgeable will correct me Smile

_________________
Routers:Netgear R7800, Netgear R6400v1, Netgear R6400v2, Linksys EA6900 (XvortexCFE), Linksys E2000 (converted WRT320N), WRT54GS v1.
Install guide Linksys EA6900: http://www.dd-wrt.com/phpBB2/viewtopic.php?t=291230
OpenVPN Policy Based Routing guide: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=321686
Install guide R6400v2:http://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
OpenVPN Server Setup:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=318795
Install guide R7800: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Floprott
DD-WRT Novice


Joined: 11 Aug 2018
Posts: 2

PostPosted: Sat Aug 11, 2018 18:28    Post subject: Reply with quote
@egc
Thanks for your answer. Many of the config parameters can be used multiple times, so they can't overwrite each other. :/

Shall I also put the "stopservice dnsmasq" and "dnsmasq --conf-file=..." command into Administration -> Commands?
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 4153
Location: Netherlands

PostPosted: Sun Aug 12, 2018 8:10    Post subject: Reply with quote
First test everything form the command line, otherwise you might lock yourself out when putting it in startup and it is not working and the only thing you could do then is reset.

Start with a shebang:
Code:
#!/bin/sh


Add commentary code with a:
Code:
#


After
Code:
stopservice dnsmasq
add
Code:
sleep 10
to wait 10 seconds until dnsmasq is really stopped (maybe 2 or 5 would also be sufficient, and more sophisticated would maybe something like: "while pidof dnsmasq; do sleep 2; done".
But writing shell scripts is not my daily bread and butter so not take my word for granted and test everything before adding to startup.

_________________
Routers:Netgear R7800, Netgear R6400v1, Netgear R6400v2, Linksys EA6900 (XvortexCFE), Linksys E2000 (converted WRT320N), WRT54GS v1.
Install guide Linksys EA6900: http://www.dd-wrt.com/phpBB2/viewtopic.php?t=291230
OpenVPN Policy Based Routing guide: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=321686
Install guide R6400v2:http://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
OpenVPN Server Setup:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=318795
Install guide R7800: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum