Add DNS server on pfsense machine

  • Dear users,

    I know pfsense machines have an included DNS solver, which creates a cache for all the clients connected.

    I want to add a DNS server, like bind9 for ubuntu, and I want to create a DNS authoritative zone for the suffix name chosen for the pfsense machine.

    Example: in the pfsense configuration I chosen "here" for the LAN suffix, and the name for the machine is "pfsense", so the DNS is this: ->

    I want to create many CNAME and A records in the "here" zone, like these:

    • ->
    • ->
    • ->
    • ->
    • etc...

    In bind9 configuration I have already done this, but I want to do it in pfsense machine.

    Is it possible? And how?


  • Hi,

    No need to install bind.
    Unbound - the resolver, covers you, it can do far more then just a simple DNS cache.

    You could do this :
    At the bottom of Services => DNS Resolver => General Settings you'l find "Host Overrides".
    Just add your host over there.

    Or this :
    Consider that your server, dlna gopro all use DHCP, add static dhcp leases on the DHCP server page. Add the host name for evert device and on the Services => DNS Resolver => General Settings page check " Static DHCP - Register DHCP static mappings in the DNS Resolver".

  • Yes, I know I have to add static DHCP leases, in such a way as to assign the same private IP address to the MAC address which I want.

    But the fact is to assign a different name (and more than one) from the DHCP client name.

    So I want to separate the DHCP server from the DNS resolver.

    Is it possible?


  • Well, DHCP and DNS are separate functionalities anyway.

    You can add as many host overrides into the DS (resolver or forwarder) as you want. They can point to the same IP if needed.

    Be careful : not having a DNS on pfSense can have nasty effect for the firewall itself : like the issue : "Help, my pfSense can upgrade neither install packages", etc.

  • Netgate Administrator

    You can install bind if you want, it's available as a pfSense package. But I agree it looks like Unbound can do everything you want.


  • @gertjan and @stephenw10 Can you show me how to do what you advice me, so I can choose the better?


  • Netgate Administrator

    It looks like you just need to add host overrides in Unbound for the hosts you want to resolve there.


  • Now I didn't understand good how to do.

    There are two cases:

    • if I want to override a existing DNS (e.g. "") assigning it an A record pointing to;
    • if I want to create a new DNS zone, which can be the same domain of the pfsense machine or not, creating many A and CNAME records.

    Can you explain please?


  • LAYER 8 Moderator

    @dam034 said in Add DNS server on pfsense machine:

    if I want to override a existing DNS (e.g. "") assigning it an A record pointing to;

    As already said: make a Host override, Host: forum, Domain: and assign it an internal IP Your pfSense afterwards will answer any request for with to your clients.

    if I want to create a new DNS zone, which can be the same domain of the pfsense machine or not, creating many A and CNAME records.

    You don't create a DNS zone per se. You don't need to, as you don't run a complete DNS server, that needs(!) a zone to load DNS entries. The DNS Resolver (unbound) can simply act on single Host Overrides and resolve the defined hostname to an IP.

    So you want to create "" and point it to Do the same as above with the forum!
    Host: dummy
    Domain: here
    -> save

    Afterwards check on a client on LAN with "host", "dig", "nslookup" (depending on your OS). It's as easy as that. If you configure pfSense in general settings to the domain "here" and configure DHCP accordingly, all static IP mappings you create with DHCP are also automatically known to the DNS resolver (check the corresponding box in the DNS resolver screen for that), so you can "populate" your "domain" .here with static IP mappings and overrides without having the need to create a complex DNS setup with bind.

  • I didn't understand only one step: if the pfsense domain is "here", DHCP and static IPs create the DNS resolver, can I add more hostnames in "here" domain in host override?

    And if there is a DHCP client named "hello", and in DNS override I want to point "" to another IP, can I do it?


  • LAYER 8 Global Moderator

    you don't have to register dhcp clients in unbound.

    And then just create whatever host overrides you want.

  • Have I to disable the DHCP registration to override a DHCP client name?


  • LAYER 8 Global Moderator

    You don't have to but having the same name that points to 2 different ips is never good thing. But you could have 2 or more names that point to the same IP.

  • Netgate Administrator

    No, you can add it as a host override and still register it. It overrides the dhcp lease registeration.

    Not sure why you would want to that though.


  • I'm thinking like that because they could be some DHCP clients names already registered in host override section.
    Indeed, I tried to add a host override name "" which points to an external IP, but when a DHCP client named "pohp" connects, the DNS points to the DHCP client machine, not to the external IP.

    Is it possible to override? Or have I to disable DHCP clients registration?


  • LAYER 8 Global Moderator

    Why would you point to an external IP if you have a client called pohp?

    Really not understanding your use case... But if your going to put in by hand IP address for clients fqdn, then there is ZERO point to having them register dhcp address into unbound..

    You have dhcp clients register in dns when your are NOT going to put in records by hand for them.

  • I did an example, now I can explain better:

    1. there is a DHCP client named "server";
    2. I want to point "" to it;
    3. I add an host override "" pointing to the machine written in step 1;
    4. there could be another machine which the DHCP client name is "server".

    I'm writing this because I don't administer fully the LAN, and some customers can connect to the wifi, and there could be some inconvenient DHCP clients names.

    Should have I to disable the DHCP registration or is there a way to stay secure?


  • Netgate Administrator

    Hmm, I tested that before posting and found it worked fine.

    Are you sure you are seeing the same hostname and domain?

    Edit: And it's still working after the client lease renewed.


  • LAYER 8 Global Moderator

    @dam034 said in Add DNS server on pfsense machine:

    there could be another machine which the DHCP client name is "server".

    And why would you need to resolve those? So don't have dhcp register in unbound.. And just put in the host overrides for the stuff you want/need to resolve.

    To be honest I really don't understand resolving dhcp clients by name in the first place.. If the box is important enough to you want to get to it by name.. Than it should have a reservation for dhcp so it always get the same IP. So register static dhcp. Or just set the box to be static IP and setup dns to resolve name to that IP, etc..

  • Netgate Administrator

    Well you could argue that clients with dynamic IPs are most likely to need DNS resolution to address them. 😉

    But I hear what you're saying.

    Either way I have that setup here and it works exactly as expected. I suspect there is actually a mismatch here. For example you enter client1 somewhere and you think it should resolve to an override you have as but in fact your client is trying to resolve soemthing different like because something is misconfigured.


  • LAYER 8 Global Moderator

    There is a difference between "clients" that get dhcp and "servers" he is using the name server.. While sure you might want to hand info out to the server via dhcp, so you can easy change stuff later like different router or dns, etc.

    But server should have a dhcp reservation.

    Random clients that are on and off the network, if you have a need to resolve them sure have register their names. But then why would you need to put in a host override? Why would you not just use different sub or domain then..

    Just still not getting this use case.

  • Netgate Administrator

    Yeah, the easiest way to avoid this would just be to not add dynamic leases to Unbound.

  • It's true and easiest disabling the DNS for DHCP clients.

    Thanks for all.

Log in to reply