DHCP DNS registration

Started by Font0712, October 19, 2023, 10:51:31 AM

Previous topic - Next topic
Hi Team!

New to OPNSense and firewalls in general. Some previous experience with FortiNet but limited.

I have setup a Firewall at home behind the router:



I have set up OPNSense as DHCP server for the LAN part and DNS with Unbound DNS. So far everything is working fine. But I have a lot of temporary virtual machines on the proxmox server working on DHCP.

I wish to register these VMs name's automatically with their assigned DHCP address and name, but the information  on internet and manuals is confusing, it almost always refers to Dynamic DNS for public IPs, not for internal DHCP leases.

Maybe there is some info/tutorial/video I can check to setup this?

Thanks!

October 19, 2023, 11:11:12 AM #1 Last Edit: October 19, 2023, 11:23:54 AM by Monviech
For this to work your DNS structure should be:

- All hosts (except Raspberry Pi) use Unbound OPNsense as DNS Server
- Query Forwarding from OPNsense Unbound to your Raspberry Pi
- Raspberry Pi has the root DNS hints and does the recursive DNS lookups into the internet.
(I use this combination too, with pihole+unbound on a Raspberry Pi)

Then in Unbound on the OPNsense to to "Services: Unbound DNS: General" and activate:
DHCP Registration   - Register DHCP leases
DHCP Static Mappings - Register DHCP static mappings

After that it should work as you want.

You can test easily if your leases are registered by going into the shell and doing:
cat /var/unbound/dhcpleases.conf
Hardware:
DEC740

Hi Monviech!

Worked perfectly fine.

I just had to set up query forwarding to the Pi (it was not configured but I assume OPNSense was using it as DNS server as it was configured that way on OPNSense) and added DHCP Domain Override to my internal domain.

Thanks!