Introduction:
In server management, especially when administering WHM/cPanel environments, it’s often necessary to view DNS records for troubleshooting, validation, or auditing. While the WHM interface provides graphical access to DNS Zones, using the command line can be more efficient and scriptable.
Procedure:
Step1:
The whmapi1
tool must be run as the root user, as it interacts with WHM-level functionality.
Step2:
List All DNS Zones on the Server with below command. This command returns a list of domains configured on the server.
whmapi1 listzones |
Step3:
View DNS Records for a Specific Domain, Replace example.com
with your actual domain name.
whmapi1 dumpzone domain=example.com |
This command outputs detailed DNS zone data, including:
- Record type (A, MX, TXT, CNAME, etc.)
- Name
- TTL
- Data (target values)
Example output:
data:
record:
line_index: 1
name: example.com.
type: A
data: 192.0.2.1
Conclusion:
Using whmapi1
is a powerful and reliable method to access DNS zone records directly from the WHM/cPanel server CLI. It enables system administrators to programmatically retrieve and review DNS configurations without logging into the WHM UI.