How to set up a custom DNS in OpenWRT?

Hello everyone. Please tell me how to correctly and what to specify in the "Use custom DNS server" field when using the service https://libredns.gr/ .

Note. I use VPN in the OpenWRT settings, will this somehow conflict?

Thanks in advance for your help.

https://openwrt.org/docs/guide-user/base-system/dhcp_configuration#dhcp_options use option 6.

this will feed the clients with the IP of libredns DNS via the DHCP.

1 Like

You need to set up stubby or dns-http-proxy and change configuration to use backends of your service, then force dnsmasq to use respective port of proxy on localhost as forwarder.

1 Like

It is like brada4 said, install HTTPS-DNS-proxy:

Then set : https://doh.libredns.gr/dns-query as upstream resolver

1 Like

@frollic @brada4 @egc Thank you very much for your answers. I thought it would be easier than using adblock https://openwrt.org/docs/guide-user/services/ad-blocking in terms of configuration, but as the documentation says, adblock is the best option. Correct me if I'm wrong.

If your goal is adblocking then the Adblock package works well.

But settings up HTTPS-DNS-Proxy and then using a DNS server from libredns which does the adblocking for you is not much of a deal to setup.

I use both Adblock for adblocking and HTTPS-DNS-Proxy for secure DNS, not for adblocking but just for plain DNS albeit secure because the DNS is encrypted

1 Like

There's nothing in your initial post about adblocking.

@frollic @egc Thanks for your answers, I found how to do it)) when they write that it is not difficult, I do not always understand what it means without commands.

Yes, I also wanted to block ads, but adblock is a manual mode, I tried, ads still go through, it blocks some things and not others.

Perhaps a good solution for encryption (DNS protection) and ad blocking would be dnscrypt-proxy

opkg update
opkg install https-dns-proxy

while uci -q delete https-dns-proxy.@https-dns-proxy[0]; do :; done
uci set https-dns-proxy.dns="https-dns-proxy"
uci set https-dns-proxy.dns.resolver_url="https://doh.libredns.gr/dns-query"
uci set https-dns-proxy.dns.listen_addr="127.0.0.1"
uci set https-dns-proxy.dns.listen_port="5053"
uci set https-dns-proxy.dns.user="nobody"
uci set https-dns-proxy.dns.group="nogroup"
uci commit https-dns-proxy

/etc/init.d/https-dns-proxy restart