Question
How to add or modify DNS records for the specific domain using CLI?
Answer
- Connect to the server using SSH.
Note: If direct SSH access to the server is not possible, contact server administrator for further assistance.
-
Use the following command to add a DNS record for the domain example:
# plesk bin dns --add example.com -srv sub.example.com -srv-service sip -srv-target-host sipserver.example.com -srv-protocol tcp -srv-port 5060 -srv-priority 0 -srv-weight 5
where
-
example.com
- domain to which the DNS record needs to be added. -
-srv
- type of DNS record. -
-srv-service sip -srv-target-host sipserver.example.com -srv-protocol tcp -srv-port 5060 -srv-priority 0 -srv-weight 5
- additional parameters for specific DNS record type.
-
Other examples:
-
To create an A record for the domain example.com:
# plesk bin dns -a example.com -a "" -ip 203.0.113.2
-
To delete an A record for the domain example.com:
# plesk bin dns -d example.com -a "" -ip 203.0.113.2
-
To create NS record for the domain example.com:
# plesk bin dns -a example.com -ns "" -nameserver ns1.example.com
- To create PTR record:
# plesk bin dns --set example.com -list “PTR,203.0.113.2,,24.;”
For other options and examples of using the CLI utility dns
, see the following documentation article in Reference for Command-Line Utilities, Plesk for Linux: dns: DNS Zones on Domains