0xERR0R / blocky

Fast and lightweight DNS proxy as ad-blocker for local network with many features
https://0xERR0R.github.io/blocky/
Apache License 2.0
4.38k stars 199 forks source link

Custom DNS wildcard for subdomains only #1515

Open starsoccer opened 4 weeks ago

starsoccer commented 4 weeks ago

From reading the documentation it seems like its currently possible to specify a domain and have all subdomains for it go to a single IP for example purposes Ill use 192.168.178.3 like the documentation. The documentation uses an example of printer.lan and then printer.lan, my.printer.lan or i.love.my.printer.lan will all resolve to the same IP(192.168.178.3).

I cant seem to find any documentation on how to specify an IP for all subdomains except the top level. For instance Id like to be able to do something like this in my config file: *.printer.lan: 192.168.178.3

The above seems to be invalid, but I would expect it to do something like this: printer.lan -> go to upstream dns my.printer.lan -> 192.168.178.3 something.printer.lan -> 192.168.178.3 i.love.my.printer.lan -> 192.168.178.3

Basically the goal being to have the top level domain still go to the upstream resolver but any subdomains to go to the hard coded IP.

bcookatpcsd commented 3 weeks ago

I literally think that is the exact example..

https://0xerr0r.github.io/blocky/latest/configuration/#custom-dns

   customDNS:
       customTTL: 300s
       filterUnmappedTypes: true
       mapping:
         pool.ntp.org: 172.16.254.241

drill -Q i.love.my.pool.ntp.org @10.120.0.247 172.16.254.241

(I do not see an * in the documentation.. you shouldn't have one either.. )

starsoccer commented 3 weeks ago

@bcookatpcsd So in your example I want pool.ntp.org to continue to go to its regular IP however its normally resolved, but I want my.pool.ntp.org, as well as i.love.my.pool.ntp.org to go to 172.16.254.241.

Basically I want the top level domain to continue to be resolved like normal, but I want all subdomains to be resolved differently.

bcookatpcsd commented 3 weeks ago

I would start with this.. and see what you get then get to work..

https://0xerr0r.github.io/blocky/latest/configuration/#conditional-dns-resolution

or just hard code the records you want from the other domain and serve them as your own..

starsoccer commented 3 weeks ago

I would start with this.. and see what you get then get to work..

https://0xerr0r.github.io/blocky/latest/configuration/#conditional-dns-resolution

or just hard code the records you want from the other domain and serve them as your own..

Im not sure I am following exactly on how I would use the conditional DNS to achieve what I want?

Regarding hard coding the records, that is probably the easiest option and is what I am currently doing. I just wanted to avoid the extra step of having to add every subdomain to blocky for it to be resolved. I was hoping there would be a way to just resolve all subdomains to one IP and then the top level fall back to the main resolver since the IP can change.

garfieldairlines commented 1 week ago

Just posting here to get notified as well, I wish to have

customDNS:
  customTTL: 96h
  mapping:
    *.example.net: 100.100.100.100,abc:def::123:4567

in my config, it would spare me something like… 30 lines.