Configure BIND on OPNsense 25.1 as internal DNS server for AWS VPC

Overview

ComponentValue
Internal domainmaksonlee.com
DNS server IP10.0.128.4 (OPNsense LAN IP)
System DNS127.0.0.1 (loopback)
ForwarderAWS DNS 10.0.0.2
VPC CIDR10.0.0.0/16
NS recordopnsense.maksonlee.com
  1. Install and Enable BIND Plugin
  • Go to: System → Firmware → Plugins
  • Install: os-bind
  • Reboot if needed
  • Enable BIND in: Services → BIND → Configuration General Enable BIND Daemon
  1. Configure Access Lists
  • Go to: Services Bind Configuration ACLs
  • Click Add
    Enabled: yes
    Name: vpc_clients
    Network List: 10.0.0.0/16 (VPC), 127.0.0.1/32 (loopback, for OPNsense itself)
  • Save
  1. Create Primary Zone
  • Go to: Services Bind Configuration Primary Zones
  • Click Add Zone
    Enabled: checked
    Zone Name: maksonlee.com
    Allow Query: vpc_clients
    Mail Admin: admin.maksonlee.com
    DNS Server: opnsense.maksonlee.com
  • Save
  1. Add Zone Records
  • Go to: Services Bind Configuration Primary Zones
  • Select zone maksonlee.com and add following records
EnabledZoneNameTypeValue
Yesmaksonlee.comappA10.0.128.5
Yesmaksonlee.comopnsenseA10.0.128.4
Yesmaksonlee.comNSopnsense
  • Save
  1. Configure BIND Global Settings
  • Go to: Services Bind Configuration General
  • Set
    Listen IPs: 10.0.128.4, 127.0.0.1
    Listen Port: 53
    DNS Forwarders: 10.0.0.2
    Recursion: vpc_clients
    Allow Query: vpc_clients
  • Save
  1. Set OPNsense System DNS
  • Go to: System Settings General
  • Set
    DNS servers: 127.0.0.1
    Allow DNS server list to be overridden by DHCP/PPP on WAN: unchecked
    Do not use the local DNS service as a nameserver for this system: unchecked
  • Save
  1. Create and Associate AWS DHCP Option Set
  • Go to: AWS Console VPC DHCP Option Sets
  • Click Create DHCP option set
    DHCP option set name: my
    Domain name: maksonlee.com
    Domain name servers: 10.0.128.4
  • Save
  • Go to: AWS Console VPC Your VPCs
  • Select your VPC Actions Edit DHCP options set
  • Choose your new set Save
  1. Apply DNS to Existing EC2s

Existing EC2s don’t auto-update DHCP, so just reboot:

sudo reboot

Check:

resolvectl status
Global
         Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
  resolv.conf mode: stub

Link 2 (ens5)
    Current Scopes: DNS
         Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 10.0.128.4
       DNS Servers: 10.0.128.4
        DNS Domain: maksonlee.com
  1. Firewall Rules (if needed)

Go to: Firewall Rules LAN

Make sure there’s rule allowing:

SourceDestinationDestination port rangeProtocolAction
10.0.0.0/1610.0.128.453TCP/UDPPass

If you have “Default allow LAN to any” — you’re all good.

  1. Final Tests
dig app.maksonlee.com
dig google.com

Both internal and public names should resolve properly.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top