What's new

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!

The firmware regenerates /etc/dnsmasq.conf whenever dnsmasq restarts. Your opportunity to modify it comes from either 1) custom config files like /jffs/configs/dnsmasq.conf.add (which gets appended by the firmware)or 2) custom scripts in /jffs/scripts such as dnsmasq.postconf where you can be more creative. After you restart dnsmasq, you should see your custom changes reflected in /etc/dnsmasq.conf.
...."you should see your custom changes reflected in /etc/dnsmasq.conf" - is this in the GUI?
 
No, in the SSH session. Type
Code:
cat /etc/dnsmasq.conf
 
I keep reading..."Create configuration file for dnsmasq"

Does that mean the there is an actual file that is created that can be edited later?...if so, where is that configuration file located and how do i access it later?
Ok.. so I have entered the script into the ssh client.. it said "done"... I lost internet and had to reboot the router.... it doesn't seem to have worked since Bing's resitricted mode was not enabled.

echo “address=/www.bing.com/204.79.197.220” > /jffs/configs/dnsmasq.conf.add
service restart_dnsmasq

Actually, I don't have internet at all on that router... how can I undo what I did?
 
What is at the end of
Code:
cat /etc/dnsmasq.conf
 
Ok, it’s my bad advice then on the quote marks.

Run my commands again without the quote marks and check the file again.

Or run
Code:
rm /jffs/configs/dnsmasq.conf.add
service restart_dnsmasq
To undo everything
 
No, your second attempt overwrote the first one. All my sins are hidden now. :oops:
haha.. no worries.. luckily my modem also has wifi, so I had turn it on so I would be able to connect lol.

Thank you so much for that.... now... would you like the opportunity to "redeem" yourself? lol -
gonna through you a curve ball.....

In tomato, I use a script to force SafeSearch on all google's domains... the script is...

tlds="com ac ad ae com.af com.ag com.ai al am co.ao com.ar as at com.au az ba com.bd be bf bg com.bh bi bj com.bn com.bo com.br bs bt co.bw by com.bz ca com.kh cc cd cf cat cg ch ci co.ck cl cm cn www.g.cn com.co co.cr com.cu cv com.cy cz de dj dk dm com.do dz com.ec ee com.eg es com.et fi com.fj fm fr ga ge gf gg com.gh com.gi gl gm gp gr com.gt gy com.hk hn hr ht hu co.id ir iq ie co.il im co.in io is it je com.jm jo co.jp co.ke ki kg co.kr com.kw kz la com.lb com.lc li lk co.ls lt lu lv com.ly co.ma md me mg mk ml com.mm mn ms com.mt mu mv mw com.mx com.my co.mz com.na ne com.nf com.ng com.ni nl no com.np nr nu co.nz com.om com.pa com.pe com.ph com.pk pl com.pg pn com.pr ps pt com.py com.qa ro rs ru rw com.sa com.sb sc se com.sg sh si sk com.sl sn sm so st com.sv td tg co.th com.tj tk tl tm to tn com.tn com.tr tt com.tw co.tz com.ua co.ug co.uk us com.uy co.uz com.vc co.ve vg co.vi com.vn vu ws co.za co.zm co.zw"

mkdir -m 777 -p /tmp/etc/dnsmasq/hosts

{

for tld in $tlds

do

echo "216.239.38.120 www.google.$tld"

done

} > /tmp/etc/dnsmasq/hosts/safesearh.hosts

Can this script be used in Merlin via ssh as well?
 
haha.. no worries.. luckily my modem also has wifi, so I had turn it on so I would be able to connect lol.

Thank you so much for that.... now... would you like the opportunity to "redeem" yourself? lol -
gonna through you a curve ball.....

In tomato, I use a script to force SafeSearch on all google's domains... the script is...

