하나의 바인드 서버에서 상위 및 하위 도메인을 호스팅할 수 있습니까?

하나의 바인드 서버에서 상위 및 하위 도메인을 호스팅할 수 있습니까?

NB 이것은 다음의 재게시물입니다:내 이전 질문, 보류되었으며 더 나은 명확성을 위해 다시 말하도록 요청되었습니다(이것이 더 의미가 있기를 바랍니다).


단일 DNS 서버가 설치되어 있는데 bind, 상위 도메인( example.org)과 두 개의 하위 도메인( cnc.example.orgreport.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:

  • IP 192.168.252.21/24
  • DNS 192.168.252.22
  • /etc/hosts포함host1.cnc.example.org

호스트2:

  • IP 192.168.252.20/24
  • DNS 192.168.252.22
  • /etc/hosts포함host2.report.example.org

DNS서버:

  • IP 192.168.252.22/24
  • DNS 127.0.0.1
  • /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 호스트1에서 출력 *

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좋습니다 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

의견 인용:

내가 할 때 DNSServer에서 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

Host1 또는 Host2에서 나는 다음을 얻습니다.

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없습니다 .nslookuphost2

나는 호스트1과 호스트2의 /etc/hosts/etc/hostname파일이 여전히 있어야 한다고 가정합니다 host1.cnc.example.org.host2.report.example.org

/etc/hosts나는 당신이 그렇게 해야 한다고 말할 때 무슨 뜻인지 전혀 모릅니다 host1.cnc.example.org. 이 /etc/hosts파일은 호스트 이름과 IP 주소를 매핑하는 대체 방법입니다. 호스트 이름이 2~3개만 있는 경우 내부 DNS의 복잡성을 피하고 해당 항목을 /etc/hosts. 반면에 호스트 수가 적당하다면 DNS는 로컬 네트워크에 대한 좋은 중앙 집중식 솔루션입니다. (그러나 이는 nslookup의도적으로 을 무시한다는 점을 명심하십시오 /etc/hosts.)

내가 수행할 때 호스트 중 하나에서 IP 주소를 올바르게 확인합니다 nslookup host1.cnc.example.org.nslookup host2.report.example.org

예. nslookup(및 bind) 정확하게 확인할 수 있는 정규화된 이름을 제공했습니다 . 이는 두 DNS 중 하나가 제대로 작동하고 있음을 증명합니다.

모든 쿼리를 처리하려면 단일 DNS 서버가 필요하며 새 장치가 실행할 새 명령을 요청하기 위해 네트워크와 다시 통신할 때 쿼리하고 ( example.org192.168.252.21 ) 로 연결되지만 보고서를 보내려고 할 때 네트워크로 돌아가서 도메인을 쿼리 하고 (192.168.252.20) 로 연결됩니다 .cnc.example.orgreport.example.orgcnc.example.orghost1.cnc.example.orgreport.example.orghost2.report.example.org

이를 수행하려면 CNAMEDNS의 (별칭) 레코드를 사용하여 에 대한 쿼리가 report.example.org호스트에 매핑되도록 합니다 host2.report.example.org. 귀하의 질문에 왜 host2전화해서는 안되는 기술적 이유가 없습니다 host2.example.org. CNAME레코드는 현재 (하위)도메인의 호스트뿐만 아니라 어디든 가리킬 수 있습니다.

답변2

. 그러나 하위 도메인에 대해 별도의 구성을 만들 필요는 없습니다.

.끝에 붙은 A는 전체 도메인 이름을 의미하고, 끝에 붙은 A .는 원래 도메인의 하위 도메인을 의미합니다.

cnc.example.com구성 에서만 이와 같은 항목을 추가하십시오 example.com.

host1.cnc      IN  A   192.168.252.21    

따라서 다음 업데이트가 필요합니다.

  1. 제거 cnc.example.orgreport.example.com다음에서named.conf.local
  2. .상위 도메인 구성의 끝에 끝에가 없는 하위 도메인에 해당하는 모든 항목을 추가합니다 . 다음과 같이 부모 영역에서 명시적으로 언급할 수도 있습니다.

    host1.cnc.example.com.  IN A  192.168.252.21
    
  3. cnc.example.com및 해당 영역 파일을 제거 report.example.com하고 서버를 다시 시작합니다 BIND.

관련 정보