How to Use cPanel on VPS to Manage DNS Records

A Virtual Private Server (VPS) provides flexibility and control over your hosting, and cPanel simplifies server management with an intuitive interface. One of the most crucial tasks when using a VPS is correctly configuring DNS records, ensuring your site is accessible and your email services function properly. In this article, we will thoroughly explore how to effectively manage DNS records in cPanel on a VPS to ensure the stable and reliable operation of your web project.

We will cover adding, editing, and deleting DNS records, as well as explain how to interpret various record types such as A, MX, CNAME, and TXT. You will receive step-by-step instructions and practical examples to help you confidently manage your domain’s DNS settings, avoiding common mistakes and optimizing your site’s performance.

Accessing the DNS Zone Editor in cPanel

How to Use cPanel on VPS? - Screenshot showing the cPanel interface and highlighting the Zone Editor icon

The first step in managing DNS records is accessing the DNS Zone Editor in cPanel. cPanel offers a simple and intuitive interface for managing DNS, allowing you to make changes quickly and safely. How to find the Zone Editor:
  • Log in to your cPanel. You can usually do this by going to https://your_domain:2083 or https://your_domain/cpanel, using the credentials provided by your hosting provider.
  • Find the «Domains» section.
  • In this section, you will find an icon or link called «Zone Editor». Click on it.
Zone Editor Interface: Once you enter the Zone Editor, you will see a list of your domains. Next to each domain, there will be several options:
  • A Record: Add an A record.
  • CNAME Record: Add a CNAME record.
  • MX Record: Add an MX record.
  • Manage: Manage existing DNS records for the selected domain. This is where you can view, edit, and delete records.
Example 1: Accessing the Zone Editor via search. If you cannot find the Zone Editor right away, use the search bar at the top of cPanel. Just start typing «Zone Editor» or «DNS» and cPanel will suggest the corresponding option. Example 2: Selecting a domain for editing. In the Zone Editor, you will see a list of domains linked to your account. Make sure you select the correct domain before making changes. Click the «Manage» button next to the desired domain to proceed to editing its DNS records. Example 3: Record management interface. After navigating to the record management for a specific domain, you will see a table with all existing DNS records for that domain. The table will have columns displaying the record type (A, MX, CNAME, etc.), Name, TTL (Time to Live), and Record. This is the central place where you will perform all DNS management operations. Important: Before making any changes, make sure you understand which records are responsible for which functions. Incorrectly changing DNS records can make your site unavailable or cause problems with email.

Expert Tip: Before making changes to DNS, back up the existing records. This allows you to quickly restore the previous settings if problems arise.

VPS Hosting

Virtual servers with guaranteed resources

Choose VPS

Adding and Configuring A Records

How to Use cPanel on VPS? - Screenshot showing the Zone Editor interface with the form for adding an A record highlighted

An A record (Address Record) links a domain name or subdomain to the IP address of a server. This is one of the most important types of DNS records because it determines where traffic is directed when your domain is requested. When to use an A record:
  • Specifying the primary IP address of your web server.
  • Directing subdomains (e.g., blog.your_domain) to a specific IP address.
  • Specifying the IP address for a domain without a prefix (your_domain).
How to add an A record in cPanel:
  • In the Zone Editor for the desired domain, click the «Add Record» button or select «A Record» from the drop-down list.
  • Fill in the required fields:
    • Name: Specify the domain name or subdomain for which you are creating the A record. For example, for your main domain enter «@» (without quotes), for a subdomain «blog» enter «blog.your_domain».
    • Address: Enter the IP address of the server you want to direct traffic to. This should be an IPv4 address (e.g., 192.168.1.1).
    • TTL: Specify the TTL (Time to Live) value. The default value is usually used (e.g., 14400 seconds or 4 hours). TTL determines how long DNS servers will cache this record.
  • Click the «Add Record» button to save the record.
