server_dns.exe: DNS Zone Template

The server_dns.exe utility is used to manage Plesk server's DNS zone template. Using this utility, you can perform the following tasks:

  • adding resource records to or replacing already existing resource records with new ones in Plesk server's DNS zone template
  • specifying the status to be set for a domain's DNS zone upon creation of a domain
  • modifying SOA record for the DNS zone template
  • setting Plesk name server DNS zone preferences regarding recursive DNS queries from different types of hosts
  • managing the Access control list (ACL records)

Location

%plesk_cli%

Usage
server_dns.exe <command> [
<option_1> [<param>]
[<option_2> [<param>]]
... [<option_N> [<param>]]
]

Example

The following command adds the following two resource records to the domain DNS zone template, while removing all pre-existing resource records from the domain DNS zone template:

  • new MX resource record <domain> specifying mail.<domain> as the mail exchanger for the record, and setting the mail exchanger's priority to 15.
  • new NS resource record <domain> setting domain ns.<domain> as the name server.

    server_dns.exe --set "MX,"",mail.<domain>,15;NS,"",ns.<domain>"

Commands
Command Parameter Description Example

--add or -a

 

Adds a resource record to the Plesk server's DNS zone template.

If a record already exists, the command returns code 2.

To add a MX resource record mail.<domain> to the domain DNS zone template and specify mail exchanger mail.<domain> and set the mail exchanger priority to 35 for the record:

server_dns.exe --add -mx "" -mailexchanger "mail.<domain>" -priority 35

or

server_dns.exe -a -mx "" -mailexchanger "mail.<domain>" -priority 35

--set or -s

"<record_1>;<record_2>;...<record_N>"

where <record> =

NS,<<subdomain-prefix>|>,<<name-server-FQDN>|<prefix>.<domain>.>

A,<<subdomain-prefix>|>,<<IP-address>|<ip>>

MX,<<subdomain-prefix>|>,<<mail-exchanger-name>|<prefix>.<domain>.>,<priority>

PTR,<<IP-address>|<ip>>,<<subdomain-prefix>|>,<subnet_mask>

CNAME,<<subdomain-prefix>|>,<<canonical_domain_name>|<domain>.>

SRV,<_service>.<_tcp|_udp>.<<subdomain-prefix>|>,<target_host>,<priority> <weight <port>

TXT,<<subdomain-prefix>|>,<text>

Adds specified resource records to and removes all pre-existing resource records from the Plesk server's DNS zone template.

For more details, consult descriptions of the options in the following table for adding resource records of respective types individually.

To add the following DNS zone template file to Plesk (for the presentation sake, we added the ".<domain>." part to hosts like "ns.<domain>." which normally are just "ns" in real zone files):

HOSTRR typeVALUE

<domain>.NSns.<domain>.

ns.<domain>.A<ip>

<domain>.A<ip>

webmail.<domain>.A<ip>

<domain>.MX10 mail.<domain>.

mail.<domain>.A<ip>

ftp.<domain>.CNAME<domain>.

<ip>/24PTR<domain>.

<domain>.TXTf1 +a +mx -all

_SIP._tcp.megadomain.<domain>.SRV5 25 12 example.com.

server_dns.exe --set "NS,,ns.<domain>.;A,ns,<ip>;A,,<ip>;A,webmail,<ip>;MX,,mail.<domain>.,10;A,mail,<ip>;CNAME,ftp,<domain>.;PTR,<ip>,,24;TXT,,v=spf1 +a +mx -all;SRV,_SIP._tcp.megadomain,example.com,5 25 12;"

or

server_dns.exe -s "NS,,ns.<domain>.;A,ns,<ip>;A,,<ip>;A,webmail,<ip>;MX,,mail.<domain>.,10;A,mail,<ip>;CNAME,ftp,<domain>.;PTR,<ip>,,24;TXT,,v=spf1 +a +mx -all;SRV,_SIP._tcp.megadomain,example.com,5 25 12;"

--update-server or -u

 

Modifies the Plesk server's DNS server settings.

To enable support for recursive DNS queries for hosts on the local network only:

server_dns.exe -u -recursion localnets

