Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

rndc

BIND (named) is the classic DNS server; rndc controls it, and named-checkconf / named-checkzone test the config before a reload.

Niveau
DevSecOps-service
Groep
Netwerkdiensten
Root nodig
Ja
Pakket
bind
Ook
named, bind, named-checkconf, named-checkzone

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

BIND 9 (named, port 53 UDP/TCP) can be an authoritative server (holds your zones, e.g. lab.local) and/or a recursive resolver for your network. Zones are text files with records (A, AAAA, CNAME, MX, TXT, NS, SOA). After a change you raise the SOA serial, check the zone, and reload. rndc talks to named over a control channel (key in /etc/rndc.key).

Internal DNS is a basic platform service: Kubernetes, AD, mail and TLS all depend on it. DNS problems look like "everything is broken".

Zo schrijf je het

rndc reload [ZONE] | reconfig | flush | status | dumpdb
named-checkconf [-z] ; named-checkzone ZONE FILE

Belangrijkste delen

rndc commands

status
Server status.
reload [ZONE]
Reload config and zones / one zone.
reconfig
Read named.conf and new zones only.
flush [VIEW] / flushname NAME
Empty the cache (or one name).
dumpdb -cache
Write the cache to a file.
querylog on|off
Log every query (debugging).
freeze / thaw ZONE
Stop / start dynamic updates to edit a zone file.
retransfer ZONE
Pull a secondary zone again.
signing -list ZONE
DNSSEC key status.

Opties 4

Meest gebruikt

Check tools

named-checkconf
Syntax of named.conf.
named-checkconf -z
Also load and check all zones.
named-checkzone ZONE FILE
Check one zone file.
named -g -u named
Run in the foreground (debug).

Voorbeelden 11

$ als gewone gebruiker# als root (of met sudo)

  1. 1Install on RHEL

    dnf install -y bind bind-utils
    systemctl enable --now named
    firewall-cmd --permanent --add-service=dns && firewall-cmd --reload
  2. 2A zone for the lab

    cat /var/named/lab.local.zone
    $TTL 3600
    @     IN SOA ns1.lab.local. admin.lab.local. ( 2026102701 3600 900 1209600 300 )
          IN NS  ns1.lab.local.
    ns1   IN A   192.168.122.2
    web1  IN A   192.168.122.11
    k8s   IN A   192.168.122.10
    www   IN CNAME web1
  3. 3Add the zone and allow queries only from the lab

    cat /etc/named.conf
    options {
        listen-on port 53 { 127.0.0.1; 192.168.122.2; };
        allow-query { localhost; 192.168.122.0/24; };
        recursion yes;
        allow-recursion { localhost; 192.168.122.0/24; };
    };
    zone "lab.local" IN { type primary; file "lab.local.zone"; allow-update { none; }; };
  4. 4Check everything before reload

    named-checkconf -z
    named-checkzone lab.local /var/named/lab.local.zone
    zone lab.local/IN: loaded serial 2026102701
    OK
  5. 5Reload after a change

    rndc reload lab.local
    dig @192.168.122.2 web1.lab.local +short
  6. 6Status and cache

    rndc status
    rndc flushname shop.example.com
    rndc flush
  7. 7Log queries for a short time

    rndc querylog on
    journalctl -u named -f
    rndc querylog off
  8. 8Edit a dynamic zone safely

    rndc freeze lab.local
    vim /var/named/dynamic/lab.local.zone
    rndc thaw lab.local
  9. 9Stop zone transfers to strangers

    grep allow-transfer /etc/named.conf
        allow-transfer { 192.168.122.3; };
  10. 10Check DNSSEC for a public domain

    dig +dnssec s0sta.com SOA | grep -E "flags|RRSIG"
  11. 11SELinux and file rights for zone files

    chown root:named /var/named/lab.local.zone && restorecon -v /var/named/lab.local.zone

Let op

  • Always raise the SOA serial; secondaries ignore changes with the same serial.
  • An open resolver (recursion for everyone) is used in DDoS attacks — limit allow-recursion.
  • A missing dot at the end of a name (ns1.lab.local) adds the zone name again.

Bestanden

/etc/named.conf
Main config.
/var/named/
Zone files (RHEL).
/etc/rndc.key
rndc control key.

Tips om te onthouden

  • Use the date + number as serial (2026102701).

Exitcodes

0Success.
1Error (config or zone invalid, server not reachable).

Volledige handleiding

Deze pagina legt het commando uit in eenvoudige woorden. De originele handleiding heeft elk detail.

In je terminal: man 8 rndc