What's new

dnsmasq.conf.add - if statement to examine "tag" value

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

Frank Herman

Occasional Visitor
It seems reasonable to think that you should be able to use the "tag" value within an "if" statement.

The "dnsmasq.conf.add" file below does not work, any ideas on what I am doing wrong??


dhcp-host=set:green,20:aa:30:bb:2E:cc,pc1,192.168.1.2,infinite
dhcp-host=set:red,00:aa:E8:bb:96:cc,pc2,192.168.1.3,infinite

IFI = $(tag)
if [ $IFI -eq "green" ]; then
address=/www.youtube.com/216.239.38.119
address=/m.youtube.com/216.239.38.119
address=/youtubei.googleapis.com/216.239.38.119
address=/youtube.googleapis.com/216.239.38.119
address=/www.youtube-nocookie.com/216.239.38.119
fi
 
The "dnsmasq.conf.add" file below does not work, any ideas on what I am doing wrong??
The "dnsmasq.conf" file is not a script, it is a parameter file for dnsmasq.

Also, your question is specific to Merlin's firmware ("dnsmasq.conf.add") so the "General Wireless Discussion" forum is probably the wrong place for it.
 
Last edited:
I was hoping to fix the issue where my (2) ad blocking assignments are being negated because of the DNS server assignment (dhcp-option) lines below.

Is there another way to bypass the "youtube restrictions" below, for only "pc1", without loosing the ad blocking assignments?


This is my dnsmasq.conf.add file;

# ignore unneccesary windows requests
filterwin2k

#========================
# AD BLOCKING
#========================
# ad block list from -> https://github.com/notracking/hosts-blocklists
conf-file=/jffs/configs/domains.txt
addn-hosts=/jffs/configs/hostnames.txt

#========================
# CONTENT FILTERING
#========================
# assign ip id's to mac id's

dhcp-host=set:green,20:aa:30:bb:2E:cc,pc1,192.168.1.2,infinite
dhcp-host=set:red,00:aa:E8:bb:96:cc,pc2,192.168.1.3,infinite

# set DNS server
dhcp-option=tag:green,option:dns-server,8.8.8.8,8.8.4.4
dhcp-option=tag:yellow,option:dns-server,208.67.222.222,208.67.220.220

# youtube set to -> restriced mode (.120) -> restriced-moderate mode (.119)
address=/www.youtube.com/216.239.38.119
address=/m.youtube.com/216.239.38.119
address=/youtubei.googleapis.com/216.239.38.119
address=/youtube.googleapis.com/216.239.38.119
address=/www.youtube-nocookie.com/216.239.38.119
 

Latest 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