April 16, 2026

DNS Providers: A Technical Overview with Code Examples

This article explains key DNS record types (A, MX, CNAME, TXT, PTR, DNSSEC) with code examples for effective domain and email security management.

A DNS provider is a critical service responsible for managing DNS records and translating domain names into IP addresses. DNS providers offer essential services such as DNS resolution, record management, security features, and redundancy.

1. A Record (Address Record) Configuration

An A Record maps a domain to an IPv4 address. This is the most basic form of DNS record and is responsible for directing traffic to the correct server.

Example:

example.com. IN A 192.168.1.1

  • example.com is the domain
  • IN stands for Internet (record class)
  • A signifies the type of record (Address Record)
  • 192.168.1.1 is the IPv4 address of the server

2. AAAA Record (IPv6 Address Record) Configuration

The AAAA Record is used to map a domain to an IPv6 address. It operates in the same way as the A Record but uses IPv6 for addressing.

Example:

example.com. IN AAAA 2001:0db8::1

  • example.com is the domain name
  • AAAA is the record type indicating an IPv6 address
  • 2001:0db8::1 is the IPv6 address

3. MX Record (Mail Exchange Record) Configuration

An MX Record specifies the mail servers for a domain, enabling email communication. The record contains priority values to determine which mail server should be used first.

Example:

example.com. IN MX 10 mail.example.com. example.com. IN MX 20 backupmail.example.com.

  • The priority value (e.g., 10 or 20) determines the preference for the mail servers (lower = higher priority)
  • mail.example.com is the primary mail server
  • backupmail.example.com is the backup mail server

4. TXT Record (Text Record) Configuration

TXT Records store text data and are often used for domain verification and security purposes such as SPF, DKIM, and DMARC.

Example: SPF Record Configuration

example.com. IN TXT "v=spf1 include:_spf.google.com ~all"

  • "v=spf1" declares that it's an SPF record
  • include:_spf.google.com indicates that Google’s mail servers are authorized
  • ~all means any other mail servers not listed will be marked as a soft fail

Example: DMARC Record Configuration

_dmarc.example.com. IN TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"

  • _dmarc.example.com is the subdomain used for DMARC records
  • "v=DMARC1" specifies the DMARC version
  • p=none means no policy enforcement is applied (monitoring only)
  • rua=mailto:dmarc-reports@example.com specifies where to send aggregate reports

5. CNAME Record (Canonical Name Record) Configuration

A CNAME Record maps one domain to another. It is typically used for aliasing one domain to another.

Example:

www.example.com. IN CNAME example.com.

6. NS Record (Name Server Record) Configuration

An NS Record specifies the authoritative DNS servers for a domain. It tells other DNS servers where to look for the domain’s DNS records.

Example:

example.com. IN NS ns1.dnsprovider.com. example.com. IN NS ns2.dnsprovider.com.

  • ns1.dnsprovider.com and ns2.dnsprovider.com are the authoritative DNS servers

7. PTR Record (Pointer Record) Configuration

A PTR Record is used for reverse DNS lookups. It maps an IP address to a domain name.

Example:

1.168.192.in-addr.arpa. IN PTR example.com.

  • 1.168.192.in-addr.arpa is the reversed IP address 192.168.1.1
  • The PTR record maps this IP address to example.com

8. DNSSEC Configuration (DNS Security Extensions)

DNSSEC adds security to DNS by enabling verification of the authenticity of DNS records, preventing attacks such as spoofing and cache poisoning.

Example: DNSKEY Record

example.com. IN DNSKEY 257 3 13 AwEAAa...g7U=

  • The DNSKEY record contains a public key used to validate DNSSEC signatures
  • Ensures the authenticity of the domain’s DNS data

9. MTA-STS and TLS-RPT Configuration

MTA-STS and TLS-RPT enhance email security by ensuring encrypted email transmission and reporting failures.

Example: MTA-STS Record

_mta-sts.example.com. IN TXT "v=STSv1; id=20190401T000000Z;"

  • v=STSv1 indicates the version
  • id specifies the version identifier for policy changes

Example: TLS-RPT Record

_tlsrpt.example.com. IN TXT "v=TLSRPTv1; rua=mailto:tlsrpt-reports@example.com;"

  • rua specifies where to send reports about TLS encryption failures

Conclusion

DNS providers are essential for ensuring domain functionality, email security, and internet reliability. Proper configuration of A, MX, TXT, CNAME, and DNSSEC records is fundamental for performance, security, and email deliverability. By implementing these correctly, domain owners can significantly enhance their infrastructure's reliability and security.

Protect your inbox, save time, and stay compliant. Subscribe to our newsletter for personalized email security audits, expert advice, and actionable tips.

Download to read the eBook

Schedule a Demo

Schedule a Demo

Discover more about yourDMARC and book a demo with sales.

Choose the Right Plan

Choose the Right Plan

Explore our flexible plans and pricing for perfectly fit solutions.

Learn more

Learn more

Explore our latest blogs for expert insights on email spoofing prevention.

Ready to get started?

See how YourDMARC can help your organization Work Protected™

Get Demo

Download to read the eBook