-2

could someone explain to me what i am doing wrong, or it is just impossible to do. Just for learning, and understading how subdomain delegation works.

I have 1 domain eg.: server.com and 3 VPS servers, what i am trying to do is set custom name servers with subdomain.server.com to VPS servers like eg.: ns1.vps2.server.com ns2.vps2.server.com that users on hosting panel could manage DNS settings.

Domain server.com works on ns1.server.com ns2.server.com on 1vps vps1.server.com, some domains changed to ns1.server.com and ns2.server.com NS is changed and works, all DNS can be changed for them from vps1 hosting DNS zone.

For VPS2 and VPS3 i can't make it work.

What i have made on VPS1 where server.com domain is hosted

www.server.com. CNAME  server.com.
vps1.server.com. A  1.1.1.1
vps2.server.com. A  2.2.2.2

ns1.server.com. A  1.1.1.1
ns2.server.com. A  1.1.1.2

server.com. NS  ns1.server.com.
server.com. NS  ns2.server.com.

ns1.vps2.server.com. A  2.2.2.2
ns2.vps2.server.com. A  2.2.2.3

vps2.server.com. NS  ns1.vps2.server.com.
vps2.server.com. NS  ns2.vps2.server.com.

SUCCESS: Getting information for Domain 'server.com' complete.

^ But this configuration doesn't work ^

When using nslookup on ns1.vps2.server.com

router.asus.com can't find ns1.vps2.server.com: Server failed

When using nslookup on server.com

server.com nameserver=ns1.server.com
server.com nameserver=ns2.server.com

Could someone help me with this situation? Maybe someone will find out what i am doing wrong with this.

VPS2 named.conf

// $Id: named.conf,v 1.1.1.1 2001/10/15 07:44:36 kap Exp $

// -- THE FOLLOWING LINES WERE GENERATED BY PLESK. IF YOU MODIFY THEM, THEY WILL BE OVERWRITTEN WHEN THESE SETTINGS ARE MANAGED IN PLESK UI. --
options {
    allow-recursion {
        any;
    };
        listen-on-v6 { any; };
    version "none";
    directory "/var";
    auth-nxdomain no;
    pid-file "/var/run/named/named.pid";
};

key "rndc-key" {
    algorithm hmac-md5;
    secret "20nyv==";
};

controls {
    inet 127.0.0.1 port 953
    allow { 127.0.0.1; } keys { "rndc-key"; };
};

zone "." {
    type hint;
    file "named.root";
};

zone "0.0.127.IN-ADDR.ARPA" {
    type master;
    file "localhost.rev";
};
// -- END OF LINES GENERATED BY PLESK. --


// -- PLEASE ADD YOUR CUSTOM DIRECTIVES BELOW THIS LINE. --
// ...
// -- END OF YOUR CUSTOM DIRECTIVES. --


// -- ALL LINES BELOW WERE GENERATED BY PLESK. IF YOU MODIFY THEM, THEY WILL BE OVERWRITTEN WHEN THESE SETTINGS ARE MANAGED IN PLESK UI. --

zone "vps2.server.com" {
    type master;
    file "vps2.server.com";
    allow-transfer {
        common-allow-transfer;
    };
};
acl common-allow-transfer {
    none;
};

VPS2 named zone /var/named/...vps2.server.com

; *** This file is automatically generated by Plesk ***
$TTL    300

@       IN      SOA     ns1.vps2.server.com. server.server.com. (
                        2020080553      ; Serial
                        18000   ; Refresh
                        3600    ; Retry
                        604800  ; Expire
                        10800 ) ; Minimum

vps2.server.com.            IN NS   ns2.vps2.server.com.
vps2.server.com.            IN NS   ns1.vps2.server.com.
ns2.vps2.server.com.                IN A    1.1.1.2
ipv4.vps2.server.com.               IN A    1.1.1.1
mail.vps2.server.com.               IN A    1.1.1.1
webmail.vps2.server.com.            IN A    1.1.1.1
ns1.vps2.server.com.                IN A    1.1.1.1
www.vps2.server.com.                IN CNAME        vps2.server.com.
ftp.vps2.server.com.                IN CNAME        vps2.server.com.
vps2.server.com.            IN MX  10 mail.vps2.server.com.
vps2.server.com.            IN TXT  "v=spf1 +a +mx +a:vps2.server.com -all"
_dmarc.vps2.server.com.             IN TXT  "v=DMARC1; p=none"
_imaps._tcp.vps2.server.com.                IN SRV 0 0 993 vps2.server.com.
_pop3s._tcp.vps2.server.com.                IN SRV 0 0 995 vps2.server.com.
_smtps._tcp.vps2.server.com.                IN SRV 0 0 465 vps2.server.com.

VPS1 named zone /var/named/...vps2.server.com

; *** This file is automatically generated by Plesk ***
$TTL    300

@       IN      SOA     ns1.vps2.server.com. server.server.com. (
                        2020080576      ; Serial
                        60      ; Refresh
                        300     ; Retry
                        604800  ; Expire
                        1 )     ; Minimum

