1 つのバインド サーバーで親ドメインと子ドメインをホストすることは可能ですか?

1 つのバインド サーバーで親ドメインと子ドメインをホストすることは可能ですか?

注:これは前回の質問保留され、より明確にするために言い換えるよう求められました(これでより意味が伝わることを願っています)


単一の DNS サーバーがbindインストールされており、親ドメイン ( example.org) と 2 つのサブドメイン (cnc.example.orgおよびreport.example.org) をホストするように設定して、いずれかのドメイン内のデバイスが単一の DNS サーバーによって処理される DNS クエリを持つことができるようにしたいと考えています。

私の最初の質問は、これは可能でしょうか?

もしそうなら、なぜ次のエラーが表示されるのでしょうか?

nslookup host1私がドメインから行うと、report.example.org私は受け取ります

server can't find host1: SERVFAIL

nslookup host2私がドメインから行うと、cnc.example.org私は受け取ります

server can't find host1: SERVFAIL

ネットワークトポロジー

次のように設定します。

ホスト1:

  • 192.168.252.21/24 のIPアドレス
  • 192.168.252.22 のDNS
  • /etc/hosts含むhost1.cnc.example.org

ホスト2:

  • 192.168.252.20/24 のIPアドレス
  • 192.168.252.22 のDNS
  • /etc/hosts含むhost2.report.example.org

DNSサーバー:

  • 192.168.252.22/24 のIPアドレス
  • 127.0.0.1 のDNS
  • /etc/hosts含むDNSServer.example.org

named.conf.local構成

/
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

zone "example.org" {
    type master;
    file "/etc/bind/zones/example.org";
#    allow-transfer { 192.168.252.22; };
};

zone "cnc.example.org" {
    type master;
    file "/etc/bind/zones/cnc.example.org";
#    allow-transfer { 192.168.252.22; };
};

zone "report.example.org" {
    type master;
    file "/etc/bind/zones/report.example.org";
#    allow-transfer { 192.168.252.22; };
};

zone "252.168.192.in-appr.arpa" {
     type master;
     file "/etc/bind/zones/reverse/rev.252.168.192";
     allow-transfer { 192.168.252.22; };
};

example.org構成

;
; BIND data for example.org or report.example.org
;
$TTL 3h
@           IN  SOA DNSServer.example.org.  root.example.org. (
                        1       ; serial
                        3h      ; refresh
                        1h      ; retry
                        1w      ; expire
                        1h )    ; minimum
;
; main domain name servers - NS records
                    IN  NS  DNSServer.example.org.


; main domain name servers - A records
DNSServer               IN  A   192.168.252.22


;delegated zones
cnc.example.org.                IN  NS  DNSServer.example.org.
report.example.org.         IN  NS  DNSServer.example.org.

* DNSServer 上の /etc/resolv.conf からの出力 *

  # Generated by NetworkManager
    search example.org
    nameserver 127.0.0.1

* ホスト1の/etc/resolv.confからの出力 *

 # Generated by NetworkManager
    search report.example.org
    nameserver 192.168.252.22

* ホスト2の/etc/resolv.confからの出力 *

  # Generated by NetworkManager
    search cnc.example.org
    nameserver 192.168.252.22

* DNSServer 上の dig DNSServer からの出力 *

root@DNSServer:/etc/bind/zones/reverse# dig DNSServer

; <<>> DiG 9.10.3-P4-Debian <<>> DNSServer
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 45573
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;DNSServer.         IN  A

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Nov 27 10:47:23 GMT 2017
;; MSG SIZE  rcvd: 38

* dig DNSServer.example.org を使用した出力 *

   root@DNSServer:/home/osboxes# dig DNSServer.example.org

    ; <<>> DiG 9.10.3-P4-Debian <<>> DNSServer.example.org
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12335
    ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 4096
    ;; QUESTION SECTION:
    ;DNSServer.example.org.     IN  A

    ;; ANSWER SECTION:
    DNSServer.example.org.  10800   IN  A   192.168.252.22

    ;; AUTHORITY SECTION:
    example.org.        10800   IN  NS  DNSServer.example.org.

    ;; Query time: 0 msec
    ;; SERVER: 127.0.0.1#53(127.0.0.1)
    ;; WHEN: Mon Nov 27 11:01:19 GMT 2017
    ;; MSG SIZE  rcvd: 79

* DNSServer の dig host1 からの出力 *

root@DNSServer:/etc/bind/zones/reverse# dig host1

; <<>> DiG 9.10.3-P4-Debian <<>> host1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 19414
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;host1.         IN  A

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Nov 27 10:48:15 GMT 2017
;; MSG SIZE  rcvd: 40

cnc.example.org構成

;
; BIND data for example.org or report.example.org
;
$TTL 3h
@           IN  SOA DNSServer.example.org.  root.example.org. (
                        1       ; serial
                        3h      ; refresh
                        1h      ; retry
                        1w      ; expire
                        1h )    ; minimum
;
; main domain name servers - NS records
@                   IN  NS  DNSServer.example.org.


; main domain name servers - A records
;DNSServer              IN  A   192.168.252.22