Example 1: Directing the main domain to an IP address. Suppose your domain is «example.com» and the IP address of your server is «203.0.113.45». You want users to land on this server when requesting example.com. Then your A record will look like this:
FieldValue
Name@
Address203.0.113.45
TTL14400
Example 2: Directing the «blog» subdomain to another IP address. Suppose you have a subdomain «blog.example.com» which is located on another server with the IP address «198.51.100.78». In this case, the A record will look like this:
FieldValue
Nameblog.example.com
Address198.51.100.78
TTL14400
Example 3: Editing an existing A record. If your server’s IP address has changed, you need to update the A record. In the Zone Editor, find the existing A record for your domain or subdomain, click the «Edit» button, and change the value in the «Address» field to the new IP address. Be sure to save the changes. Important: After changing an A record, it may take some time (up to 48 hours) for the changes to take effect worldwide. This is due to DNS record caching on various DNS servers.

Configuring MX Records for Email

MX records (Mail Exchange Records) determine which mail servers are responsible for receiving email for your domain. Correctly configuring MX records is critical to ensuring email delivery and receipt. When to use MX records:
  • Specifying the mail server for your domain (e.g., mail.example.com).
  • Defining the priority of mail servers (if you have multiple servers).
  • Integrating with email services such as Google Workspace (G Suite) or Microsoft 365.
How to add an MX record in cPanel:
  • In the Zone Editor for the desired domain, click the «Add Record» button or select «MX Record» from the drop-down list.
  • Fill in the required fields:
    • Priority: Specify the priority for the mail server. The lower the number, the higher the priority. Usually a value of 0, 10, or 20 is used.
    • Destination: Enter the fully qualified domain name of the mail server (e.g., mail.example.com or aspmx.l.google.com).
    • TTL: Specify the TTL (Time to Live) value. The default value is usually used.
  • Click the «Add Record» button to save the record.
Example 1: Configuring MX records to use a mail server on a VPS. Suppose you have a mail server installed on your VPS and you want email for your domain «example.com» to be delivered to this server, which has the domain name «mail.example.com». Your MX record will look like this:
FieldValue
Priority10
Destinationmail.example.com
TTL14400
Example 2: Configuring MX records for Google Workspace (G Suite). If you are using Google Workspace for email, you need to add several MX records provided by Google. They have a specific priority and domain names:
PriorityDestination
1aspmx.l.google.com
5alt1.aspmx.l.google.com
5alt2.aspmx.l.google.com
10aspmx2.googlemail.com
10aspmx3.googlemail.com
Example 3: Checking MX records. After adding or changing MX records, make sure they are configured correctly. You can use online tools such as MX Toolbox (mxtoolbox.com) to check your MX records. Enter your domain and see if your MX records are displayed correctly. Important: Incorrect configuration of MX records can lead to loss of email. Always double-check the correctness of the entered data and consult the documentation of your email provider.

Creating and Editing CNAME Records

A CNAME record (Canonical Name Record) creates an alias for an existing domain name. It allows you to direct one domain or subdomain to another domain. When to use CNAME records:
  • Directing a subdomain to the main domain (e.g., www.your_domain to your_domain).
  • Directing a subdomain to another subdomain.
  • Integrating with third-party services that provide domain names to access their services (e.g., CDN).
How to add a CNAME record in cPanel:
  • In the Zone Editor for the desired domain, click the «Add Record» button or select «CNAME Record» from the drop-down list.
  • Fill in the required fields:
    • Name: Specify the subdomain for which you are creating the CNAME record (e.g., www or blog).
    • Target: Enter the domain name you want to direct traffic to (e.g., your_domain or another_subdomain.your_domain).
    • TTL: Specify the TTL (Time to Live) value. The default value is usually used.
  • Click the «Add Record» button to save the record.
