How to Create DNS Records in NameCheap

NameCheap is my recommended domain registrar, because the price is low and they give whois privacy protection free for life. This tutorial is going to show you how to create common DNS records in NameCheap. This is primarily for users who need to set up a mail server.

Create DNS Records in NameCheap

To create DNS records, go to your NameCheap account dashboard, click Domain List on the left pane, and click the Manage button on the right.

Make sure the name server is set to Namecheap BasicDNS.

Namecheap BasicDNS

The click Advanced DNS tab to edit DNS records.

MX Record

The MX record specifies which host or hosts handle emails for a particular domain name. For example, the host that handles emails for linuxbabe.com is mail.linuxbabe.com. If someone with a Gmail account sends an email to [email protected], then Gmail server will query the MX record of linuxbabe.com. When it finds out that mail.linuxbabe.com is responsible for accepting email, it then query the A record of mail.linuxbabe.com to get the IP address, thus the email can be delivered.

Scroll down, you will find Mail Settings, choose Custom MX.

namecheap custom MX

Next, click the add new record button to add a new MX record. Enter @ in the Host field to represent the main domain name, then enter mail.your-domain.com in the Value field. Enter 0 in the priority field. The priority value can be any number between 0 and 65,356. A small number has higher priority than a big number. It’s recommended that you set the value to 0, so this mail server will have the highest priority for receiving emails. Click the check button to save your changes.

namecheap create MX record

A Record

A Record (Address Record) maps a domain name to an IP address. After creating MX record, you also need to create an A record for mail.your-domain.com , so that it can be resolved to an IP address.

Click the add new record button in the Host Records section. Create an A record. Enter mail in the Host field. Then enter the IP address of your mail server in the Value filed. Click the check button to save your changes.

AAAA Record

AAAA Record maps a domain name to an IPv6 address. If your server uses IPv6 address, be sure to add AAAA record.

Click the add new record button in the Host Records section. Create an AAAA record. Enter mail in the Host field. Then enter the public IPv6 address of your mail server in the Value filed. Click the check button to save your changes.

SPF Record

SPF (Sender Policy Framework) is a type of TXT record. It specifies which hosts or IP address are allowed to send emails on behalf of a domain. You should allow only your own email server or your ISP’s server to send emails for your domain.

In the NameCheap Host Records section, create a new TXT record. Enter @ in the Host field to represent the main domain name. Enter v=spf1 mx ~all in the Value field. Click the check button to save your changes.

Explanation:

  • v=spf1 indicates this is an SPF record and the version is SPF1.
  • mx means all hosts listed in the MX records are allowed to send emails for your domain and all other hosts are disallowed.
  • ~all indicates that emails from your domain should only come from hosts specified in the SPF record. Emails that are from other hosts will be flagged as forged.

To check if your SPF record is propagated to the public Internet, you can use the dig utility on your Linux machine like below:

dig your-domain.com txt

The txt option tells dig that we only want to query TXT records.

DKIM Record

This is also a type of TXT record. DKIM (DomainKeys Identified Mail) uses a private key to digitally sign emails sent from your domain. Receiving SMTP servers verify the signature by using the public key, which is published in the DNS DKIM record.

The DKIM private/public key pair is produced by software on the mail server. The method to get the DKIM public key can be different depending on the software you use. If you follow my iRedMail or Modoboa tutorial, please read that tutorial to find how to get the DKIM public key.

Once you have the key, go to NameCheap Host Records section, create a new TXT record. Enter dkim._domainkey in the Host field if you follow my iRedMail tutorial. Enter modoboa._domainkey in the Host field if you follow my Modoboa tutorial. Next, copy the DKIM public key to the Value filed. Note that you need to Delete all double quotes and line breaks. You can copy the DKIM public key to a tex editor first, delete the double quotes and line breaks, then copy it to the Value field in NameCheap.

NameCheap create DKIM record

Click the check button to save your changes.

DMARC Record

DMARC stands for Domain-based Message Authentication, Reporting and Conformance. DMARC can help receiving email servers to identify legitimate emails and prevent your domain name from being used by email spoofing.

To create a DMARC record, go to NameCheap Host Records section, create a new TXT record. Enter _dmarc in the Host field. Enter v=DMARC1; p=none; pct=100; rua=mailto:[email protected] in the Value field. (You should create the [email protected] email address.) Click the check button to save your changes.

NameCheap create DMARC record

PTR record

A pointer record, or PTR record, maps an IP address to an FQDN (fully qualified domain name). It’s the counterpart to the A record and is used for reverse DNS lookup, which can help with blocking spammers. Many SMTP servers reject emails if no PTR record is found for the sending server.

To check the PTR record for an IP address, run this command:

dig -x IP-address +short

or

host IP-address

PTR record is not controlled by your domain registrar. Because you get IP address from your hosting provider or ISP, not from your domain registrar, so you must set PTR record for your IP in the control panel of your hosting provider, or ask your ISP. Its value should be your mail server’s hostname: mail.your-domain.com. If your server uses IPv6 address, be sure to add a PTR record for your IPv6 address as well.

To edit the reverse DNS record for your ScalaHosting VPS, log into ScalaHosting client area, then use the live chat on the bottom-right corner, tell the support team to update the PTR record of your server IP addresss to mail.your-domain.com.

Wrapping Up

I hope this article helped you create DNS record in NameCheap. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 2 Average: 5]

8 Responses to “How to Create DNS Records in NameCheap

  • David Montellano
    4 years ago

    Wow, this article is excellent!! I can create my server mail. Thank you!!!.

  • sir, which IP you put in the A record is static IP or public IP from the isp provider?

    • Xiao Guoan (Admin)
      3 years ago

      You can’t enter private IP address when editing DNS records at a domain registrar. Private IP address are invalid in the public DNS system.

      • I have a problem

        I have a home server and I use duckdns to connect to it from the internet, but I wanted to do it in a better way and I bought a domain in NameCheap, what now I don’t know is how to tell the domain in NameCheap that when I point to purchasedaddress.com it will redirect me to the ip of my house that is in xxxx.duckdns.org

        How can I make this possible ????

        • Eric
          1 year ago

          Hi, I have the same issue. Did you find the solution ?

    • Droptinni
      3 years ago

      I do not understand any of this article. Yes, I followed the instructions but I am only following to be able to access Jellyfin web interface. What IP address am I supposed to put in the IP section? Should mine be jellyfin instead of mail. Very confused. There should be a another article that only relates to Jellyfin with detailed steps. This is for email not Jellyfin.

  • you should configure your firewall and nat on your route config nat point your public IP and port to your server IP make sure your home server using static IP

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here