server_dns: DNS Zone Template
The server_dns
utility is used to manage the Plesk server’s DNS zone
template through CLI. By using this utility, you can perform the
following tasks:
- adding resource records to or replacing already existing resource records with new ones in the Plesk server’s DNS zone template.
- specifying the status to be set for a domain’s DNS zone upon creation of a domain.
- updating the Start-of-Authority (SOA) record for the DNS zone template.
- setting the Plesk name server DNS zone preferences regarding recursive DNS queries from different types of hosts.
- managing the Access control list (ACL records).
Usage
server_dns <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.plesk bin server_dns --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 domain DNS zone template. If a record already exists, the command returns code |
To add an plesk bin server_dns --add -mx "" -mailexchanger "mail.<domain>" -priority 35 or plesk bin server_dns -a -mx "" -mailexchanger "mail.<domain>" -priority 35 |
|
--set or -s
|
where
|
Adds specified resource records to and removes all pre-existing resource records from the Plesk server’s domain 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. plesk bin server_dns --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. plesk bin server_dns -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
|
Updates the Plesk server’s DNS server settings. |
To enable support for recursive DNS queries for hosts on the local network only: plesk bin server_dns -u -recursion localnets |
|
--update-soa |
Updates the SOA record settings the Plesk server’s domain DNS zone template. |
To set the TTL parameter to 5 hours for the SOA record for the domain DNS zone template: plesk bin server_dns --update-soa -soa-ttl 5H |
|
--info or -i
|
Displays the list of DNS server settings. |
To view the list of DNS server settings: plesk bin server_dns --info or plesk bin server_dns -i |
|
--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: plesk bin server_dns --enable-custom-backend /home/route53.php |
--disable-custom-backend |
Disables Plesk integration with a third-party DNS. |
To switch off Plesk integration with a third-party DNS service: plesk bin server_dns --disable-custom-backend |
|
--help or -h
|
Displays help on the use of the utility. |
To view help on the use of the dns utility: plesk bin server_dns --help or plesk bin server_dns -h |
|
--set-custom-config |
path/to/file |
Specifies the file with custom configuration of the DNS server. |
To replace the current DNS settings with custom ones provided in the custom-dns-options.conf file: plesk bin server_dns --set-custom-config custom-dns-options.conf |
Options
Option | Parameter | Description | Example |
---|---|---|---|
-recursion |
any|localnets|localhost |
Sets the Plesk name server DNS zone preferences:
Used with the |
To enable support for recursive DNS queries for hosts on the local network only: plesk bin server_dns -u -recursion localnets |
-status |
enabled|disabled |
Sets the status of a domain’s DNS zone when the domain DNS zone is created during domain creation. Only newly created domains will inherit the DNS zone status. Used with the |
To disable domain DNS zones for newly created domains: plesk bin server_dns -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: plesk bin server_dns -u -add-acl 192.0.2.78,192.0.2.0/24 |
-a |
<subdomain_name> |
Specifies the Used with the Requires the |
To add an plesk bin server_dns -a -a sample -ip "<ip>" |
-aaaa |
<subdomain_name> |
Specifies the Used with the Requires the |
|
-ip |
<IP_address>|"<ip>" |
Specifies an IP address or a placeholder for a domain’s IP address for creating a resource record in Plesk server’s domain DNS zone template. Used only with the |
|
-ns |
<subdomain_name>|"" |
Specifies the Used only with the Requires the |
To add an plesk bin server_dns -a -ns "" -nameserver "ns.<domain>" |
-nameserver |
<domain_name>|"[<subdomain_name>.]<domain>" |
Specifies the name of a nameserver or a placeholder for
creating an NS type resource record in the Plesk server’s
domain DNS zone template. |
|
-mx |
<subdomain_name>|"" |
Specifies the Used with the Requires the |
To add an plesk bin server_dns -a -mx "" -mailexchanger "mail.<domain>" -priority 15 |
-mailexchanger |
<domain_name>|"[<subdomain_name>.]<domain>" |
Specifies the name of a mailexchanger or a placeholder for
creating an MX type DNS record in the Plesk server’s domain
DNS zone template. |
|
-priority |
<number> |
Specifies the mail exchanger priority for creating an MX
type DNS record in the Plesk server’s domain DNS zone template. |
|
-cname |
<subdomain_name>|"" |
Specifies the Used with the Requires concomitant use of the |
To add a plesk bin server_dns -a -cname subdom -canonical "<domain>" |
-canonical |
<domain_name>|[<subdomain_name>.]<domain>" |
Specifies a canonical name or a placeholder for creating a
CNAME type DNS record in the Plesk server’s domain DNS zone
template. |
|
-ptr |
<subdomain_name>|"" |
Specifies the Used with the Requires concomitant use of the |
To add a plesk bin server_dns -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 domain DNS zone template. | |
-srv |
''|<subdomain_name> |
Specifies the SRV type resource record in the Plesk server’s domain DNS zone template. Used with the Requires the use of options
|
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: plesk bin server_dns --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 Used with the Requires the |
To specify the plesk bin server_dns -a -txt "This record is used to implement the Senders Policy Framework and DKIM specifications" -domain subdom |
-domain |
<subdomain_name>|"" |
Specifies a subdomain name for creating a Used with the |
|
-soa-ttl |
<number>[S|M|H|D|W] |
Specifies the TTL value for the SOA record in the Plesk server’s domain DNS zone template. Used with the |
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: plesk bin server_dns --update-soa -soa-ttl 5H -soa-refresh 4H -soa-retry 10S -soa-expire 2W -soa-minimum 2D |
|
<number>[S|M|H|D|W] |
Specifies the Refresh value for the SOA record in the Plesk server’s domain DNS zone template. Used with the |
|
-soa-retry |
<number>[S|M|H|D|W] |
Specifies the Retry value for the SOA record in the Plesk server’s domain DNS zone template. Used with the |
|
-soa-expire |
<number>[S|M|H|D|W] |
Specifies the Expire value for the SOA record in the Plesk server’s domain DNS zone template. Used with the |
|
-soa-minimum |
<number>[S|M|H|D|W] |
Specifies the Minimum value for the SOA record in the Plesk server’s domain DNS zone template. Used with the |
|
-soa-serial-format |
timestamp|yyyymmddnn |
Specifies format of SOA record serial number: UNIX timestamp or recommended by IETF and RIPE. Used with the |
To change the SOA record serial format to recommended by IETF and RIPE in the domain DNS zone template: plesk bin server_dns --update-soa -soa-serial-format yyyymmddnn |