Example 1: Directing www.example.com to example.com. It is often required that both example.com and www.example.com lead to the same website. To do this, you can create a CNAME record that directs www.example.com to example.com:
FieldValue
Namewww
Targetexample.com
TTL14400
Example 2: Directing the subdomain blog.example.com to another domain. Suppose you are using a blogging platform that provides you with a domain name for your blog (e.g., yourblog.blogplatform.com). You can create a CNAME record to direct blog.example.com to yourblog.blogplatform.com:
FieldValue
Nameblog
Targetyourblog.blogplatform.com
TTL14400
Example 3: Using CNAME for CDN (Content Delivery Network). Many CDN providers require the creation of a CNAME record to integrate the CDN with your domain. For example, if the CDN provider provides you with the domain cdn.example.cdnprovider.com, you can create a CNAME record to direct cdn.example.com to cdn.example.cdnprovider.com:
FieldValue
Namecdn
Targetcdn.example.cdnprovider.com
TTL14400
Important: CNAME records cannot be created for the root domain (e.g., example.com). An A record must be used for the root domain. Also, make sure that the domain to which you are directing traffic using a CNAME record exists and is configured correctly.

Expert Tip: Use CNAME records to simplify DNS management. If the IP address of the server pointed to by the CNAME record changes, you only need to change the A record for the target domain, and all CNAME records will automatically update.

Adding TXT Records for Verification

TXT records (Text Records) contain text information that can be used for various purposes, including domain verification, SPF (Sender Policy Framework), and DKIM (DomainKeys Identified Mail). When to use TXT records:
  • Domain verification in Google Search Console, Bing Webmaster Tools, and other services.
  • Creating an SPF record to protect against email spoofing.
  • Creating a DKIM record for digital signing of emails.
  • Confirming domain ownership for various online services.
How to add a TXT record in cPanel:
  • In the Zone Editor for the desired domain, click the «Add Record» button or select «TXT Record» from the drop-down list.
  • Fill in the required fields:
    • Name: Specify the domain name or subdomain for which you are creating the TXT record. Usually it is «@» for the root domain or the name of the subdomain.
    • Record: Enter the text string provided to you by the service requiring domain verification.
    • TTL: Specify the TTL (Time to Live) value. The default value is usually used.
  • Click the «Add Record» button to save the record.
Example 1: Domain verification in Google Search Console. Google Search Console often requires domain verification using a TXT record. Google provides you with a unique text string that needs to be added to your domain’s DNS record. For example, the string might look like this: «google-site-verification=rVeWzT6Hw-zRt3q9b8hGv4Xm8x_3yW7zQ7q2aF». Your TXT record will look like this:
FieldValue
Name@
Recordgoogle-site-verification=rVeWzT6Hw-zRt3q9b8hGv4Xm8x_3yW7zQ7q2aF
TTL14400
Example 2: Creating an SPF record. An SPF record helps prevent email spoofing. It determines which servers are authorized to send emails on behalf of your domain. Example SPF record: «v=spf1 mx a ip4:192.168.1.1 include:_spf.google.com ~all». This record allows sending mail from servers specified in MX records, from the A record of the domain, from IP address 192.168.1.1 and from servers specified in _spf.google.com. Your TXT record will look like this:
FieldValue
Name@
Recordv=spf1 mx a ip4:192.168.1.1 include:_spf.google.com ~all
TTL14400
Example 3: Creating a DKIM record. A DKIM record is used for digital signing of emails, which allows recipients to verify that the email was actually sent from your domain and has not been modified in transit. A DKIM record is a long text string provided by your email provider. For example: «v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD…» Your TXT record will look like this:
FieldValue
Namedefault._domainkey
Recordv=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD…
TTL14400
Important: The syntax of SPF and DKIM records is very important. Make sure you enter the records exactly as they are provided by your email provider or domain verification service. Incorrect TXT records can lead to problems with email delivery or inability to verify your domain. Managing DNS records in cPanel on a VPS is an important skill for ensuring reliable and efficient operation of your website and email services. By following the instructions and examples in this article, you will be able to confidently manage your domain’s DNS settings and avoid common mistakes.