Blocking ads and trackers on a look up level is probably the most methodical approach as it means the entire network is protected from known malicious websites/IP’s. Setting up a switch to allow a Raspberry Pi to act as a DNS server is I guess the ultimate home setup, however that obviously requires a switch, Raspberry Pi and a little effort.
The next best thing is to manually set your devices to use DNS over HTTPS which adds some privacy and security to your DNS resolutions, but of course not stopping there and using a DNS provider that adds ad-blocking and tracker-blocking to the mix.
It’s still recommended to use a browser plugin like uBlock Origin and others like LocalCDN, Privacy Badger oh and personally I’d add Cookie AutoDelete, but blocking via DNS is for when you can’t use the former.
First port of call
Search what kind of service you prefer. The below link should give you a gist on what’s out there. I haven’t extensively tested to give you the best one.
Avoid The Hack: 7 Best DNS Providers for Privacy (and adblocking) | avoidthehack!
https://avoidthehack.com/best-dns-privacy
Blocking Ads, Trackers, and Malware in Browsers, Devices, and Networks | avoidthehack!
https://avoidthehack.com/how-to-block-ads
Mullvad DNS
To set one up quickly, I’d suggest Mullvad DNS.
DNS over HTTPS and DNS over TLS – Guides | Mullvad VPN
https://mullvad.net/en/help/dns-over-https-and-dns-over-tls/
DNS Leak test/connection test
Connection check | Mullvad VPN
https://mullvad.net/en/check
How-to
For Chromium it’s in the settings, and also if you wish to disable the fall-back it’s “chrome://flags/#dns-over-https” (then search for DnsOverHttpsMode) in the address bar to get to the settings.
Controversy
Secure DNS is a good thing, but centralized is not. Worth reading.
Centralised DoH is bad for privacy, in 2019 and beyond | PowerDNS Blog
https://blog.powerdns.com/2019/09/25/centralised-doh-is-bad-for-privacy-in-2019-and-beyond/