ПошаговоС руководство ΠΏΠΎ настройкС DNS-сСрвСра BIND Π² chroot срСдС для Red Hat (RHEL / CentOS) 7

ΠŸΠ΅Ρ€Π΅Π²ΠΎΠ΄ ΡΡ‚Π°Ρ‚ΡŒΠΈ ΠΏΠΎΠ΄Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ для студСнтов курса Β«Π‘Π΅Π·ΠΎΠΏΠ°ΡΠ½ΠΎΡΡ‚ΡŒ LinuxΒ». Π˜Π½Ρ‚Π΅Ρ€Π΅ΡΠ½ΠΎ Ρ€Π°Π·Π²ΠΈΠ²Π°Ρ‚ΡŒΡΡ Π² Π΄Π°Π½Π½ΠΎΠΌ Π½Π°ΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠΈ? Π‘ΠΌΠΎΡ‚Ρ€ΠΈΡ‚Π΅ запись трансляции мастСр-класса Ивана ΠŸΠΈΡΠΊΡƒΠ½ΠΎΠ²Π° Β«Π‘Π΅Π·ΠΎΠΏΠ°ΡΠ½ΠΎΡΡ‚ΡŒ Π² Linux Π² сравнСнии с Windows ΠΈ MacOSΒ»

ПошаговоС руководство ΠΏΠΎ настройкС DNS-сСрвСра BIND Π² chroot срСдС для Red Hat (RHEL / CentOS) 7

Π’ этой ΡΡ‚Π°Ρ‚ΡŒΠ΅ я расскаТу ΠΎ ΡˆΠ°Π³Π°Ρ… ΠΏΠΎ настройкС DNS-сСрвСра Π½Π° RHEL 7 ΠΈΠ»ΠΈ CentOS 7. Для дСмонстрации я использовал Red Hat Enterprise Linux 7.4. Наша Ρ†Π΅Π»ΡŒ β€” ΡΠΎΠ·Π΄Π°Ρ‚ΡŒ ΠΎΠ΄Π½Ρƒ A-запись ΠΈ ΠΎΠ΄Π½Ρƒ PTR-запись для Π·ΠΎΠ½Ρ‹ прямого ΠΈ ΠΎΠ±Ρ€Π°Ρ‚Π½ΠΎΠ³ΠΎ просмотра соотвСтствСнно.

Π‘Π½Π°Ρ‡Π°Π»Π° установитС Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΡ‹Π΅ rpm-ΠΏΠ°ΠΊΠ΅Ρ‚Ρ‹ для DNS-сСрвСра.

ΠŸΠ Π˜ΠœΠ•Π§ΠΠΠ˜Π•: Для RHEL Ρƒ вас Π΄ΠΎΠ»ΠΆΠ½Π° Π±Ρ‹Ρ‚ΡŒ активная подписка Π½Π° RHN, ΠΈΠ»ΠΈ Π²Ρ‹ ΠΌΠΎΠΆΠ΅Ρ‚Π΅ Π½Π°ΡΡ‚Ρ€ΠΎΠΈΡ‚ΡŒ Π»ΠΎΠΊΠ°Π»ΡŒΠ½Ρ‹ΠΉ Π°Π²Ρ‚ΠΎΠ½ΠΎΠΌΠ½Ρ‹ΠΉ Ρ€Π΅ΠΏΠΎΠ·ΠΈΡ‚ΠΎΡ€ΠΈΠΉ, с ΠΏΠΎΠΌΠΎΡ‰ΡŒΡŽ ΠΊΠΎΡ‚ΠΎΡ€ΠΎΠ³ΠΎ ΠΌΠ΅Π½Π΅Π΄ΠΆΠ΅Ρ€ ΠΏΠ°ΠΊΠ΅Ρ‚ΠΎΠ² Β«yumΒ» смоТСт ΡƒΡΡ‚Π°Π½ΠΎΠ²ΠΈΡ‚ΡŒ Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΡ‹Π΅ rpm-ΠΏΠ°ΠΊΠ΅Ρ‚Ρ‹ ΠΈ зависимости.

# yum install bind bind-chroot caching-nameserver

Мои настройки:

# hostname
golinuxhub-client.example
Мой IP-адрСс 192.168.1.7
# ip address | egrep 'inet.*enp0s3'
    inet 192.168.1.7/24 brd 192.168.1.255 scope global dynamic enp0s3