--update-soa

 

Modifies the SOA record in the Plesk server's DNS zone template.

To set the TTL parameter to 5 hours for the SOA record for the DNS zone template:

server_dns.exe --update-soa -soa-ttl 5H

--info or -i

 

Displays the Plesk server's DNS server records.

server_dns.exe --info

--enable-custom-backend

<path to the integration script>

Enables Plesk integration with a third-party DNS using the specified script for the integration.

To switch on Plesk integration with a third-party DNS service:

server_dns.exe --enable-custom-backend "C:\customdns\route53.php

--disable-custom-backend

 

Disables Plesk integration with a third-party DNS.

To switch off Plesk integration with a third-party DNS service:

server_dns.exe --disable-custom-backend

--help or -h

 

Displays help on the use of the utility.

server_dns.exe --help

or

server_dns.exe -h

Options
Option Parameter Description Example

-recursion

any|localnets|localhost

Sets the Plesk name server DNS zone preferences:

  • any - will support recursive DNS queries for any requesting host.
  • localnets - will support recursive DNS queries for any host on the local network only.
  • localhost - will support recursive DNS queries for the local host only

Used with the --update-server command only.

To enable support for recursive DNS queries for hosts on the local network only:

server_dns.exe -u -recursion localnets

-status

enabled|disabled

Sets the status of a domain's DNS zone when the DNS zone is created upon the domain creation.

Only newly created domains will inherit the DNS zone status.

Used with the --update-server command only.

To disable domain DNS zones for newly created domains:

server_dns.exe -u -status disabled

-add-acl

<IP address 1>[[/<subnet mask>],<IP address 2>[/<subnet mask>],...<IP address N>[/<subnet mask>]]

Adds host or network IP addresses to the Access Control list (ACL).

To add records 192.0.2.78 and 192.0.2.0/24 to the ACL:

server_dns.exe -u -add-acl 192.0.2.78,192.0.2.0/24

-a

''|<subdomain name>

Specifies the A type resource record for a subdomain in the Plesk server's DNS zone template.

Used with the --add.

Requires the -ip option.

To add an A resource record sample.<domain> (specifying a placeholder for a domain IP address for the record) to the domain DNS zone template:

server_dns.exe -a -a sample -ip "<ip>"

-aaaa

''|<subdomain name>

Specifies the AAAA type resource record for a subdomain in the Plesk server's DNS zone template.

Used with the --add.

Requires the -ip option.

-ip

<IP address>|"<ip>"

Specifies an IP address or a placeholder for a domain's IP address for creating an A type resource record in the Plesk server's DNS zone template.

Used only with the --add command.

-ns

''|<subdomain name>

Specifies the NS type resource record in the Plesk server's DNS zone template.

Used only with the --add command.

Requires the -nameserver option.

To add an NS resource record <domain> specifying domain name <domain> as the name server to the DNS zone template:

server_dns.exe -a -ns "" -nameserver "ns.<domain>"

-nameserver

<domain name>

Specifies the name of a nameserver or a placeholder for creating an NS type resource record in the Plesk server's DNS zone template.

 

-mx

''|<subdomain name>

Specifies the MX type resource record in the Plesk server's DNS zone template.

Used with the --add command only.

Requires the -mailexchanger option.

To add an MX resource record <domain> specifying domain name mail.<domain> as the mail exchanger for the record, and setting the mail exchanger's priority to 15 to the domain DNS zone template:

server_dns.exe -a -mx "" -mailexchanger "mail.<domain>" -priority 15

 

-mailexchanger

<domain_name>

Specifies the name of a mailexchanger or a placeholder for creating an MX type DNS record in the Plesk server's DNS zone template.

 

-priority

<number>

Specifies the mail exchanger priority for creating an MX type DNS record in the Plesk server's DNS zone template.

 

-cname

''|<subdomain name>

Specifies the CNAME type resource record in the Plesk server's DNS zone template.

Used with the --add command only.

Requires concomitant use of the -canonical option.

To add a CNAME type resource record subdom.<domain> for a canonical name <domain> to the domain DNS zone template:

