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

    How do I configure pfSense to resolve local hostnames?

    Scheduled Pinned Locked Moved DHCP and DNS
    10 Posts 3 Posters 2.8k 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.
    • H
      hypernova
      last edited by

      If I try ping pfSense, I get a response:

      pfSense.localdoman

      If I ping "server" which is the hostname of my server, I get:

      ping: server: Name or service not known

      I'm new to pfSense and couldn't find any info about this. It seems like something that should work out of the box by default, but doesn't, at least in my case.

      ... I also found a lot of incorrect information on reddit... I say no more...

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

        Is your server getting an IP via dhcp? And you have register dhcp set in pfsense?

        Since you say you can ping just pfsense, that assumes your device is adding the domain suffix localdomain

        So if your server is via dhcp and your registering the dhcp you should be able to resolve it via what name it registered via dhcp.

        If you setup server static IP on the server, you could always just create a host override to resolve.

        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.7.2, 24.11

        1 Reply Last reply Reply Quote 0
        • H
          hypernova
          last edited by hypernova

          Hi,

          I am a bit confused by your reply, but here are some more details:

          The server has a DHCP reservation on pfsense. aka: Set static, by pfsense DHCP server - set by pfsense not by the server itself.

          Does that help answer the question?

          If I do ping server then I don't get any response.

          Edit: I should say the response is "Name or service not known"

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

            I take it you using unbound for dns on pfsense? If so make sure you have this checked.

            registerdns.png

            This will register all your dhcp reservations into your dns.. So if you setup a reservation for say server it would resolve via server.localdomain

            reservation.png

            So that is reservation I have for my PC, and you can see when I ping it just by name, it comes back fully qualified since my client auto adds my local.lan as suffix.

            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.7.2, 24.11

            1 Reply Last reply Reply Quote 0
            • H
              hypernova
              last edited by

              Thank you very much - seems like it was just that missing checkbox that resolved the issue.

              Is there a security reason for why this is not enabled by default?

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

                Not really a security reason.. I have been using unbound for so long, and updated through so many versions for such settings I am not always sure what is default or not default.

                There is no security concerns with having it enabled that is for sure.

                To be honest, the register dhcp I think is enabled by default.. But that can come with its own issues with unbound restarting upon lease renew of client and flushing the cache, and delays in startup if using pfblocker, etc.

                Believe if you have regsiter dhcp enabled, it will register clients be it they get reservation or not.. So since that is enabled there is no reason to also have the static enabled. But there are many scenario were you just want reservations registered and not all dhcp clients.. Which is how I have it configured. Notice the register dhcp is unchecked in mine.

                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.7.2, 24.11

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

                  @hypernova said in How do I configure pfSense to resolve local hostnames?:

                  Is there a security reason for why this is not enabled by default?

                  By default, these are both checked / enabled :

                  4fdc932d-3248-4994-9ae1-aaf5516ff08f-image.png

                  For "comfort", not security - reasons I advise you strongly to un check the first - as the image shows.

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

                  H 1 Reply Last reply Reply Quote 0
                  • H
                    hypernova @Gertjan
                    last edited by

                    For "comfort", not security - reasons I advise you strongly to un check the first - as the image shows.

                    Not sure what you refer to here. On my system the defaults were:

                    "DHCP Registration: Register DHCP leases in the DNS resolver" = OFF
                    "Static DHCP": Register DHCP static mappings in the DNS resolver" = OFF

                    What is the security risk of enabling the first option?

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

                      @hypernova said in How do I configure pfSense to resolve local hostnames?:

                      On my system the defaults were:
                      "DHCP Registration: Register DHCP leases in the DNS resolver" = OFF
                      "Static DHCP": Register DHCP static mappings in the DNS resolver" = OFF

                      I (should have) checked that.

                      The default config :

                      	<unbound>
                      		<enable/>
                      		<dnssec/>
                      		<active_interface/>
                      		<outgoing_interface/>
                      		<custom_options/>
                      		<hideidentity/>
                      		<hideversion/>
                      		<dnssecstripped/>
                      	</unbound>
                      

                      @hypernova said in How do I configure pfSense to resolve local hostnames?:

                      Not sure what you refer to here.
                      .... What is the security risk of enabling the first option?

                      "not security". Checking "DHCP Registration" will restart unbound on every incoming DHCP lease, as they are written to a file ( /etc/hosts) and for unbound (DNS) to take into account the (possible) changes in this file, it is started.
                      This can take time, especially for those who use huge DNSBL feeds, probably as they use the package pfBlockerng-devel. During this time, which can be tens of seconds : no DNS ...

                      As said, this subject comes alive on this forum ones a week or so. It often start with "Why my DNS stops working every hour ?"

                      Good news the settings isn't "set" by default. Pretty sure it was in the past. Thanks for pointing this out.

                      "Static DHCP" host => IP lines are also added to the /etc/hosts file, these tend to be very static == do not change. So this options can be set if you don't mind that de host name can be used to resolve devices locally.

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

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

                        Yeah its quite possible they use to be default, I do remember dhcp being enabled for sure - because of all the posts about unbound restarting..

                        It being off is prob a good default - but now will start seeing posts like this one ;)

                        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.7.2, 24.11

                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.