Flexible A/AAAA Record Matching

A records map domain names to IPv4 addresses, and AAAA records map to IPv6 addresses. Flexible matching allows you to verify specific IP addresses are configured while permitting customers to add additional addresses for load balancing, redundancy, or multi-CDN setups.

Why Flexible A/AAAA Matching

Modern applications often use multiple IP addresses for high availability, geographic distribution, and failover. Exact matching becomes problematic when customers need to add or adjust their infrastructure.

The Exact Matching Problem

curl -X POST https://api.dnsradar.dev/monitors \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "api.piedpiper.com",
  "record_type": "A",
  "expected_value": [
    "1.2.3.4",
    "5.6.7.8"
  ],
  "is_exact_match": true
}'

If the customer adds a third server for load balancing (9.10.11.12), exact matching triggers a false MISMATCH alert.

Enabling Flexible Matching

Use is_exact_match: false to verify your required IPs exist while allowing additional addresses:

curl -X POST https://api.dnsradar.dev/monitors \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "api.piedpiper.com",
  "record_type": "A",
  "expected_value": [
    "1.2.3.4",
    "5.6.7.8"
  ],
  "is_exact_match": false
}'

How It Works

With flexible matching for A/AAAA records, DNSRadar:

  1. Verifies all IP addresses in your expected_value are present
  2. Ignores additional IP addresses not in your list
  3. Considers the monitor VALID as long as your required IPs exist
  4. Triggers MISMATCH only if required IPs are removed

Valid Configurations

With the flexible configuration above, these A record sets would all be VALID:

# Exactly your IPs
1.2.3.4
5.6.7.8

# With additional IPs
1.2.3.4
5.6.7.8
9.10.11.12

# Mixed with many others
1.2.3.4
5.6.7.8
10.20.30.40
50.60.70.80
100.110.120.130

All contain your required IP addresses 1.2.3.4 and 5.6.7.8, so they pass validation.

IPv6 (AAAA) Monitoring

Flexible matching works identically for IPv6 addresses:

curl -X POST https://api.dnsradar.dev/monitors \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "piedpiper.com",
  "record_type": "AAAA",
  "expected_value": [
    "2001:db8::1",
    "2001:db8::2"
  ],
  "is_exact_match": false
}'

When Monitors Trigger

A MISMATCH alert is triggered if:

  • One or more of your required IP addresses are removed
  • All A/AAAA records are removed
  • DNS query returns an error

Common Use Cases

CDN and Origin Monitoring

Ensure your origin server remains configured while allowing CDN IPs:

curl -X POST https://api.dnsradar.dev/monitors \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "cdn.piedpiper.com",
  "record_type": "A",
  "expected_value": [
    "203.0.113.10"
  ],
  "is_exact_match": false,
  "group": "cdn-configuration"
}'

Dual Stack Monitoring

Monitor both IPv4 and IPv6:

curl -X POST https://api.dnsradar.dev/monitors/bulk \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "monitors": [
    {
      "domain": "piedpiper.com",
      "record_type": "A",
      "expected_value": [
        "1.2.3.4"
      ],
      "is_exact_match": false
    },
    {
      "domain": "piedpiper.com",
      "record_type": "AAAA",
      "expected_value": [
        "2001:db8::1"
      ],
      "is_exact_match": false
    }
  ],
  "group": "dual-stack-monitoring"
}'

Load Balancer Configuration

Ensure specific load balancer IPs remain configured:

curl -X POST https://api.dnsradar.dev/monitors \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "app.piedpiper.com",
  "record_type": "A",
  "expected_value": [
    "10.0.1.100",
    "10.0.2.100"
  ],
  "is_exact_match": false
}'

Multi-Region Deployment

Monitor presence of regional endpoints:

curl -X POST https://api.dnsradar.dev/monitors \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "api.piedpiper.com",
  "record_type": "A",
  "expected_value": [
    "52.0.0.1",
    "13.0.0.1",
    "18.0.0.1"
  ],
  "is_exact_match": false,
  "frequency": 5
}'

Best Practices

  1. Monitor Critical IPs Only: Specify only the IP addresses essential to your service
  2. Use Flexible Matching by Default: Enable it unless you need strict IP control
  3. Combine with Health Checks: DNS monitoring verifies configuration; use separate health checks for service availability
  4. Monitor Both IPv4 and IPv6: Create separate monitors for A and AAAA records
  5. Group Related Monitors: Organize monitors by service or infrastructure component

Advanced Scenarios

Anycast IP Monitoring

Verify anycast IPs are advertised:

curl -X POST https://api.dnsradar.dev/monitors \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "anycast.piedpiper.com",
  "record_type": "A",
  "expected_value": [
    "192.0.2.1"
  ],
  "is_exact_match": false,
  "frequency": 5
}'

Subnet Monitoring

Monitor multiple IPs from the same subnet:

curl -X POST https://api.dnsradar.dev/monitors \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "cluster.piedpiper.com",
  "record_type": "A",
  "expected_value": [
    "10.0.1.10",
    "10.0.1.11",
    "10.0.1.12"
  ],
  "is_exact_match": false
}'

Failover Configuration

Ensure both primary and failover IPs exist:

curl -X POST https://api.dnsradar.dev/monitors \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "service.piedpiper.com",
  "record_type": "A",
  "expected_value": [
    "203.0.113.10",
    "203.0.113.20"
  ],
  "is_exact_match": false,
  "group": "high-availability"
}'

Integration Examples

Infrastructure as Code

# Terraform/Pulumi example
monitors:
  - domain: api.example.com
    record_type: A
    expected_value:
      - 1.2.3.4  # Primary load balancer
      - 5.6.7.8  # Backup load balancer
    is_exact_match: false
    frequency: 5
    group: production-api

Automated Monitoring Setup

// Automatically monitor all production services
const services = await getProductionServices()

const monitors = services.map(service => ({
  domain: service.domain,
  record_type: service.ipv6 ? 'AAAA' : 'A',
  expected_value: service.criticalIPs,
  is_exact_match: false,
  frequency: 5,
  group: 'production-infrastructure'
}))

await dnsradar.monitors.bulkCreate({ monitors })

Comparing Flexible vs Exact Matching

ScenarioExact MatchFlexible Match
Customer adds IPs❌ MISMATCH✅ VALID
Customer removes required IP❌ MISMATCH❌ MISMATCH
Customer removes non-required IP❌ MISMATCH✅ VALID
IP order changes✅ VALID✅ VALID
All IPs removed❌ MISMATCH❌ MISMATCH

Monitoring Complete Service Stack

curl -X POST https://api.dnsradar.dev/monitors/bulk \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "monitors": [
    {
      "domain": "piedpiper.com",
      "record_type": "A",
      "expected_value": [
        "1.2.3.4"
      ],
      "is_exact_match": false
    },
    {
      "domain": "www.piedpiper.com",
      "record_type": "CNAME",
      "expected_value": "piedpiper.netlify.app"
    },
    {
      "domain": "api.piedpiper.com",
      "record_type": "A",
      "expected_value": [
        "10.0.1.100"
      ],
      "is_exact_match": false
    },
    {
      "domain": "api.piedpiper.com",
      "record_type": "AAAA",
      "expected_value": [
        "2001:db8::1"
      ],
      "is_exact_match": false
    }
  ],
  "group": "service-infrastructure",
  "frequency": 5
}'

Next Steps