Skip to content

Nuface Blog

隨意隨手記 Casual Notes

Menu
  • Home
  • About
  • Services
  • Blog
  • Contact
  • Privacy Policy
  • Login
Menu

Understanding Unbound DNS in OPNsense — Function, Principles, and Integration with BIND9

Posted on 2025-11-102025-11-10 by Rico

🧠 1. What is Unbound DNS?

Unbound is a DNS Resolver developed by NLnet Labs.
It’s designed to resolve domain names for internal users — that is, to find the real IP address of a domain such as www.google.com.

Unlike BIND9, which is commonly used as an Authoritative DNS server to host your company’s domain records, Unbound’s role is to perform recursive lookups on behalf of clients inside your network.


⚙️ 2. Core Functionality and Features

FeatureDescription
Recursive DNS ResolverQueries root DNS servers directly and resolves names step by step.
DNS Forwarder ModeCan forward queries to specific DNS servers (e.g., 8.8.8.8, 1.1.1.1, or your internal BIND9).
DNS over TLS (DoT)Supports encrypted DNS queries for better privacy.
DNS Rebind ProtectionPrevents malicious domains from returning private IPs.
Blocklist / OverrideAdd custom domain overrides or block unwanted domains (ads, trackers).
DHCP IntegrationAutomatically registers DHCP hostnames.
Local CachingCaches DNS results to speed up repeated lookups.

🧩 3. How Unbound Works

Here’s a simplified process of how Unbound resolves DNS queries:

Client → OPNsense (Unbound) → Root DNS → TLD → Authoritative DNS → Return IP → Cache → Client

Step-by-step:

  1. A user’s computer sends a DNS query to the OPNsense firewall.
  2. Unbound checks its local cache — if the result exists, it returns immediately.
  3. If not, Unbound recursively queries the Internet’s DNS hierarchy.
  4. The resolved IP is stored in cache and returned to the user.
  5. If Forwarding Mode is enabled, Unbound will simply forward queries to another DNS server (like your BIND9).

⚖️ 4. Unbound vs. BIND9 — Key Differences

ComparisonUnboundBIND9
Primary RoleRecursive ResolverAuthoritative DNS Server
Maintains ZonesLimited (for overrides only)Full zone management
Root HintsBuilt-inRequires manual maintenance
Query TypeRecursive / ForwardingAuthoritative / Forwarding
ManagementWeb UI (OPNsense)Text-based config files
Typical UseInternal name resolution, cachingHosting company/public domains

🧱 5. Will Unbound Conflict with BIND9?

Not necessarily — as long as they don’t both bind to the same interface or port (53).

✅ Scenario 1: Running on different hosts

No problem at all.

OPNsense (Unbound) → internal DNS resolver  
BIND9 server → authoritative public DNS

⚙️ Scenario 2: Running on the same host

Avoid conflicts by:

  • Binding each service to a different interface or IP address: Unbound → listens on LAN (53) BIND9 → listens on WAN (53)
  • Or make Unbound forward all requests to BIND9: OPNsense → Services → Unbound DNS → General → Enable Forwarding Custom DNS servers: 10.0.0.5 (BIND9) This way, Unbound handles caching, filtering, and security checks, while BIND9 handles the actual resolution.

🧰 6. Typical Enterprise Architectures

Architecture TypeDescription
1. Unbound (internal resolver) + BIND9 (public authoritative)The most common setup. Internal users query Unbound, which recursively resolves or forwards to external DNS servers.
2. Unbound forwarding to BIND9Suitable when your BIND9 uses internal/external “views” for split DNS.
3. Unbound for LAN, BIND9 for DMZ/public zoneLayered design to separate internal and external name resolution.

🔐 7. Security & Performance Advantages

FeatureBenefit
DNS CacheSpeeds up repeated queries and reduces external traffic.
DNSSEC ValidationEnsures DNS responses haven’t been tampered with.
Rebind ProtectionBlocks malicious private IP responses.
DNS-over-TLSEncrypts DNS traffic for privacy.
Centralized ManagementFully managed via OPNsense Web GUI.

🧮 8. Example Network Setup

[Client PC] → 10.0.0.1 (OPNsense Unbound)
        ↓
   (Cache lookup)
        ↓
   Forward to BIND9 (10.0.0.5)
        ↓
   BIND9 resolves → IP returned → Cache → Client

✅ 9. Conclusion

Unbound and BIND9 are not competitors — they complement each other.

  • Unbound is ideal for internal DNS resolution, caching, and DNSSEC validation.
  • BIND9 continues to serve as your authoritative DNS for public-facing domains.

A properly designed architecture can integrate both seamlessly:

  • Unbound handles private LAN queries and filtering.
  • BIND9 hosts your corporate or external DNS zones.

Together, they provide a fast, secure, and layered DNS infrastructure suitable for modern enterprises.

Recent Posts

  • Postfix + Let’s Encrypt + BIND9 + DANE Fully Automated TLSA Update Guide
  • Postfix + Let’s Encrypt + BIND9 + DANE TLSA 指紋自動更新完整教學
  • Deploying DANE in Postfix
  • 如何在 Postfix 中部署 DANE
  • DANE: DNSSEC-Based TLS Protection

Recent Comments

  1. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on High Availability Architecture, Failover, GeoDNS, Monitoring, and Email Abuse Automation (SOAR)
  2. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on MariaDB + PostfixAdmin: The Core of Virtual Domain & Mailbox Management
  3. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Daily Operations, Monitoring, and Performance Tuning for an Enterprise Mail System
  4. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Final Chapter: Complete Troubleshooting Guide & Frequently Asked Questions (FAQ)
  5. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Network Architecture, DNS Configuration, TLS Design, and Postfix/Dovecot SNI Explained

Archives

  • December 2025
  • November 2025
  • October 2025

Categories

  • AI
  • Apache
  • Cybersecurity
  • Database
  • DNS
  • Docker
  • Fail2Ban
  • FileSystem
  • Firewall
  • Linux
  • LLM
  • Mail
  • N8N
  • OpenLdap
  • OPNsense
  • PHP
  • QoS
  • Samba
  • Switch
  • Virtualization
  • VPN
  • WordPress
© 2025 Nuface Blog | Powered by Superbs Personal Blog theme