vps2.server.com.            IN NS   ns2.vps2.server.com.
vps2.server.com.            IN NS   ns1.vps2.server.com.
ns1.vps2.server.com.                IN A    1.1.1.1
ns2.vps2.server.com.                IN A    1.1.1.2
vps2.server.com.            IN A    1.1.1.1
www.vps2.server.com.                IN CNAME        vps2.server.com.
vps2.server.com.            IN MX  10 vps2.server.com.

From VPS2 $dig vps2.server.com

root@vps2:~# dig vps2.server.com

; <<>> DiG 9.10.3-P4-Debian <<>> vps2.server.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29912
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;vps2.server.com.                  IN      A

;; ANSWER SECTION:
vps2.server.com.           299     IN      A       1.1.1.1

;; Query time: 28 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Aug 06 07:57:31 EEST 2020
;; MSG SIZE  rcvd: 57

From VPS1 $dig vps2.server.com

root@vps2:~# dig vps2.server.com

; <<>> DiG 9.10.3-P4-Debian <<>> vps2.server.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45514
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3

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

;; ANSWER SECTION:
vps2.server.com.           68      IN      A       1.1.1.1

;; AUTHORITY SECTION:
vps2.server.com.           68      IN      NS      ns1.vps2.server.com.
vps2.server.com.           68      IN      NS      ns2.vps2.server.com.

;; ADDITIONAL SECTION:
ns1.vps2.server.com.       68      IN      A       1.1.1.1
ns2.vps2.server.com.       68      IN      A       1.1.1.2

;; Query time: 0 msec
;; SERVER: 80.208.229.143#53(80.208.229.143)
;; WHEN: Thu Aug 06 07:58:59 EEST 2020
;; MSG SIZE  rcvd: 125
zte813
  • 3
  • 5
  • Please show how things are actually stored e.g. in zone files. If you're using bind then `ns?.vps2.server.com` would need a dot at the end, `ns?.vps2.server.com.` – tater Aug 05 '20 at 11:23
  • @tetech yes in DNS zone every ns?.vps2.server.com. added domain server.com is on vps1.server.com hosting server and every vps2 records is added there. But still I can't lookup NS it gives error *** router.asus.com can't find ns1.vps2.server.com: Server failed – zte813 Aug 05 '20 at 12:42
  • To be even more explicit, please edit the question to show the zone file. – tater Aug 05 '20 at 13:12
  • @tetech edited. – zte813 Aug 05 '20 at 14:05
  • You need to post the actual zone files, named.conf contains only the server configuration; the error most likely is in the zone contents for VPS2. – Massimo Aug 05 '20 at 17:26
  • @Massimo, could you explain what records i must setup in server to be able to change domain name servers to our own? – zte813 Aug 05 '20 at 18:38
  • @itboxpaslaugos yes, I could; but not without seeing your actual zone files, which you didn't post. – Massimo Aug 05 '20 at 20:22
  • @Massimo added zone files in post and dig command results from VPS1 and VPS2 – zte813 Aug 06 '20 at 05:01

2 Answers2

0

The problem is most likely not in the zone file on vps1, but in your zone file on vps2.

Bind on vps2 will need to be configured with a zone file for vps2.server.com and have the appropriate block in named.conf. The A records for ns?.vps2.server.com are merely glue records.

tater
  • 1,395
  • 2
  • 9
  • 12
  • These settings on VPS1 about vps.server.com also added on VPS2, subdomain added also. `> set type=A > ns1.vps2.server.com Server: router.asus.com Address: 192.168.1.1 *** router.asus.com can't find ns1.vps2.server.com: Non-existent domain}` – zte813 Aug 05 '20 at 16:16
  • OK, as you're not disclosing the config files I won't keep guessing. Hopefully someone else can help. – tater Aug 05 '20 at 16:46
  • added named.conf file results in post. – zte813 Aug 05 '20 at 16:55
  • You need to post the actual zone files, named.conf contains only the server configuration; the error most likely is in the zone contents for VPS2. – Massimo Aug 05 '20 at 17:26
0

Solved. Everything works fine now.

Problem was that i have added vps2.server.com records in server.com domain DNS zone.

Solution is if someone is using panels like: plesk, cpanel, vestacp etc... create SUB-DOMAIN, do not create DNS records in main domain eg. server.com Zone.

Thank you all.

zte813
  • 3
  • 5
  • 1
    ...and you still didn't post any content from a zone file. I'm glad you solved your problem, but this Q&A isn't really of any value to anyone else but you. – Massimo Aug 05 '20 at 20:24
  • 1
    BTW, "if someone is using panels like: plesk, cpanel, vestacp etc"... then it's OT here. – Massimo Aug 05 '20 at 20:25
  • @Massimo pasted contents in post ^. Have some questions...: 1) Is it normal that SOA, A record, other DNS recors works from VPS1 and not from VPS2? 2) Could you explain what records i have to show in server to be able to change domain NS? Because when i try to change them on registar panel it gives me error that not all records are published on 1.1.1.1 server, to be able to manage your domain. – zte813 Aug 06 '20 at 04:56
  • @Massimo adding records from dig now in post – zte813 Aug 06 '20 at 04:56