الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

rndc

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

المستوى
خدمة DevSecOps
المجموعة
خدمات الشبكة
يحتاج root
نعم
الحزمة
bind
يُسمّى أيضًا
named, bind, named-checkconf, named-checkzone

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

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".

طريقة الكتابة

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

الأجزاء الرئيسية

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.

الخيارات 4

الأكثر استخدامًا

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).

أمثلة 11

$ مستخدم عادي# بصلاحية root (أو مع 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

انتبه

  • 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.

الملفات

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

نصائح للحفظ

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

رموز الخروج

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

الدليل الكامل

هذه الصفحة تشرح الأمر بكلمات بسيطة. الدليل الأصلي فيه كل التفاصيل.

في الطرفية: man 8 rndc