Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    DNS/DHCP strategy

    Scheduled Pinned Locked Moved General pfSense Questions
    7 Posts 3 Posters 954 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      aagaag
      last edited by aagaag

      This question is admittedly only peripherally related to pfSense. I have a Netgate 4100 acting as a gateway/firewall whose WAN interface is attached to a fiber modem, whereas the LAN interface provides DHCP services for the local network (approx. 20 devices), and thus far no internal DNS. I haven't specified any DNS servers on pfSense, and things seems to work well; it apparently uses automatically the DNS servers of the Internet provider.

      Now I would like to have both DHCP and internal DNS served by a Linux virtual ,machine, whereas the DNS resolver for external IP addresses should be routed through the gateway. My question is: how do I instruct pfSense to do that? Or would everything happen in the linux box whereas nothing needs to be specified on pfSense? Apologies for the naivety of my questions; I am in molecular biology and understand very little of network plumbing...

      johnpozJ 1 Reply Last reply Reply Quote 0
      • johnpozJ
        johnpoz LAYER 8 Global Moderator @aagaag
        last edited by

        @aagaag said in DNS/DHCP strategy:

        it apparently uses automatically the DNS servers of the Internet provider.

        No not really - what pfsense does out of the box is resolve.. It talks to the root servers, and resolves what your looking for - out of the box it does not forward to anything.. Look up the difference between a dns forwarder and resolver.

        As to resolving local resources - again out of the box the dhcp server would hand out dhcp clients pfsense IP for their dns. So any client on your network asking pfsense IP for dns would be able to resolve any records that are in pfsense dns be that dhcp registration (not recommended because it restarts dns on any dhcp) static dhcp registration. And or host overrides you set in unbound.

        An intelligent man is sometimes forced to be drunk to spend time with his fools
        If you get confused: Listen to the Music Play
        Please don't Chat/PM me for help, unless mod related
        SG-4860 24.11 | Lab VMs 2.8, 24.11

        A 1 Reply Last reply Reply Quote 1
        • A
          aagaag @johnpoz
          last edited by

          @johnpoz thank you for taking the time to educate/advise me! So, I can

          • leave pfSense as is, without changing anything except disabling its DHCP server
          • install dnsmasq on the linux box, and configure it to:
          • provide DHCP
          • provide DNS for LAN addresses
          • forward to pfSense every DNS query that it cannot resolve
            Correct?
          johnpozJ 1 Reply Last reply Reply Quote 0
          • johnpozJ
            johnpoz LAYER 8 Global Moderator @aagaag
            last edited by

            @aagaag you could if you want to.. Not sure why? What are you going to be doing on this other linux box with dhcp/dns that pfsense can not do?

            But sure if just a learning exercise?

            An intelligent man is sometimes forced to be drunk to spend time with his fools
            If you get confused: Listen to the Music Play
            Please don't Chat/PM me for help, unless mod related
            SG-4860 24.11 | Lab VMs 2.8, 24.11

            A 1 Reply Last reply Reply Quote 1
            • A
              aagaag @johnpoz
              last edited by

              @johnpoz definitely a learning exercise. I would like to keep track of the network inventory in a mysql table, and use a script to modify the DNS/DHCP entries whenever equipment is expanded or replaced. My (possibly incorrect) understanding is that it would be clunky to do that in pfSense, as it would require the inventory table to be converted into XML (and it's unclear to me if uploading can be automated. But if it can be done in a reasonably robust/automated manner, then yes, by all means!

              GertjanG 1 Reply Last reply Reply Quote 0
              • GertjanG
                Gertjan @aagaag
                last edited by

                @aagaag said in DNS/DHCP strategy:

                robust

                I've a suggestion, or learning exercise :
                Select the second or third option from here :

                2f8beddd-fa3c-4abd-b268-a87ebe7bee8e-image.png

                Before you activate this mode of the pfSense DHCP server, go to the bottom of the same DHCP server page, and add all (ALL) known devices to the list.

                Like :

                63c498c3-b0a2-4449-abea-272a34cafdd8-image.png

                Now, no more administration. No more scripts, MySQL or whatever.
                All connected and known to you devices are listed here, with one click :

                d707b206-a472-4937-a3c4-b42964ddbaf8-image.png

                As soon as a new device, unknown to you, tries to connect to your network, "DHCP" won't give it a lease ( won't give it an IP etc).
                The owner and user of the device (the monocular one) will come to you .... and you've all the time to analyze the situation. If you decide so, you add a "DHCP Static Mappings" for this device.

                Everything is nicely stored in one place with minimal administration overhead.

                If needed, you can add a firewall rule to the interface, where you only allow the IPs that are part of the list you've assigned with the "DHCP Static Mappings" list.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                A 1 Reply Last reply Reply Quote 1
                • A
                  aagaag @Gertjan
                  last edited by

                  @Gertjan Thank you so much for taking the time to analyze my question and provide the screenshots. I appreciate. However, your scenario does not quite correspond to my use case. I'd rather devise a way to enter a device in a database and then automatically propagate its reserved IP, DNS name, etc.

                  1 Reply Last reply Reply Quote 0
                  • GertjanG Gertjan referenced this topic on
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.