ΠŸΠΎΡΠΊΠΎΠ»ΡŒΠΊΡƒ ΠΌΡ‹ Π±ΡƒΠ΄Π΅ΠΌ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ chroot, Π½ΡƒΠΆΠ½ΠΎ ΠΎΡ‚ΠΊΠ»ΡŽΡ‡ΠΈΡ‚ΡŒ слуТбу.

# systemctl stop named
# systemctl disable named

Π—Π°Ρ‚Π΅ΠΌ скопируйтС Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΡ‹Π΅ Ρ„Π°ΠΉΠ»Ρ‹ Π² ΠΊΠ°Ρ‚Π°Π»ΠΎΠ³ chroot.
ΠŸΠ Π˜ΠœΠ•Π§ΠΠΠ˜Π•. Π˜ΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠΉΡ‚Π΅ Π°Ρ€Π³ΡƒΠΌΠ΅Π½Ρ‚ -p Π² ΠΊΠΎΠΌΠ°Π½Π΄Π΅ cp для сохранСния ΠΏΡ€Π°Π² ΠΈ Π²Π»Π°Π΄Π΅Π»ΡŒΡ†Π΅Π².

[root@golinuxhub-client ~]# cp -rpvf /usr/share/doc/bind-9.9.4/sample/etc/*  /var/named/chroot/etc/
β€˜/usr/share/doc/bind-9.9.4/sample/etc/named.conf’ -> β€˜/var/named/chroot/etc/named.conf’
β€˜/usr/share/doc/bind-9.9.4/sample/etc/named.rfc1912.zones’ -> β€˜/var/named/chroot/etc/named.rfc1912.zones’

Π—Π°Ρ‚Π΅ΠΌ скопируйтС Ρ„Π°ΠΉΠ»Ρ‹, связанныС с Π·ΠΎΠ½ΠΎΠΉ, Π² Π½ΠΎΠ²ΠΎΠ΅ мСсто.

[root@golinuxhub-client ~]# cp -rpvf /usr/share/doc/bind-9.9.4/sample/var/named/* /var/named/chroot/var/named/
β€˜/usr/share/doc/bind-9.9.4/sample/var/named/data’ -> β€˜/var/named/chroot/var/named/data’
β€˜/usr/share/doc/bind-9.9.4/sample/var/named/my.external.zone.db’ -> β€˜/var/named/chroot/var/named/my.external.zone.db’
β€˜/usr/share/doc/bind-9.9.4/sample/var/named/my.internal.zone.db’ -> β€˜/var/named/chroot/var/named/my.internal.zone.db’
β€˜/usr/share/doc/bind-9.9.4/sample/var/named/named.ca’ -> β€˜/var/named/chroot/var/named/named.ca’
β€˜/usr/share/doc/bind-9.9.4/sample/var/named/named.empty’ -> β€˜/var/named/chroot/var/named/named.empty’
β€˜/usr/share/doc/bind-9.9.4/sample/var/named/named.localhost’ -> β€˜/var/named/chroot/var/named/named.localhost’
β€˜/usr/share/doc/bind-9.9.4/sample/var/named/named.loopback’ -> β€˜/var/named/chroot/var/named/named.loopback’
β€˜/usr/share/doc/bind-9.9.4/sample/var/named/slaves’ -> β€˜/var/named/chroot/var/named/slaves’
β€˜/usr/share/doc/bind-9.9.4/sample/var/named/slaves/my.ddns.internal.zone.db’ -> β€˜/var/named/chroot/var/named/slaves/my.ddns.internal.zone.db’
β€˜/usr/share/doc/bind-9.9.4/sample/var/named/slaves/my.slave.internal.zone.db’ -> β€˜/var/named/chroot/var/named/slaves/my.slave.internal.zone.db’
```bash
Π’Π΅ΠΏΠ΅Ρ€ΡŒ Π΄Π°Π²Π°ΠΉΡ‚Π΅ посмотрим Π½Π° основной Ρ„Π°ΠΉΠ» ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΠΈ.
```bash
# cd /var/named/chroot/etc/

ΠžΡ‡ΠΈΡΡ‚ΠΈΡ‚Π΅ содСрТимоС named.conf ΠΈ Π²ΡΡ‚Π°Π²ΡŒΡ‚Π΅ ΡΠ»Π΅Π΄ΡƒΡŽΡ‰Π΅Π΅.

