Use DNS to force youtube into restricted mode - and Pi-Hole

#31

That looks nice and I have not tested it and was browsing through the code and you could replace: silently service pihole-FTL restart by pihole restartdns reload so you don’t have to use service/systemctl.

This replacement will do the same, but then done by Pi-hole itself.

There is a safesearch version of duckduck.go: https://duck.co/help/features/safe-search

Something like this?

duckduckgoSS=(
    cname=duckduckgo.com,safe.duckduckgo.com
    cname=www.duckduckgo.com,safe.duckduckgo.com
    cname=duck.com,safe.duckduckgo.com
    cname=www.duck.com,safe.duckduckgo.com
)
1 Like

#32

Thanks for the feedback, @msatter! I will work to implement this into the next version within an hour or so. I am not 100% sure if DuckDuckGo can be forced into SafeSearch all the time, but for now we will just add it to the CNAME’s in “/etc/dnsmasq.d/05-restrict.conf” and safe.duckduckgo.com will be added to the hosts file, per your request. You are more than welcome to collaborate with me on this on GitHub as well.

0 Likes

#33

I think your idea works!
And when I try to turn safesearch off, it stays on! DuckDuckGo must have recently added this functionality as it did not work earlier this year (May/June)

0 Likes

#34

I tried it myself and I don’t see it using safe.duckduckgo.com and when I am searching, it searches not safe.

I tried above the earlier cname implementation but never got a working solution like you in May/June.

If it is working for the other search engines then it is great then leave the duckduckgo exclusion enforced.

0 Likes

#35

You will never see it using forcesafesearch.google.com or safe.duckduckgo.com in the web browser, DNS does that behind the scenes. That is because it is a CNAME record. I may have mislead you, I attempted to to it in May/June but it did not work. Now it does work. This has been an open feature request with duckduckgo for some time now.

As you can see below, it is working for me:
image

How do the last lines of /etc/dnsmasq.d/05-restrict.conf and /etc/hosts look?

I have tried this with two pi-holes and I can confirm it is working. Is your devices’ DNS cache cleared and is it using Pi-hole as it’s ONLY dns server? This would cause conflict.

Try my main Public Pi-hole at 35.188.83.81, and only use 35.239.60.156 if that does not respond… They should have Safesearch enabled…

0 Likes

#36

My bad. I didn’t implement the entries in the host file so I had only a half of the needed implementation.

I will have a new go at it.

1 Like

#37

It works great and I have found a way to not have to edit the /etc/hosts file and compact the lines even more:

host-record=safe.duckduckgo.com,50.16.250.179
cname=duckduckgo.com,www.duckduckgo.com,safe.duckduckgo.com
cname=duck.com,www.duck.com,safe.duckduckgo.com

So you only have to edit the 05-restrict.conf file to make CNAME working for safesearch.

Also the regex part could be more efficient if those are TLD.