tlds="com ac ad ae com.af com.ag com.ai al am co.ao com.ar as at com.au az ba com.bd be bf bg com.bh bi bj com.bn com.bo com.br bs bt co.bw by com.bz ca com.kh cc cd cf cat cg ch ci co.ck cl cm cn www.g.cn com.co co.cr com.cu cv com.cy cz de dj dk dm com.do dz com.ec ee com.eg es com.et fi com.fj fm fr ga ge gf gg com.gh com.gi gl gm gp gr com.gt gy com.hk hn hr ht hu co.id ir iq ie co.il im co.in io is it je com.jm jo co.jp co.ke ki kg co.kr com.kw kz la com.lb com.lc li lk co.ls lt lu lv com.ly co.ma md me mg mk ml com.mm mn ms com.mt mu mv mw com.mx com.my co.mz com.na ne com.nf com.ng com.ni nl no com.np nr nu co.nz com.om com.pa com.pe com.ph com.pk pl com.pg pn com.pr ps pt com.py com.qa ro rs ru rw com.sa com.sb sc se com.sg sh si sk com.sl sn sm so st com.sv td tg co.th com.tj tk tl tm to tn com.tn com.tr tt com.tw co.tz com.ua co.ug co.uk us com.uy co.uz com.vc co.ve vg co.vi com.vn vu ws co.za co.zm co.zw"

mkdir -m 777 -p /tmp/etc/dnsmasq/hosts

{

for tld in $tlds

do

echo "216.239.38.120 www.google.$tld"

done

} > /tmp/etc/dnsmasq/hosts/safesearh.hosts

Can this script be used in Merlin via ssh as well?
With a bit of modification. The path in the last line should be changed to /jffs/configs/hosts.add

You don’t need the mkdir line.

When done, restart dnsmasq again.
 
With a bit of modification. The path in the last line should be changed to /jffs/configs/hosts.add

You don’t need the mkdir line.

When done, restart dnsmasq again.
So it would look like this?

tlds="com ac ad ae com.af com.ag com.ai al am co.ao com.ar as at com.au az ba com.bd be bf bg com.bh bi bj com.bn com.bo com.br bs bt co.bw by com.bz ca com.kh cc cd cf cat cg ch ci co.ck cl cm cn www.g.cn com.co co.cr com.cu cv com.cy cz de dj dk dm com.do dz com.ec ee com.eg es com.et fi com.fj fm fr ga ge gf gg com.gh com.gi gl gm gp gr com.gt gy com.hk hn hr ht hu co.id ir iq ie co.il im co.in io is it je com.jm jo co.jp co.ke ki kg co.kr com.kw kz la com.lb com.lc li lk co.ls lt lu lv com.ly co.ma md me mg mk ml com.mm mn ms com.mt mu mv mw com.mx com.my co.mz com.na ne com.nf com.ng com.ni nl no com.np nr nu co.nz com.om com.pa com.pe com.ph com.pk pl com.pg pn com.pr ps pt com.py com.qa ro rs ru rw com.sa com.sb sc se com.sg sh si sk com.sl sn sm so st com.sv td tg co.th com.tj tk tl tm to tn com.tn com.tr tt com.tw co.tz com.ua co.ug co.uk us com.uy co.uz com.vc co.ve vg co.vi com.vn vu ws co.za co.zm co.zw"


{

for tld in $tlds

do

echo "216.239.38.120 www.google.$tld"

done

} > /jffs/configs/hosts.add
 
Yes. Although I have to think about why your quotes would work and not mine. Maybe it’s because my iPad converted to curly quotes while typing instead of straight quotes.

To get your script loaded, experiment with the nano editor in SSH. I assume learning vi is a bridge too far at this time.

Start your script file with
Code:
#!/bin/sh
before the tlds= line.
 