[root@golinuxhub-client etc]# vim named.conf
options {
        listen-on port 53 { 127.0.0.1; any; };
#       listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { localhost; any; };
        allow-query-cache { localhost; any; };
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

view my_resolver {
        match-clients      { localhost; any; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};

Π˜Π½Ρ„ΠΎΡ€ΠΌΠ°Ρ†ΠΈΡ, относящаяся ΠΊ Π·ΠΎΠ½Π΅, Π΄ΠΎΠ»ΠΆΠ½Π° Π±Ρ‹Ρ‚ΡŒ Π΄ΠΎΠ±Π°Π²Π»Π΅Π½Π° Π² /var/named/chroot/etc/named.rfc1912.zones. Π”ΠΎΠ±Π°Π²ΡŒΡ‚Π΅ записи, ΠΏΡ€ΠΈΠ²Π΅Π΄Π΅Π½Π½Ρ‹Π΅ Π½ΠΈΠΆΠ΅. Π€Π°ΠΉΠ» example.zone β€” это Ρ„Π°ΠΉΠ» Π·ΠΎΠ½Ρ‹ прямого просмотра, Π° example.rzone β€” Ρ„Π°ΠΉΠ» ΠΎΠ±Ρ€Π°Ρ‚Π½ΠΎΠΉ Π·ΠΎΠ½Ρ‹.

Π’ΠΠ–ΠΠžΠ• ΠŸΠ Π˜ΠœΠ•Π§ΠΠΠ˜Π•: Π—ΠΎΠ½Π° ΠΎΠ±Ρ€Π°Ρ‚Π½ΠΎΠ³ΠΎ просмотра содСрТит 1.168.192, ΠΏΠΎΡΠΊΠΎΠ»ΡŒΠΊΡƒ ΠΌΠΎΠΉ IP-адрСс 192.168.1.7

zone "example" IN {
        type master;
        file "example.zone";
        allow-update { none; };
};

zone "1.168.192.in-addr.arpa" IN {
        type master;
        file "example.rzone";
        allow-update { none; };
};

Π€Π°ΠΉΠ»Ρ‹, связанныС с Π·ΠΎΠ½Π°ΠΌΠΈ, находятся здСсь:

# cd /var/named/chroot/var/named/

Π”Π°Π»Π΅Π΅ создадим Ρ„Π°ΠΉΠ»Ρ‹ для прямой ΠΈ ΠΎΠ±Ρ€Π°Ρ‚Π½ΠΎΠΉ Π·ΠΎΠ½Ρ‹. ИмСна Ρ„Π°ΠΉΠ»ΠΎΠ² Π±ΡƒΠ΄ΡƒΡ‚ Ρ‚Π°ΠΊΠΈΠΌΠΈ ΠΆΠ΅, ΠΊΠ°ΠΊ Π²Ρ‹ΡˆΠ΅ Π² Ρ„Π°ΠΉΠ»Π΅ named.rfc1912.zones. Π£ нас ΡƒΠΆΠ΅ Π΅ΡΡ‚ΡŒ нСсколько шаблонов ΠΏΠΎ ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ ΠΌΡ‹ ΠΌΠΎΠΆΠ΅ΠΌ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ.

# cp -p named.localhost  example.zone
# cp -p named.loopback example.rzone

Как Π²ΠΈΠ΄ΠΈΡ‚Π΅, Ρ‚Π΅ΠΊΡƒΡ‰ΠΈΠ΅ Ρ€Π°Π·Ρ€Π΅ΡˆΠ΅Π½ΠΈΡ Π½Π° всС Ρ„Π°ΠΉΠ»Ρ‹ ΠΈ ΠΊΠ°Ρ‚Π°Π»ΠΎΠ³ΠΈ ΠΏΡ€ΠΈΠ½Π°Π΄Π»Π΅ΠΆΠ°Ρ‚ root.

[root@golinuxhub-client named]# ll
total 32
drwxr-xr-x. 2 root root    6 May 22  2017 data
-rw-r--r--. 1 root root  168 May 22  2017 example.rzone
-rw-r--r--. 1 root root  152 May 22  2017 example.zone
-rw-r--r--. 1 root root   56 May 22  2017 my.external.zone.db
-rw-r--r--. 1 root root   56 May 22  2017 my.internal.zone.db
-rw-r--r--. 1 root root 2281 May 22  2017 named.ca
-rw-r--r--. 1 root root  152 May 22  2017 named.empty
-rw-r--r--. 1 root root  152 May 22  2017 named.localhost
-rw-r--r--. 1 root root  168 May 22  2017 named.loopback
drwxr-xr-x. 2 root root   71 Feb 12 21:02 slaves

Π˜Π·ΠΌΠ΅Π½ΠΈΡ‚Π΅ ΠΏΡ€Π°Π²Π° всСх Ρ„Π°ΠΉΠ»ΠΎΠ², ΡƒΠΊΠ°Π·Π°Π² Π² качСствС Π²Π»Π°Π΄Π΅Π»ΡŒΡ†Π° ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Ρ root ΠΈ Π³Ρ€ΡƒΠΏΠΏΡƒ named.

# chown root:named *

Но для data Π²Π»Π°Π΄Π΅Π»Π΅Ρ† Π΄ΠΎΠ»ΠΆΠ΅Π½ Π±Ρ‹Ρ‚ΡŒ named:named.

# chown -R  named:named data
# ls -l
total 32
drwxr-xr-x. 2 named named    6 May 22  2017 data
-rw-r--r--. 1 root  named  168 May 22  2017 example.rzone
-rw-r--r--. 1 root  named  152 May 22  2017 example.zone
-rw-r--r--. 1 root  named   56 May 22  2017 my.external.zone.db
-rw-r--r--. 1 root  named   56 May 22  2017 my.internal.zone.db
-rw-r--r--. 1 root  named 2281 May 22  2017 named.ca
-rw-r--r--. 1 root  named  152 May 22  2017 named.empty
-rw-r--r--. 1 root  named  152 May 22  2017 named.localhost
-rw-r--r--. 1 root  named  168 May 22  2017 named.loopback
drwxr-xr-x. 2 root  named   71 Feb 12 21:02 slaves

Π”ΠΎΠ±Π°Π²ΡŒΡ‚Π΅ ΠΏΡ€ΠΈΠ²Π΅Π΄Π΅Π½Π½ΠΎΠ΅ Π½ΠΈΠΆΠ΅ содСрТимоС Π² Ρ„Π°ΠΉΠ» прямой Π·ΠΎΠ½Ρ‹. Π—Π΄Π΅ΡΡŒ ΠΌΡ‹ создаСм A-запись для localhost (golinuxhub-client) ΠΈ Π΅Ρ‰Π΅ ΠΎΠ΄Π½Ρƒ для сСрвСра (golinuxhub-server).

# vim example.zone
$TTL 1D
@       IN SOA  example. root (
                                        1       ; serial
                                        3H      ; refresh
                                        15M     ; retry
                                        1W      ; expire
                                        1D )    ; minimum

                IN NS           example.

                        IN A 192.168.1.7
golinuxhub-server       IN A 192.168.1.5
golinuxhub-client       IN A 192.169.1.7

Π”Π°Π»Π΅Π΅ Π΄ΠΎΠ±Π°Π²ΡŒΡ‚Π΅ содСрТимоС Π² Ρ„Π°ΠΉΠ» ΠΎΠ±Ρ€Π°Ρ‚Π½ΠΎΠΉ Π·ΠΎΠ½Ρ‹. Π—Π΄Π΅ΡΡŒ ΠΌΡ‹ создаСм PTR-запись для golinuxhub-client ΠΈ для сСрвСра golinuxhub-server.

# vim example.rzone
$TTL 1D
@       IN SOA  example. root.example. (
                                        1997022700      ; serial
                                        28800           ; refresh
                                        14400           ; retry
                                        3600000         ; expire
                                        86400  )        ; minimum

        IN NS   example.
5       IN PTR  golinuxhub-server.example.
7       IN PTR  golinuxhub-client.example.

ΠŸΡ€Π΅ΠΆΠ΄Π΅ Ρ‡Π΅ΠΌ ΠΌΡ‹ запустим сСрвис named-chroot, ΠΏΡ€ΠΎΠ²Π΅Ρ€ΠΈΠΌ ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΡŽ Ρ„Π°ΠΉΠ»Π° Π·ΠΎΠ½Ρ‹.

[root@golinuxhub-client named]# named-checkzone golinuxhub-client.example example.zone
zone golinuxhub-client.example/IN: loaded serial 1
OK

[root@golinuxhub-client named]# named-checkzone golinuxhub-client.example example.rzone
zone golinuxhub-client.example/IN: loaded serial 1997022700
OK

ВсС выглядит Ρ…ΠΎΡ€ΠΎΡˆΠΎ. Π’Π΅ΠΏΠ΅Ρ€ΡŒ ΠΏΡ€ΠΎΠ²Π΅Ρ€ΡŒΡ‚Π΅ Ρ„Π°ΠΉΠ» ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΠΈ, ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΡ ΡΠ»Π΅Π΄ΡƒΡŽΡ‰ΡƒΡŽ ΠΊΠΎΠΌΠ°Π½Π΄Ρƒ.

[root@golinuxhub-client named]# named-checkconf -t /var/named/chroot/ /etc/named.conf

Π˜Ρ‚Π°ΠΊ, всС Π²Ρ‹ΠΏΠΎΠ»Π½Π΅Π½ΠΎ ΡƒΡΠΏΠ΅ΡˆΠ½ΠΎ.

[root@golinuxhub-client named]# echo $?
0

Π’ΠΠ–ΠΠžΠ• ΠŸΠ Π˜ΠœΠ•Π§ΠΠΠ˜Π•: Ρƒ мСня SELinux находится Π² Ρ€Π΅ΠΆΠΈΠΌΠ΅ permissive

# getenforce
Permissive

ВсС выглядит Ρ…ΠΎΡ€ΠΎΡˆΠΎ, Ρ‚Π°ΠΊ Ρ‡Ρ‚ΠΎ ΠΏΠΎΡ€Π° Π·Π°ΠΏΡƒΡΠΊΠ°Ρ‚ΡŒ наш сСрвис named-chroot .

[root@golinuxhub-client named]# systemctl restart named-chroot

[root@golinuxhub-client named]# systemctl status named-chroot
● named-chroot.service - Berkeley Internet Name Domain (DNS)
   Loaded: loaded (/usr/lib/systemd/system/named-chroot.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2018-02-12 21:53:23 IST; 19s ago
  Process: 5236 ExecStop=/bin/sh -c /usr/sbin/rndc stop > /dev/null 2>&1 || /bin/kill -TERM $MAINPID (code=exited, status=0/SUCCESS)
  Process: 5327 ExecStart=/usr/sbin/named -u named -c ${NAMEDCONF} -t /var/named/chroot $OPTIONS (code=exited, status=0/SUCCESS)
  Process: 5325 ExecStartPre=/bin/bash -c if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -t /var/named/chroot -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi (code=exited, status=0/SUCCESS)
 Main PID: 5330 (named)
   CGroup: /system.slice/named-chroot.service
           └─5330 /usr/sbin/named -u named -c /etc/named.conf -t /var/named/chroot

Feb 12 21:53:23 golinuxhub-client.example named[5330]: managed-keys-zone/my_resolver: loaded serial 0
Feb 12 21:53:23 golinuxhub-client.example named[5330]: zone 0.in-addr.arpa/IN/my_resolver: loaded serial 0
Feb 12 21:53:23 golinuxhub-client.example named[5330]: zone 1.0.0.127.in-addr.arpa/IN/my_resolver: loaded serial 0
Feb 12 21:53:23 golinuxhub-client.example named[5330]: zone 1.168.192.in-addr.arpa/IN/my_resolver: loaded serial 1997022700
Feb 12 21:53:23 golinuxhub-client.example named[5330]: zone example/IN/my_resolver: loaded serial 1
Feb 12 21:53:23 golinuxhub-client.example named[5330]: zone localhost/IN/my_resolver: loaded serial 0
Feb 12 21:53:23 golinuxhub-client.example named[5330]: zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN/my_resolver: loaded serial 0
Feb 12 21:53:23 golinuxhub-client.example named[5330]: zone localhost.localdomain/IN/my_resolver: loaded serial 0
Feb 12 21:53:23 golinuxhub-client.example named[5330]: all zones loaded
Feb 12 21:53:23 golinuxhub-client.example named[5330]: running
```bash
Π£Π±Π΅Π΄ΠΈΡ‚Π΅ΡΡŒ, Ρ‡Ρ‚ΠΎ resolv.conf содСрТит ваш IP-адрСс, Ρ‡Ρ‚ΠΎΠ±Ρ‹ ΠΎΠ½ ΠΌΠΎΠ³ Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π² качСствС DNS-сСрвСра.
```bash
# cat /etc/resolv.conf
search example
nameserver 192.168.1.7
```bash
Π”Π°Π²Π°ΠΉΡ‚Π΅ ΠΏΡ€ΠΎΠ²Π΅Ρ€ΠΈΠΌ наш DNS-сСрвСр для ΠΎΠ±Ρ€Π°Ρ‚Π½ΠΎΠΉ Π·ΠΎΠ½Ρ‹, ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΡ dig.
```bash
[root@golinuxhub-client named]# dig -x 192.168.1.5

; <<>> DiG 9.9.4-RedHat-9.9.4-50.el7 <<>> -x 192.168.1.5
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40331
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;5.1.168.192.in-addr.arpa.      IN      PTR

;; ANSWER SECTION:
5.1.168.192.in-addr.arpa. 86400 IN      PTR     golinuxhub-server.example.

;; AUTHORITY SECTION:
1.168.192.in-addr.arpa. 86400   IN      NS      example.

;; ADDITIONAL SECTION:
example.                86400   IN      A       192.168.1.7

;; Query time: 1 msec
;; SERVER: 192.168.1.7#53(192.168.1.7)
;; WHEN: Mon Feb 12 22:13:17 IST 2018
;; MSG SIZE  rcvd: 122

Как Π²Ρ‹ Π²ΠΈΠ΄ΠΈΡ‚Π΅, ΠΌΡ‹ ΠΏΠΎΠ»ΡƒΡ‡ΠΈΠ»ΠΈ ΠΏΠΎΠ»ΠΎΠΆΠΈΡ‚Π΅Π»ΡŒΠ½Ρ‹ΠΉ ΠΎΡ‚Π²Π΅Ρ‚ (ANSWER) Π½Π° наш запрос (QUERY).

[root@golinuxhub-client named]# dig -x 192.168.1.7

; <<>> DiG 9.9.4-RedHat-9.9.4-50.el7 <<>> -x 192.168.1.7
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55804
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;7.1.168.192.in-addr.arpa.      IN      PTR

;; ANSWER SECTION:
7.1.168.192.in-addr.arpa. 86400 IN      PTR     golinuxhub-client.example.

;; AUTHORITY SECTION:
1.168.192.in-addr.arpa. 86400   IN      NS      example.

;; ADDITIONAL SECTION:
example.                86400   IN      A       192.168.1.7

;; Query time: 1 msec
;; SERVER: 192.168.1.7#53(192.168.1.7)
;; WHEN: Mon Feb 12 22:12:54 IST 2018
;; MSG SIZE  rcvd: 122

Π’ΠΎΡ‡Π½ΠΎ Ρ‚Π°ΠΊ ΠΆΠ΅ ΠΌΡ‹ ΠΌΠΎΠΆΠ΅ΠΌ ΠΏΡ€ΠΎΠ²Π΅Ρ€ΠΈΡ‚ΡŒ ΠΏΡ€ΡΠΌΡƒΡŽ Π·ΠΎΠ½Ρƒ.

[root@golinuxhub-client named]# nslookup golinuxhub-client.example
Server:         192.168.1.7
Address:        192.168.1.7#53

Name:   golinuxhub-client.example
Address: 192.169.1.7

[root@golinuxhub-client named]# nslookup golinuxhub-server.example
Server:         192.168.1.7
Address:        192.168.1.7#53

Name:   golinuxhub-server.example
Address: 192.168.1.5

Π­Ρ‚Π° ΡΡ‚Π°Ρ‚ΡŒΡ Π½Π΅ΠΌΠ½ΠΎΠ³ΠΎ устарСла, Ρ‚Π°ΠΊ ΠΊΠ°ΠΊ Π² RHEL 7 Ρ‚Π΅ΠΏΠ΅Ρ€ΡŒ Π½Π΅ Π½ΡƒΠΆΠ½ΠΎ ΠΊΠΎΠΏΠΈΡ€ΠΎΠ²Π°Ρ‚ΡŒ Ρ„Π°ΠΉΠ»Ρ‹ ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΠΈ bind Π² chroot. Step-by-Step Tutorial: Configure DNS Server using bind chroot (CentOS/RHEL 7).

Π˜ΡΡ‚ΠΎΡ‡Π½ΠΈΠΊ: habr.com