Ce projet configure un serveur DNS CoreDNS utilisant Docker Compose. Il inclut une zone DNS pour example.org et des plugins pour la journalisation, la gestion des erreurs, et la surveillance de l'état du service.
coredns/
├── docker-compose.yml # Configuration Docker Compose
├── Corefile # Configuration CoreDNS
└── zones/ # Fichiers de zone DNS
└── example.db # Zone DNS pour example.org
Le fichier Corefile configure CoreDNS avec les plugins suivants :
file: Pour servir la zone DNS statiqueexample.org.log: Pour journaliser les requêtes DNS.errors: Pour afficher les erreurs.health: Pour surveiller l'état du service sur le port 8080.forward: Pour rediriger les requêtes vers Google DNS (8.8.8.8, 8.8.4.4).
Le fichier zones/example.db définit la zone DNS pour example.org avec les enregistrements suivants :
example.org: 192.168.1.101ns1.example.org: 192.168.1.101www.example.org: 192.168.1.101
-
Démarrer CoreDNS :
docker-compose up -d
-
Vérifier l'état du service :
curl http://localhost:8080/health
-
Tester la résolution DNS :
dig @localhost example.org dig @localhost www.example.org
; <<>> DiG 9.18.28-1~deb12u2-Debian <<>> @localhost example.org
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1730
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 9b8a5aa0d6db3c3e (echoed)
;; QUESTION SECTION:
;example.org. IN A
;; ANSWER SECTION:
example.org. 3600 IN A 192.168.1.101
;; AUTHORITY SECTION:
example.org. 3600 IN NS ns1.example.org.
;; Query time: 3 msec
;; SERVER: ::1#53(localhost) (UDP)
;; WHEN: Tue Feb 25 21:43:34 CET 2025
;; MSG SIZE rcvd: 127
Pour arrêter CoreDNS :
docker-compose down