like this?
#!/bin/sh
tlds="com ac ad ae com.af com.ag com.ai al am co.ao com.ar as at com.au az ba com.bd be bf bg com.bh bi bj com.bn com.bo com.br bs bt co.bw by com.bz ca com.kh cc cd cf cat cg ch ci co.ck cl cm cn www.g.cn com.co co.cr com.cu cv com.cy cz de dj dk dm com.do dz com.ec ee com.eg es com.et fi com.fj fm fr ga ge gf gg com.gh com.gi gl gm gp gr com.gt gy com.hk hn hr ht hu co.id ir iq ie co.il im co.in io is it je com.jm jo co.jp co.ke ki kg co.kr com.kw kz la com.lb com.lc li lk co.ls lt lu lv com.ly co.ma md me mg mk ml com.mm mn ms com.mt mu mv mw com.mx com.my co.mz com.na ne com.nf com.ng com.ni nl no com.np nr nu co.nz com.om com.pa com.pe com.ph com.pk pl com.pg pn com.pr ps pt com.py com.qa ro rs ru rw com.sa com.sb sc se com.sg sh si sk com.sl sn sm so st com.sv td tg co.th com.tj tk tl tm to tn com.tn com.tr tt com.tw co.tz com.ua co.ug co.uk us com.uy co.uz com.vc co.ve vg co.vi com.vn vu ws co.za co.zm co.zw"

{

for tld in $tlds

do

echo "216.239.38.120 www.google.$tld"

done

} > /jffs/configs/hosts.add

service restart_dnsmasq

If it does not work or if I lose connectivity... I can just use

rm /jffs/configs/dnsmasq.conf.add
service restart_dnsmasq

to clear it or is that only for the dnsmasq?
 
like this?
#!/bin/sh
tlds="com ac ad ae com.af com.ag com.ai al am co.ao com.ar as at com.au az ba com.bd be bf bg com.bh bi bj com.bn com.bo com.br bs bt co.bw by com.bz ca com.kh cc cd cf cat cg ch ci co.ck cl cm cn www.g.cn com.co co.cr com.cu cv com.cy cz de dj dk dm com.do dz com.ec ee com.eg es com.et fi com.fj fm fr ga ge gf gg com.gh com.gi gl gm gp gr com.gt gy com.hk hn hr ht hu co.id ir iq ie co.il im co.in io is it je com.jm jo co.jp co.ke ki kg co.kr com.kw kz la com.lb com.lc li lk co.ls lt lu lv com.ly co.ma md me mg mk ml com.mm mn ms com.mt mu mv mw com.mx com.my co.mz com.na ne com.nf com.ng com.ni nl no com.np nr nu co.nz com.om com.pa com.pe com.ph com.pk pl com.pg pn com.pr ps pt com.py com.qa ro rs ru rw com.sa com.sb sc se com.sg sh si sk com.sl sn sm so st com.sv td tg co.th com.tj tk tl tm to tn com.tn com.tr tt com.tw co.tz com.ua co.ug co.uk us com.uy co.uz com.vc co.ve vg co.vi com.vn vu ws co.za co.zm co.zw"

{

for tld in $tlds

do

echo "216.239.38.120 www.google.$tld"

done

} > /jffs/configs/hosts.add

service restart_dnsmasq

If it does not work or if I lose connectivity... I can just use

rm /jffs/configs/dnsmasq.conf.add
service restart_dnsmasq

to clear it or is that only for the dnsmasq?
rm /jffs/configs/hosts.add

But before you restart dnsmasq, cat /jffs/configs/hosts.add to make sure it looks like a proper hosts file first. Only then restart dnsmasq, if it looks wrong rm it.
 
Dave... thank you so much for all your help and patience!
I know it must be frustrating at times to deal with complete noobs like me!

It's now looking like I will be keeping this firmware... just a couple of more settings I need help with and I think I'm good.
Thank, thank you!!
 
Dave... thank you so much for all your help and patience!
I know it must be frustrating at times to deal with complete noobs like me!

It's now looking like I will be keeping this firmware... just a couple of more settings I need help with and I think I'm good.
Thank, thank you!!
Glad to help. We were all in your shoes once. Now we pay it forward!
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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