routedns icon indicating copy to clipboard operation
routedns copied to clipboard

Add ECS Source Routing documentation to configuration guide

Open tekert opened this issue 2 weeks ago • 4 comments

Draft for missing documentation on #471 merge

tekert avatar Dec 09 '25 00:12 tekert

ready

tekert avatar Dec 09 '25 19:12 tekert

Does it actually work with subnets or is it only IPs? All masks in the docs are 32 which makes me believe it's the latter.

Anuskuss avatar Dec 09 '25 19:12 Anuskuss

The examples in the documentation use /32 masks because they represent individual IPs, which are the most common use case for per-client policies. However, the feature is not limited to /32. You can use any valid CIDR notation to define subnets.

[routers.ecs-router]
routes = [
  # Route 1: Queries with an ECS source of 192.168.1.10/32 are sent to the adblocker.
  { ecs-source = "192.168.1.10/32", resolver = "adblock-resolver" },

  # Route 2: Queries with an ECS source of 192.168.1.0/24 are sent to the unfiltered resolver.
  { ecs-source = "192.168.1.0/24", resolver = "unfiltered-resolver" },

  # Route 3 (Default): All other queries (including those without ECS) go to the unfiltered resolver.
  { resolver = "unfiltered-resolver" },
]

tekert avatar Dec 09 '25 22:12 tekert

updated the examples to be easier to understand. The net.IPNet.Contains() method supports subnet matching, meaning you can define broader subnets like 192.168.1.0/24 or 10.0.0.0/8 in your configuration, and RouteDNS will correctly match any IP within those ranges.

tekert avatar Dec 09 '25 23:12 tekert

Thank you

folbricht avatar Dec 14 '25 00:12 folbricht