;192.168.252.0/24 - A Records
host1.cnc.example.org.      IN  A   192.168.252.21

report.example.org構成

;
; BIND data for example.org or report.example.org
;
$TTL 3h
@           IN  SOA DNSServer.example.org.  root.example.org. (
                        1       ; serial
                        3h      ; refresh
                        1h      ; retry
                        1w      ; expire
                        1h )    ; minimum
;
; main domain name servers - NS records
@                   IN  NS  DNSServer.example.org.

; main domain name servers - A records
DNSServer               IN  A   192.168.252.22

;192.168.252.0/24 - A Records
host2.report.example.org.   IN  A   192.168.252.20

ありがとう

答え1

委任を使用することもできますが、本当に必要な場合を除いて、シンプルにして、、、example.orgおよびcnc.example.orgを含む 1 つのゾーンを使用することをお勧めしますreport.example.org

;
; BIND data for example.org
;
$TTL 3h
@           IN  SOA DNSServer.example.org.  root.example.org. (
                        1       ; serial
                        3h      ; refresh
                        1h      ; retry
                        1w      ; expire
                        1h )    ; minimum
;
; main domain name servers - NS records
                    IN  NS  DNSServer.example.org.

; main domain name servers - A records
DNSServer           IN  A  192.168.252.22

; public targets
cnc                 IN  CNAME  host1.cnc
report              IN  CNAME  host2.report

; hosts delivering services
host1.cnc           IN  A   192.168.252.21
host2.report        IN  A   192.168.252.20

コメントから引用:

DNSサーバー上で私がそうするとnslookup host1

root@host1:/home/osbixes# nslookup host2
Server: 127.0.0.1
Address 127.0.0.1#53
** server can’t find host2: SERVFAIL

DNSServer には検索パスがありませんが、ドメインは ですexample.org。つまり、すべての非修飾名はそのドメイン内にある必要があります。 はないhost2.example.orgので、は正しく応答を返すことができません。この場合、のを にnslookup置き換えるか、 を検索する必要があります。domain example.org/etc/resolv.confsearch example.org report.example.orgnslookup host2.report

ホスト1またはホスト2から

root@host1:/home/osbixes# nslookup host2
Server: 192.168.252.22
Address 192.168.252.22#53
** server can’t find host2: SERVFAIL

同じ理由です。 のドメイン (検索パス) に を/etc/resolv.conf保持するコンポーネントが含まれていないため、host2修飾nslookupされていない名前はhost2どこにも表示されません。

ホスト1とホスト2のファイルは、まだ存在するはず/etc/hostsです。/etc/hostnamehost1.cnc.example.orghost2.report.example.org

/etc/hostsを にすべきだとおっしゃっている意味がよくわかりませんhost1.cnc.example.org/etc/hostsファイルは、ホスト名と IP アドレスをマッピングする別の方法です。ホスト名が 2 つまたは 3 つしかない場合は、内部 DNS の複雑さを避けて、それらのエントリを に入れたほうがよいでしょう。一方、ホストの数が妥当な場合は、DNS はローカル ネットワークに適した集中型ソリューションです。(ただし、 は意図的に無視される/etc/hostsことに注意してください。)nslookup/etc/hosts

どちらかのホストからIPアドレスを正しく解決するnslookup host1.cnc.example.orgnslookup host2.report.example.org

はい。完全修飾名を指定しました。これはnslookup(およびbind) 正しく解決できます。これは、いずれかの DNS が正常に動作していることを証明します。

example.orgおよびのクエリを処理するための単一の DNS サーバーが必要です。新しいデバイスがネットワークに通信して新しいコマンドの実行を要求すると、クエリが実行され(192.168.252.21)にリダイレクトされますcnc.example.orgが、レポートをネットワークに送り返す場合はドメインをクエリして(192.168.252.20)にリダイレクトされます。report.example.orgcnc.example.orghost1.cnc.example.orgreport.example.orghost2.report.example.org

これを行うには、CNAMEDNS で (エイリアス) レコードを使用して、 のクエリがreport.example.orgホスト にマップされるようにします。 をと呼ぶべきではないというhost2.report.example.org技術的な理由は質問にないことに注意してください。レコードは、現在の (サブ) ドメイン内のホストだけでなく、任意の場所を指すことができます。host2host2.example.orgCNAME

答え2

はいただし、サブドメイン用に個別の構成を作成する必要はありません。

.末尾のA は完全なドメイン名を意味し、 A がない.場合は元のドメインのサブドメインを意味します。

cnc.example.com構成内のみにこのようなエントリを追加しますexample.com

host1.cnc      IN  A   192.168.252.21    

したがって、次のアップデートが必要です

  1. 削除cnc.example.orgreport.example.comnamed.conf.local
  2. .親ドメインの設定に、末尾にアットマークのないサブドメインに対応するすべてのエントリを追加します。次のように、親のゾーンで明示的に記述することもできます。

    host1.cnc.example.com.  IN A  192.168.252.21
    
  3. cnc.example.comおよびに対応するゾーン ファイルを削除しreport.example.comBINDサーバーを再起動します。

関連情報