REGEX=(
    "\.xxx$"
    "\.sexy$"
    "\.webcam$"
    "\.sex$"
    "\.porn$"
    "\.tube$"
    "\.cam$"
    "\.adult$"

They are anchored at the end with “$” so that makes it more easy.

2 Likes

#38

Thanks for checking it out! I will work on that tomorrow… So can you really eliminate the hosts entries now? How about google since there are 300+ domains…

0 Likes

#39

I did only test the duckduckgo part and if it works there then it should also work on other domains you want to CNAME.

I did not see a long list +300 of Google domains. In regex I have the following lines for Google:

### Google ####################################################################
(cast|mtalk|nosslsearch|safebrowsing|x)\.google(apis)?\.[a-z]{2,7}$
googlepages.?\.[a-z]{2,7}$
(visualwebsiteoptimizer|spiffymachine)\.[a-z]{2,7}$
1e1[0-9]{2,2}\.[a-z]{2,7}$
google-{0,}(analytic|syndication|(ad|tag)[a-z0-9]*-?(service|manager))[s]?\.[a-z]{2,7}$
double-{0,1}clic(k|k[\.]?by-{0,1}google)\.[a-z]{2,7}$
(google|partner|pub)-{0,}ads{0,}-{0,}(apis{0,})\.[a-z]{2,7}$ 

\.[a-z]{2,7}$ matches any TLD between between 2 and 7 characters long.

1 Like

#40

And where would this be added?

0 Likes

#41

This goes in the /etc/pihole/regex.list file.

If you have for me the +300 Google list then I can check it against this regex filter.

I got also one for Facebook complete blocker, because that is spying as bad as Google does. The Google regex only blocks spying stuff and I am going far in that.

0 Likes

#42

Use this: http://35.188.83.81/UniPi.php?q=ss
Do you see how google has 300+ top level domains. Each of them needs a CNAME DNS record to enforce SafeSearch. The question I was asking was: Would I just need 1 host record for Google SafeSearch forcesafesearch.google.com so I don’t have to put it in the hosts file? I don’t understand what your regex is for either. Is it to block other websites that may expose adult content?

0 Likes

#43

Pi-hole has an name local.list and in the same way host-record works in DNSmasq so no need to use the hosts file.
You only need one entry as long the +300 cnames point to that.

Looking at the list it is covering TLD that Google is using. That is way use not a specific TLD in regex.
So you still need all +300 entries but you condence then to a few lines lines. As long the forcesafesearch.google.com is on the end of each line.

You can’t use regex for that and my rules protects your own privacy.

0 Likes

#44

So the list can be contracted a bit by putting each TLD on one line:

# /tmp/safesearch.txt generated on 12/30/2018 01:54 by pi-hole
# Google SafeSearch Implementation
host-record=forcesafesearch.google.com,216.239.38.120,2001:4860:4802:32::78
cname=google.com,www.google.com,forcesafesearch.google.com
cname=google.ad,www.google.ad,forcesafesearch.google.com
cname=google.ae,www.google.ae,forcesafesearch.google.com
cname=google.com.af,www.google.com.af,forcesafesearch.google.com
cname=google.com.ag,www.google.com.ag,forcesafesearch.google.com
cname=google.com.ai,www.google.com.ai,forcesafesearch.google.com
cname=google.al,www.google.al,forcesafesearch.google.com
cname=google.am,www.google.am,forcesafesearch.google.com
cname=google.co.ao,www.google.co.ao,forcesafesearch.google.com
cname=google.com.ar,www.google.com.ar,forcesafesearch.google.com
cname=google.as,www.google.as,forcesafesearch.google.com
cname=google.at,www.google.at,forcesafesearch.google.com
cname=google.com.au,www.google.com.au,forcesafesearch.google.com
cname=google.az,www.google.az,forcesafesearch.google.com
cname=google.ba,www.google.ba,forcesafesearch.google.com
cname=google.com.bd,www.google.com.bd,forcesafesearch.google.com
cname=google.be,www.google.be,forcesafesearch.google.com
cname=google.bf,www.google.bf,forcesafesearch.google.com
cname=google.bg,www.google.bg,forcesafesearch.google.com
cname=google.com.bh,www.google.com.bh,forcesafesearch.google.com
cname=google.bi,www.google.bi,forcesafesearch.google.com
cname=google.bj,www.google.bj,forcesafesearch.google.com
cname=google.com.bn,www.google.com.bn,forcesafesearch.google.com
cname=google.com.bo,www.google.com.bo,forcesafesearch.google.com
cname=google.com.br,www.google.com.br,forcesafesearch.google.com
cname=google.bs,www.google.bs,forcesafesearch.google.com
cname=google.bt,www.google.bt,forcesafesearch.google.com
cname=google.co.bw,www.google.co.bw,forcesafesearch.google.com
cname=google.by,www.google.by,forcesafesearch.google.com
cname=google.com.bz,www.google.com.bz,forcesafesearch.google.com
cname=google.ca,www.google.ca,forcesafesearch.google.com
cname=google.cd,www.google.cd,forcesafesearch.google.com
cname=google.cf,www.google.cf,forcesafesearch.google.com
cname=google.cg,www.google.cg,forcesafesearch.google.com
cname=google.ch,www.google.ch,forcesafesearch.google.com
cname=google.ci,www.google.ci,forcesafesearch.google.com
cname=google.co.ck,www.google.co.ck,forcesafesearch.google.com
cname=google.cl,www.google.cl,forcesafesearch.google.com
cname=google.cm,www.google.cm,forcesafesearch.google.com
cname=google.cn,www.google.cn,forcesafesearch.google.com
cname=google.com.co,www.google.com.co,forcesafesearch.google.com
cname=google.co.cr,www.google.co.cr,forcesafesearch.google.com
cname=google.com.cu,www.google.com.cu,forcesafesearch.google.com
cname=google.cv,www.google.cv,forcesafesearch.google.com
cname=google.com.cy,www.google.com.cy,forcesafesearch.google.com
cname=google.cz,www.google.cz,forcesafesearch.google.com
cname=google.de,www.google.de,forcesafesearch.google.com
cname=google.dj,www.google.dj,forcesafesearch.google.com
cname=google.dk,www.google.dk,forcesafesearch.google.com
cname=google.dm,www.google.dm,forcesafesearch.google.com
cname=google.com.do,www.google.com.do,forcesafesearch.google.com
cname=google.dz,www.google.dz,forcesafesearch.google.com
cname=google.com.ec,www.google.com.ec,forcesafesearch.google.com
cname=google.ee,www.google.ee,forcesafesearch.google.com
cname=google.com.eg,www.google.com.eg,forcesafesearch.google.com
cname=google.es,www.google.es,forcesafesearch.google.com
cname=google.com.et,www.google.com.et,forcesafesearch.google.com
cname=google.fi,www.google.fi,forcesafesearch.google.com
cname=google.com.fj,www.google.com.fj,forcesafesearch.google.com
cname=google.fm,www.google.fm,forcesafesearch.google.com
cname=google.fr,www.google.fr,forcesafesearch.google.com
cname=google.ga,www.google.ga,forcesafesearch.google.com
cname=google.ge,www.google.ge,forcesafesearch.google.com
cname=google.gg,www.google.gg,forcesafesearch.google.com
cname=google.com.gh,www.google.com.gh,forcesafesearch.google.com
cname=google.com.gi,www.google.com.gi,forcesafesearch.google.com
cname=google.gl,www.google.gl,forcesafesearch.google.com
cname=google.gm,www.google.gm,forcesafesearch.google.com
cname=google.gp,www.google.gp,forcesafesearch.google.com
cname=google.gr,www.google.gr,forcesafesearch.google.com
cname=google.com.gt,www.google.com.gt,forcesafesearch.google.com
cname=google.gy,www.google.gy,forcesafesearch.google.com
cname=google.com.hk,www.google.com.hk,forcesafesearch.google.com
cname=google.hn,www.google.hn,forcesafesearch.google.com
cname=google.hr,www.google.hr,forcesafesearch.google.com
cname=google.ht,www.google.ht,forcesafesearch.google.com
cname=google.hu,www.google.hu,forcesafesearch.google.com
cname=google.co.id,www.google.co.id,forcesafesearch.google.com
cname=google.ie,www.google.ie,forcesafesearch.google.com
cname=google.co.il,www.google.co.il,forcesafesearch.google.com
cname=google.im,www.google.im,forcesafesearch.google.com
cname=google.co.in,www.google.co.in,forcesafesearch.google.com
cname=google.iq,www.google.iq,forcesafesearch.google.com
cname=google.is,www.google.is,forcesafesearch.google.com
cname=google.it,www.google.it,forcesafesearch.google.com
cname=google.je,www.google.je,forcesafesearch.google.com
cname=google.com.jm,www.google.com.jm,forcesafesearch.google.com
cname=google.jo,www.google.jo,forcesafesearch.google.com
cname=google.co.jp,www.google.co.jp,forcesafesearch.google.com
cname=google.co.ke,www.google.co.ke,forcesafesearch.google.com
cname=google.com.kh,www.google.com.kh,forcesafesearch.google.com
cname=google.ki,www.google.ki,forcesafesearch.google.com
cname=google.kg,www.google.kg,forcesafesearch.google.com
cname=google.co.kr,www.google.co.kr,forcesafesearch.google.com
cname=google.com.kw,www.google.com.kw,forcesafesearch.google.com
cname=google.kz,www.google.kz,forcesafesearch.google.com
cname=google.la,www.google.la,forcesafesearch.google.com
cname=google.com.lb,www.google.com.lb,forcesafesearch.google.com
cname=google.li,www.google.li,forcesafesearch.google.com
cname=google.lk,www.google.lk,forcesafesearch.google.com
cname=google.co.ls,www.google.co.ls,forcesafesearch.google.com
cname=google.lt,www.google.lt,forcesafesearch.google.com
cname=google.lu,www.google.lu,forcesafesearch.google.com
cname=google.lv,www.google.lv,forcesafesearch.google.com
cname=google.com.ly,www.google.com.ly,forcesafesearch.google.com
cname=google.co.ma,www.google.co.ma,forcesafesearch.google.com
cname=google.md,www.google.md,forcesafesearch.google.com
cname=google.me,www.google.me,forcesafesearch.google.com
cname=google.mg,www.google.mg,forcesafesearch.google.com
cname=google.mk,www.google.mk,forcesafesearch.google.com
cname=google.ml,www.google.ml,forcesafesearch.google.com
cname=google.com.mm,www.google.com.mm,forcesafesearch.google.com
cname=google.mn,www.google.mn,forcesafesearch.google.com
cname=google.ms,www.google.ms,forcesafesearch.google.com
cname=google.com.mt,www.google.com.mt,forcesafesearch.google.com
cname=google.mu,www.google.mu,forcesafesearch.google.com
cname=google.mv,www.google.mv,forcesafesearch.google.com
cname=google.mw,www.google.mw,forcesafesearch.google.com
cname=google.com.mx,www.google.com.mx,forcesafesearch.google.com
cname=google.com.my,www.google.com.my,forcesafesearch.google.com
cname=google.co.mz,www.google.co.mz,forcesafesearch.google.com
cname=google.com.na,www.google.com.na,forcesafesearch.google.com
cname=google.com.nf,www.google.com.nf,forcesafesearch.google.com
cname=google.com.ng,www.google.com.ng,forcesafesearch.google.com
cname=google.com.ni,www.google.com.ni,forcesafesearch.google.com
cname=google.ne,www.google.ne,forcesafesearch.google.com
cname=google.nl,www.google.nl,forcesafesearch.google.com
cname=google.no,www.google.no,forcesafesearch.google.com
cname=google.com.np,www.google.com.np,forcesafesearch.google.com
cname=google.nr,www.google.nr,forcesafesearch.google.com
cname=google.nu,www.google.nu,forcesafesearch.google.com
cname=google.co.nz,www.google.co.nz,forcesafesearch.google.com
cname=google.com.om,www.google.com.om,forcesafesearch.google.com
cname=google.com.pa,www.google.com.pa,forcesafesearch.google.com
cname=google.com.pe,www.google.com.pe,forcesafesearch.google.com
cname=google.com.pg,www.google.com.pg,forcesafesearch.google.com
cname=google.com.ph,www.google.com.ph,forcesafesearch.google.com
cname=google.com.pk,www.google.com.pk,forcesafesearch.google.com
cname=google.pl,www.google.pl,forcesafesearch.google.com
cname=google.pn,www.google.pn,forcesafesearch.google.com
cname=google.com.pr,www.google.com.pr,forcesafesearch.google.com
cname=google.ps,www.google.ps,forcesafesearch.google.com
cname=google.pt,www.google.pt,forcesafesearch.google.com
cname=google.com.py,www.google.com.py,forcesafesearch.google.com
cname=google.com.qa,www.google.com.qa,forcesafesearch.google.com
cname=google.ro,www.google.ro,forcesafesearch.google.com
cname=google.ru,www.google.ru,forcesafesearch.google.com
cname=google.rw,www.google.rw,forcesafesearch.google.com
cname=google.com.sa,www.google.com.sa,forcesafesearch.google.com
cname=google.com.sb,www.google.com.sb,forcesafesearch.google.com
cname=google.sc,www.google.sc,forcesafesearch.google.com
cname=google.se,www.google.se,forcesafesearch.google.com
cname=google.com.sg,www.google.com.sg,forcesafesearch.google.com
cname=google.sh,www.google.sh,forcesafesearch.google.com
cname=google.si,www.google.si,forcesafesearch.google.com
cname=google.sk,www.google.sk,forcesafesearch.google.com
cname=google.com.sl,www.google.com.sl,forcesafesearch.google.com
cname=google.sn,www.google.sn,forcesafesearch.google.com
cname=google.so,www.google.so,forcesafesearch.google.com
cname=google.sm,www.google.sm,forcesafesearch.google.com
cname=google.sr,www.google.sr,forcesafesearch.google.com
cname=google.st,www.google.st,forcesafesearch.google.com
cname=google.com.sv,www.google.com.sv,forcesafesearch.google.com
cname=google.td,www.google.td,forcesafesearch.google.com
cname=google.tg,www.google.tg,forcesafesearch.google.com
cname=google.co.th,www.google.co.th,forcesafesearch.google.com
cname=google.com.tj,www.google.com.tj,forcesafesearch.google.com
cname=google.tk,www.google.tk,forcesafesearch.google.com
cname=google.tl,www.google.tl,forcesafesearch.google.com
cname=google.tm,www.google.tm,forcesafesearch.google.com
cname=google.tn,www.google.tn,forcesafesearch.google.com
cname=google.to,www.google.to,forcesafesearch.google.com
cname=google.com.tr,www.google.com.tr,forcesafesearch.google.com
cname=google.tt,www.google.tt,forcesafesearch.google.com
cname=google.com.tw,www.google.com.tw,forcesafesearch.google.com
cname=google.co.tz,www.google.co.tz,forcesafesearch.google.com
cname=google.com.ua,www.google.com.ua,forcesafesearch.google.com
cname=google.co.ug,www.google.co.ug,forcesafesearch.google.com
cname=google.co.uk,www.google.co.uk,forcesafesearch.google.com
cname=google.com.uy,www.google.com.uy,forcesafesearch.google.com
cname=google.co.uz,www.google.co.uz,forcesafesearch.google.com
cname=google.com.vc,www.google.com.vc,forcesafesearch.google.com
cname=google.co.ve,www.google.co.ve,forcesafesearch.google.com
cname=google.vg,www.google.vg,forcesafesearch.google.com
cname=google.co.vi,www.google.co.vi,forcesafesearch.google.com
cname=google.com.vn,www.google.com.vn,forcesafesearch.google.com
cname=google.vu,www.google.vu,forcesafesearch.google.com
cname=google.ws,www.google.ws,forcesafesearch.google.com
cname=google.rs,www.google.rs,forcesafesearch.google.com
cname=google.co.za,www.google.co.za,forcesafesearch.google.com
cname=google.co.zm,www.google.co.zm,forcesafesearch.google.com
cname=google.co.zw,www.google.co.zw,forcesafesearch.google.com
cname=google.cat,www.google.cat,forcesafesearch.google.com
cname=duckduckgo.com,www.duckduckgo.com,safe.duckduckgo.com
host-record=safe.duckduckgo.com,50.16.250.179
cname=duck.com,www.duck.com,safe.duckduckgo.com
host-record=strict.bing.com,204.79.197.220
cname=bing.com,www.bing.com,strict.bing.com

Or the Google part even more condensed but I think the top one is prefered:

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

#45

Ok, I see. You have IPV4 and IPv6 records. Could I put multiple IPV4 addresses to point to a host and dnsmasq would do it round robin? Or should I radnomly select an IP?

Happy New Year!

0 Likes

#47

I am working on making a python command line tool to acomplish this very task. This is turning into more of a project and I don’t think bash will do the trick anymore. I will have it done by the end of the week.

1 Like

#48

Thanks, and a happy new year to you.

You can only enter one IPv4 and one IPv6 address so no round robin possible.

host-record=<name>[,<name>....],[<IPv4-address>],[<IPv6-address>][,<TTL>]
    Add A, AAAA and PTR records to the DNS. This adds one or more names to the DNS with associated IPv4 (A) and IPv6 (AAAA) records. A name may appear in more than one --host-record and therefore be assigned more than one address. Only the first address creates a PTR record linking the address to the name. This is the same rule as is used reading hosts-files. --host-record options are considered to be read before host-files, so a name appearing there inhibits PTR-record creation if it appears in hosts-file also. Unlike hosts-files, names are not expanded, even when --expand-hosts is in effect. Short and long names may appear in the same --host-record, eg. --host-record=laptop,laptop.thekelleys.org,192.168.0.1,1234::100

    If the time-to-live is given, it overrides the default, which is zero or the value of --local-ttl. The value is a positive integer and gives the time-to-live in seconds.

http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

Take your time and I had the impression that host-record made things easier. You are staying in the Pi-hole/DNSmasq environment.

1 Like

#49

Hi, you could do a script to go back this function? or a button to activate o deactivate? Thanks

1 Like

#50

Lets hope development picks this up when ready and implement it as extra feature in Pi-hole.

1 Like

#51

Yes, this is a very useful and important feature

1 Like