惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
Project Zero
Project Zero
阮一峰的网络日志
阮一峰的网络日志
博客园 - 【当耐特】
大猫的无限游戏
大猫的无限游戏
The Register - Security
The Register - Security
C
Check Point Blog
Attack and Defense Labs
Attack and Defense Labs
L
LangChain Blog
Simon Willison's Weblog
Simon Willison's Weblog
S
Schneier on Security
Recorded Future
Recorded Future
GbyAI
GbyAI
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Y
Y Combinator Blog
量子位
A
About on SuperTechFans
I
Intezer
T
Threat Research - Cisco Blogs
MongoDB | Blog
MongoDB | Blog
U
Unit 42
C
CERT Recently Published Vulnerability Notes
Scott Helme
Scott Helme
Cisco Talos Blog
Cisco Talos Blog
P
Palo Alto Networks Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
M
MIT News - Artificial intelligence
雷峰网
雷峰网
博客园 - 聂微东
NISL@THU
NISL@THU
The Hacker News
The Hacker News
G
Google Developers Blog
F
Full Disclosure
博客园 - Franky
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Privacy & Cybersecurity Law Blog
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
T
The Blog of Author Tim Ferriss
Security Latest
Security Latest
T
Tenable Blog
Know Your Adversary
Know Your Adversary
Stack Overflow Blog
Stack Overflow Blog
K
Kaspersky official blog
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
C
Cybersecurity and Infrastructure Security Agency CISA
Martin Fowler
Martin Fowler
Schneier on Security
Schneier on Security

Documentation on CoreDNS: DNS and Service Discovery

Cluster DNS: CoreDNS vs Kube-DNS Scaling CoreDNS in Kubernetes Clusters Migration from kube-dns to CoreDNS Deploying Kubernetes with CoreDNS using kubeadm Compile Time Enabling or Disabling Plugins Quick Start How Queries Are Processed in CoreDNS Custom DNS Entries For Kubernetes CoreDNS for Minikube CoreDNS for Kubernetes Service Discovery, Take 2 How to Add Plugins to CoreDNS History of CoreDNS in four posts. Writing Plugins for CoreDNS DNS over HTTPS CoreDNS for Kubernetes Service Discovery Quick Start for Windows Query Routing
Corefile Explained
miek · 2017-07-24 · via Documentation on CoreDNS: DNS and Service Discovery

The Corefile is CoreDNS’s configuration file. It defines:

  • What servers listen on what ports and which protocol.
  • For which zone each server is authoritative.
  • Which plugins are loaded in a server.

To explain more, let take a look at this “Corefile”:

ZONE:[PORT] {
    [PLUGIN]...
}
  • ZONE defines the zone this server. The optional PORT defaults to 53, or the value of the -dns.port flag.
  • PLUGIN defines the plugin(s) we want to load. This is optional as well, but a server with no plugins will just return SERVFAIL for all queries. Each plugin can have a number of properties than can have arguments

I.e., in the next example:

The ZONE is root zone ., the PLUGIN is chaos. The chaos plugin does not have any properties, but it does take an argument: CoreDNS-001. This text is returned on a CH class query: dig CH txt version.bind @localhost

. {
   chaos CoreDNS-001
}

If CoreDNS can’t find a Corefile to load is loads the following builtin one that loads the whoami plugin:

. {
    whoami
}

Servers

This is the most minimal Corefile:

. { }

That defines a server to listen on port 53 and make it authoritative for the root zone and everything below. Let’s define another server that is authoritative for . (root zone) and load that:

This will make CoreDNS exit with an error:

2017/07/23 20:39:10 cannot serve dns://.:53 - zone already defined for dns://.:53

Why? Because we already defined a server on the same port for this zone. If we change the port number on the second server and thereby creating another server, it is OK:

When defining a new zone, you either create a new server, or add it to an existing one. Here we define one server that handles two zones; that potentially chain different plugin:

example.org {
    whoami
}
org {
    whoami
}

Note that most specific zone wins when a query comes in, so any example.org queries are going through the server defined for example.org above. The queries for .org are going to the other server.

Reverse Zones

Normally when you want to serve a reverse zone you’ll have to say something:

0.0.10.in-addr.arpa {
    whoami
}

To make this easier CoreDNS just allows you to say:

10.0.0.0/24 {
    whoami
}

This also works for CIDR (in the 1.0.0 release) zones:

10.0.0.0/27 {
    whoami
}

Non Default Protocols

Listening on TLS and for gRPC? Use:

tls://example.org grpc://example.org {
    # ...
}

Specifying ports works in the same way, here when listening for gRPC packets.

grpc://example.org:1443 {
    # ...
}

Also See

The Corefile is parsed like a Caddyfile. We support everything that is described on that page, for instance the use of environment variables.

Other interesting plugins that are helpful in Corefiles are: import startup and shutdown.