Cloudflare provides free DNS management with DDoS protection and CDN. This guide covers everything from initial setup to advanced DNS configuration.
Step 1 — Add Domain to Cloudflare
- Sign up at cloudflare.com → Add Site
- Cloudflare scans existing DNS records
- Update nameservers at your registrar
Essential DNS Records
# A record
Type: A | Name: @ | Content: YOUR_IP | Proxy: ON
# Mail server (Proxy must be OFF)
Type: A | Name: mail | Content: MAIL_IP | Proxy: OFF
Type: MX | Name: @ | Content: mail.yourdomain.com | Priority: 10
# SPF
Type: TXT | Name: @ | Content: v=spf1 mx ~all
# DMARC
Type: TXT | Name: _dmarc | Content: v=DMARC1; p=quarantine; rua=mailto:[email protected]
Cloudflare API for Automation
curl -X PUT "https://api.cloudflare.com/client/v4/zones/ZONE_ID/dns_records/RECORD_ID" -H "Authorization: Bearer YOUR_API_TOKEN" -H "Content-Type: application/json" -d '{"type":"A","name":"yourdomain.com","content":"NEW_IP","proxied":true}'
Conclusion
Cloudflare DNS provides enterprise-grade protection for free. Our team configures Cloudflare and DNS management for production environments.
Comments