I am looking for an example configuration in which CoreDNS will read the CNAME record from the file (file plugin) and then resolve it using a custom resolver (forward plugin?). A client should not get CNAME record but only A records.

For example:

  • if the client ask the CoreDNS for test.r1.svc
  • then the CoreDNS get the CNAME record test IN CNAME test.r2.svc.
  • then ask the foreign resolver for test.r2.svc
  • and response to the client with the A records

Is it possible?

This config is not working for me:

# root
. {

r1.svc {
  file r1.svc
  forward r2.svc
r1.svc file
$ORIGIN r1.svc.
@ 3600 IN SOA sns.dns.icann.org. noc.dns.icann.org. (
    202211241713 ; serial
    7200         ; refresh (2 hours)
    3600         ; retry (1 hour)
    1209600      ; expire (2 weeks)
    3600         ; minimum (1 hour)
3600 IN NS a.iana-servers.net.
3600 IN NS b.iana-servers.net.
test IN CNAME test.r2.svc.

2 Answers 2


I might be mistaken, but the forward r2.svc is in the r1.svc block so it will never get called.

Client asks for test.r1.svc
Server responds that it's a CNAME for test.r2.svc
Client asks for test.r2.svc
Server doesn't know how to process the answer

Moving the forward r2.svc line to the . block should allow it to process the second request.

  • Unfortunately it doesn't change anything
    – kinjelom
    Nov 29, 2022 at 11:23

I wrote plugin for CoreDNS to do it: https://github.com/kinjelom/coredns-recursor

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.