DNS Zone Template: server_dns Utility

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:

Syntax

server_dns <command> [

<option_1> [<param>]

[<option_2> [<param>]]

…[<option_N> [<param>]]

]

Example

The following command line 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:

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 2.

To add new 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 --add -mx "" -mailexchanger "mail.<domain>" -priority 35

or

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

--set or -s

"<record 1>;<record 2>;...<record N>"

where <record> =

MX,"<subdomain name>",<mail exchanger name>."<domain>" |

NS,"<subdomain name>",<name server name>."<domain>" |

A,<subdomain name>,<IP address>|"<ip>" |

PTR,<IP address/subnet mask>,<subdomain name> |

CNAME,<subdomain name>,<canonical domain name>|"<domain>" |

TXT,<subdomain name>,<text>

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 two resource records to the domain DNS zone template, while removing all pre-existing resource records from the DNS zone:

  • new MX resource record <domain> specifying subdomain name 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 --set "MX,"",mail.<domain>,15;NS,"",ns.<domain>"

or

# ./server_dns -s "MX,"",<domain>,15;NS,"",ns.<domain>"

--update-server or -u

 

Updates the Plesk server's domain DNS zone template.

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

# ./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:

# ./server_dns --update-soa -soa-ttl 5H

--info

 

Displays the list of resource records for the Plesk server's domain DNS zone template.

To display the list of resource records in the domain DNS zone template:

# ./server_dns --info

--help or -h

 

Displays help on the use of the utility.

To display help on the use of the dns utility:

# ./server_dns --help

or

# ./server_dns –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 -u -recursion localnets

-status

enabled|disabled

Sets the status of a domain's DNS zone (Enabled or Disabled) when the domain DNS zone is created during 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 -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) (ACL records).

To add records 192.168.67.78 and 192.168.0.0/24 to the ACL:

# ./server_dns -u -add-acl 192.168.67.78,192.168.0.0/24

-a

<subdomain name>

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

Used with the --add.

Requires concomitant use of the -ip option.

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

# ./server_dns -a -a subdom -ip "<ip>"

-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 domain DNS zone template.

Used only with the --add command.

-ns

<subdomain name>|""

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

Used only with the --add command.

Requires concomitant use of the -nameserver option.

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

# ./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 MX type resource record in the Plesk server's domain DNS zone template.

Used only with the --add command.

Requires concomitant use of the -mailexchanger option.

To add new 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 -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 CNAME type resource record in the Plesk server's domain DNS zone template.

Used only with the --add command.

Requires concomitant use of the -canonical option.

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

# ./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 PTR type resource record in the Plesk server's domain DNS zone template.

Used with the --add and --del commands only.

Requires concomitant use of the -subnet option.

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

# ./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.

-txt

<text>|""

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

Used only with the --add.

Requires concomitant use of 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 -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 domain DNS zone template.

Used only with the --add command.

-soa-ttl

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

Sets the TTL parameter for the SOA record in the Plesk server's domain DNS zone template.

Used with the--update-soa command only.

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

# ./server_dns --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]

Sets the Refresh parameter for the SOA record in the Plesk server's domain DNS zone template.

Used with the --update-soa command only.

-soa-retry

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

Sets the Retry parameter for the SOA record in the Plesk server's domain DNS zone template.

Used with the --update-soa command only.

-soa-expire

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

Sets the Expire parameter for the SOA record in the Plesk server's domain DNS zone template.

Used with the --update-soa command only.

-soa-minimum

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

Sets the Minimum parameter for the SOA record in the Plesk server's domain DNS zone template.

Used with the --update-soa command only.