server_dns.exe -a -cname subdom -canonical "<domain>"

 

-canonical

<domain_name>

Specifies a canonical name or a placeholder for creating a CNAME type DNS record in the Plesk server's DNS zone template.

-ptr

''|<subdomain name>

Specifies the PTR type resource record in the Plesk server's DNS zone template.

Used with the --add command only.

Requires concomitant use of the -subnet option.

To add a PTR type DNS record "<ip>"/16 for <domain> to the domain DNS zone template:

server_dns.exe -a -ptr "" -subnet "<ip>"/16

-subnet

<IP address>/<subnet mask>|"<ip>"/<subnet mask>

Specifies an IP address and a subnet mask or a placeholder for creating a PTR type DNS record in the Plesk server's DNS zone template.

-srv

''|<subdomain_name>

 

 

 

 

Specifies the SRV type resource record in the Plesk server's domain DNS zone template.

Used with the --add command only.

Requires the use of options -srv-service, -srv-target-host, -srv-port.

To add to the DNS zone template an SRV record for <domain> to handle SIP protocol connections, that will point to a server named sipserver.sample.com listening on TCP port 5060. The priority given here is 0, and the weight is 5:

>server_dns.ee --add -srv '' -srv-service sip -srv-target-host sipserver.sample.com. -srv-protocol TCP -srv-port 5060 -srv-priority 0 -srv-weight 5

-srv-priority

[0-50]

Specifies priority of the SRV record (0 - the highest, 50 - the lowest).

-srv-weight

[0-50]

Specifies relative weight of the SRV record among records with the same priority (0 - the lowest, 50 - the highest).

-srv-port

[0-65535]

Specifies the port on which the service is to be found (for SRV record).

-srv-target-host

<host>

Specifies canonical hostname of the machine providing the service (for SRV record).

-srv-protocol

TCP|UDP

Specifies the service protocol for SRV record.

-srv-service

<service>

Specifies symbolic name of the service for SRV record.

-txt

<text>|""

Specifies the TXT type resource record in the Plesk server's DNS zone template.

Used with the --add only.

Requires the -domain option if the record is created for a specific subdomain name.

To specify the TXT type DNS record "This record is used to implement the Senders Policy Framework and DomainKeys specifications" for the specific subdomain name subdom in the domain DNS zone template:

server_dns.exe -a -txt "This record is used to implement the Senders Policy Framework and DomainKeys specifications" -domain subdom

-domain

''|<subdomain name>

Specifies a subdomain name for creating a TXT type resource record in the Plesk server's DNS zone template.

Used with the --add command only.

-soa-serial-format

timestamp|yyyymmddnn

Specifies format of SOA record serial number: UNIX timestamp or recommended by IETF and RIPE.

Used with the --update-soa command only.

To change the SOA record serial format to recommended by IETF and RIPE in the domain DNS zone template:

server_dns.exe --update-soa -soa-serial-format yyyymmddnn

-soa-ttl

<number>[S|M|H|D|W]

Specifies the TTL value for the SOA record in the Plesk server's DNS zone template.

Used with the--update-soa command only.

To set the TTL value to 5 hours, the Refresh value to 4 hours, the Retry value to 10 seconds, the Expire value to 2 weeks, and the Minimum value to 2 days for the SOA record in the domain DNS zone template:

server_dns.exe --update-soa -soa-ttl 5H -soa-refresh 4H -soa-retry 10S -soa-expire 2W -soa-minimum 2D

 

-soa-refresh

<number>[S|M|H|D|W]

Specifies the Refresh value for the SOA record in the Plesk server's DNS zone template.

Used with the --update-soa command only.

-soa-retry

<number>[S|M|H|D|W]

Specifies the Retry value for the SOA record in the Plesk server's DNS zone template.

Used with the --update-soa command only.

-soa-expire

<number>[S|M|H|D|W]

Specifies the Expire value for the SOA record in the Plesk server's DNS zone template.

Used with the --update-soa command only.

-soa-minimum

<number>[S|M|H|D|W]

Specifies the Minimum value for the SOA record in the Plesk server's DNS zone template.

Used with the --update-soa command only.