Applicable to:
- Plesk for Linux
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
Comments
5 comments
If we do this
the controlpanel still shows:
The changes you made to DNS records are not saved yet. The changes are marked in the list of records. Click Update to apply the changes to the DNS zone. Click Revert to cancel the changes.
Is there an additional CLI command necessary ?
Hi @andreas gstrein,
There is no way to remove this message via the command line in case you are seeing it already, however in case you add the records from the command line to begin with, this message should not be there, I checked this with
# plesk bin dns -a example.com -a "" -ip 203.0.113.2
# plesk bin dns -a example.com -ns "ns3" -nameserver ns1.example.com
Update:
Actually, the following command should remove the 'Update' warning:
# plesk sbin dnsmng --update example.com --without-reverse
hi Alexandr,
we do
plesk bin dns --del DOMAIN.TLD -a webmail -ip 11.22.33.44;
plesk bin dns --add DOMAIN.TLD -a webmail -ip 22.33.44.55;
and the message is there.
So can we ignore the message or do we need to do the additional wor in plesk-panel
best regards
Hi,
I suppose that this message was there before the change, check what record is actually marked with exclamation mart with this 'Update' message is shown:

In case it's a different record, ignore it or press 'revert'. In case it's the same one, then additional work will be required. In case you observe this behavior on a newest version of Plesk Onyx 17.8 and can reproduce it stably, submit a request to us in order to investigate this behavior in details.
too short. needs more examples of this huge CLI command
Please sign in to leave a comment.