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

    DNS multiple hostnames for IP (like /etc/hosts)

    Scheduled Pinned Locked Moved DHCP and DNS
    6 Posts 3 Posters 2.6k 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.
    • S
      socrates324
      last edited by

      Hello Experts,

      I'm considering to by a netgate appliance (SG-1100) in order to start my "learning curve" with pfsense and to place it behind by ISP's router at home.

      One thing I miss from the current setup (with ISP's router) is to assign multiple hosts names to a DHCP provided IP address. I had this working some decades ago but sadly don't remember how.

      To phrase it another way, I'd like to have the functionality of /etc/hosts (but with DHCP assigned IP addresses):

      from "man hosts"


      This  manual page describes the format of the /etc/hosts file.  This file is a simple text file that associates IP addresses with hostnames, one line
             per IP address.  For each host a single line should be present with the following information:
      
                    IP_address canonical_hostname [aliases...]
      

      Is there any way to do this with pfsense (web-ui or console, as long as it is persistant)?

      Thanks in advance!

      Cheers,
      Soc

      1 Reply Last reply Reply Quote 0
      • JKnottJ
        JKnott
        last edited by

        It's very easy to do. On the DNS resolver page, create as many host overrides as you wish.

        PfSense running on Qotom mini PC
        i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
        UniFi AC-Lite access point

        I haven't lost my mind. It's around here...somewhere...

        1 Reply Last reply Reply Quote 0
        • S
          socrates324
          last edited by

          Hi JKnott,
          thank you very much for your fast response.

          Glad to hear, that "it works (TM)" ;-)

          I just installed pfsense in a test VM and the host override settings in

          Services / DNS Resolver / General Settings / Edit Host Override

          requires to specify an IP Address.

          So it seems to me that this approach does only work with static IP addresses but not DHCP?

          Thanks,
          Soc

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

            Set a reservation for this device so it always gets the same IP... Not understanding issue..

            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

            1 Reply Last reply Reply Quote 0
            • S
              socrates324
              last edited by

              Hi johnpoz,

              I'm sorry if I appear "NOOBish" ... but I was "of of practise" for 15 years :-(

              But your post made me remember "static leases" ... I think I'm good now :-)

              kind regards,
              Soc

              1 Reply Last reply Reply Quote 0
              • JKnottJ
                JKnott @socrates324
                last edited by

                @socrates324 said in DNS multiple hostnames for IP (like /etc/hosts):

                So it seems to me that this approach does only work with static IP addresses but not DHCP?

                That depends on whether there's a static mapping for the address. With static mappings, the addresses are the same as static. Otherwise, they could change, which means there's no consistent address to point to. One thing some DNS servers can do is create an alias, where one name refers to another. I do this with my IPv4 WAN address, where my host name is long and based on the firewall and modem MAC addresses. I just create an alias, in my own domain, that points to the long host name. I don't know if that's supported with pfSense.

                PfSense running on Qotom mini PC
                i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
                UniFi AC-Lite access point

                I haven't lost my mind. It's around here...somewhere...

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