While this doesn’t relate directly to pi-hole (I’m not trying to block YouTube ads), I figured this community may be able to offer insight on layering uses of dnsmasq on top of a pihole device.
I’ve found here: https://support.google.com/youtube/answer/6214622?hl=en, that youtube offers an alternate URL that can be used as a cname for their primary domains that will force youtube into restricted/semi restricted modes.
Essentially, it’s this:
Configure Domain Name System (DNS) on your network to add a Canonical Name (CNAME) for the following hostnames:
www.youtube.com m.youtube.com youtubei.googleapis.com youtube.googleapis.com www.youtube-nocookie.com
I’ve been trying to figure out how to/if I can leverage my pihole machine to achieve this, or if I’ll have to get another device/server to do it.
I’ve tried adding cnames to the dnsmasq.conf file, and adding records to a hosts file, but I always get dnsmasq errors and it won’t restart, or it restarts and doesn’t perform the redirect via the cname - so I’m sure I’m doing something wrong.
This seems close to what I’m trying to do, but even these steps don’t yelid any fruit.
Wondering if anyone with more dnsmasq/pihole experience can lend any advice.
If it makes a difference, I’m running pihole on Ubuntu 16.04 server.