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

    Host name help

    Scheduled Pinned Locked Moved General pfSense Questions
    18 Posts 4 Posters 1.3k 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
      Hammer8
      last edited by

      Hi, on my LAN, I have devices which uses DHCP to get ip address and some devices which I assign static ip’s. How can I associate a host name to those which are statically assigned? This is a Windows network and I would like to be able to type in the name of the host in Explorer to access that host’s shares vs. typing in the IP address of the host. I used to be able to do this when I used a Netgear router, but the hostnames no longer work with pfsense. I’m sure someone has asked this previously, but I can’t seem to locate a solution so apologies for the duplicate post, but thank you in advance for your help.

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

        Assuming you're using pfSense as your DHCP server, simply map the MAC address of the device to an IP address. You can then configure the DNS server to point to that address.

        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
        • johnpozJ
          johnpoz LAYER 8 Global Moderator
          last edited by johnpoz

          @Hammer8 said in Host name help:

          type in the name of the host in Explorer to access that host’s shares vs. typing in the IP address

          On a windows network, as long as its the same L2 network windows will broadcast for the hostname and the host if on will see its name in the broadcast and answer hey I am here at this IP. Unless you have modified windows default behavior..

          The cleaner way to do it is use the fqdn, ie host.domain.tld vs just host.. This will do a dns query for that name - so then dns will resolve. If you setup a dhcp reservation so that device always gets the same IP, you can just have unbound register the fqdn.. So when asking dns for host.domain.tld it will resolve to the IP.

          If you want to just use hostname, as long as your box your wanting to query the host name from has proper search suffix enabled it will auto do a query for the fqdn..

          But no dns will not respond to just a host name query without it being fully qualified.

          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
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by

            But it will append the domain given to it via DHCP which will be the firewall domain specified in General Setup unless you've specified something different in the DHCP server config.

            Steve

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

              Hmm...thank you all, but I’m not sure what I need to do. For example, I have a Windows 10 PC called Piano which has a static ip of 192.168.1.33

              I can access its shares by typing //192.168.1.33 in explorer. I would like to access the shares by typing in //Piano instead. I see under Diag/ARP table in pfsense that the hosts which get their ip’s via DHCP has the host name populated, but for those which I assign static IP’s, the host name field is blank.

              Thank you.

              JKnottJ 1 Reply Last reply Reply Quote 0
              • stephenw10S
                stephenw10 Netgate Administrator
                last edited by stephenw10

                Exactly, so add them as static IP reservations in the DHCP server setup even if they don't actually pull an IP via DHCP.

                Then in the DNS resolved make sure you have Register DHCP static mappings in the DNS Resolver enabled.

                Steve

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

                  Assign the machine a static via the dhcp server, ie a reservation..

                  For example I have a windows 10 machine name i5-win, yes very creative since it a I5 cpu running windows ;)

                  dhcpreservations.png

                  So via dhcp it will always get that 192.168.9.100 IP, since my domain in pfsense is set to local.lan - the fqdn for this host will be i5-win.local.lan

                  Since I have unbound set to register dhcp reservations in dns, I will be able to resolve that via the fqdn.. Since windows will auto add the domain to a query.. I can do just query for the host name and get back the fqdn

                  > i5-win
                  Server:  sg4860.local.lan
                  Address:  192.168.9.253
                  
                  Name:    i5-win.local.lan
                  Address:  192.168.9.100
                  

                  ping of just host, any box that uses a search suffix for the domain your using will return the fqdn and IP

                  root@uc:/tmp# ping i5-win
                  PING i5-win.local.lan (192.168.9.100) 56(84) bytes of data.
                  64 bytes from i5-win.local.lan (192.168.9.100): icmp_seq=1 ttl=127 time=0.748 ms
                  64 bytes from i5-win.local.lan (192.168.9.100): icmp_seq=2 ttl=127 time=0.728 ms
                  64 bytes from i5-win.local.lan (192.168.9.100): icmp_seq=3 ttl=127 time=0.632 ms
                  

                  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 1
                  • H
                    Hammer8
                    last edited by

                    Thank you! That did the trick. Appreciate everyone’s help. Out of curiosity, why is it under pfsense, I need to specify a MAC address and with my Netgear router, I didn’t have to? Not a big deal, but will need to change the entry in Pfsense if my hardware changes.

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

                      @Hammer8 said in Host name help:

                      Hmm...thank you all, but I’m not sure what I need to do.

                      If the computer is connected to the network, it should have an address. You can go into the Status > DHCP Leases to find that address. You can then click on the "+", 2nd from right, to add a static mapping. You then set the address you want and give it a host name. When you have done this, the device will have a static address and a host name that you can use.

                      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
                      • stephenw10S
                        stephenw10 Netgate Administrator
                        last edited by stephenw10

                        It's not actually using the MAC address there. Entering it as a static lease is a convenient way of getting the hostname/IP address into the DNS resolver. You could also add those as host overrides in the DNS resolver directly and it would have the same effect.
                        Adding it as a static lease means you don't accidentally assign the IP to another device as it's already in table. It also means if that device changes from static to DHCP for some reason it will pull the same IP address.

                        Steve

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

                          I your client would of been dhcp already, you wouldn't of had to call out the mac - since pfsense would of already known it and you could just clicked the little add button.. in the lease table and put in the IP you wanted the client to use (outside of the dhcp scope)

                          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
                          • H
                            Hammer8 @stephenw10
                            last edited by

                            @stephenw10 said in Host name help:

                            It's not actually using the MAC address there. Entering it as a static lease is a convenient way of getting the hostname/IP address into the DNS resolver. You could also add those as host overrides in the DNS resolver directly and it would have the same effect.
                            Adding it as a static lease means you don't accidentally assign the IP to another device as it's already in table. It also means if that device changes from static to DHCP for some reason it will pull the same IP address.

                            Steve

                            Hi, I deleted the entries I entered previously under DHCP Static Mappings and re-entered them as host overrides under DNS resolver and it doesn't seem to work. Eg., I can't access the shares as \Piano in Windows explorer. These machines are all part of a WORKGROUP and not part of a DOMAIN so under domain, I entered "local". Is there anything else I need to do? Thank you!

                            1 Reply Last reply Reply Quote 0
                            • stephenw10S
                              stephenw10 Netgate Administrator
                              last edited by

                              It has to match whatever they were showing up as in the dhcp leases. I expect that to be whatever the pfSense domain is unless you set something specifically in the dhcp server.
                              Is there some reason you don't want to use dhcp static lease entries for this?

                              Steve

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

                                Your machine will use a domain to resolve dns.. workgroups have nothing to do with it..

                                In your pfsense what does it say for the domain, see my post above.

                                On your client what does it say.. do an ipconfig /all

                                $ ipconfig /all
                                
                                Windows IP Configuration
                                
                                   Host Name . . . . . . . . . . . . : i5-win
                                   Primary Dns Suffix  . . . . . . . : local.lan
                                   Node Type . . . . . . . . . . . . : Broadcast
                                   IP Routing Enabled. . . . . . . . : No
                                   WINS Proxy Enabled. . . . . . . . : No
                                   DNS Suffix Search List. . . . . . : local.lan
                                

                                See the local.lan as the primary domain suffix, and the search list..

                                If you setup a host override for piano.local - then that is what you would have to do a specific dns query for.

                                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
                                • H
                                  Hammer8 @stephenw10
                                  last edited by

                                  @stephenw10 said in Host name help:

                                  It has to match whatever they were showing up as in the dhcp leases. I expect that to be whatever the pfSense domain is unless you set something specifically in the dhcp server.
                                  Is there some reason you don't want to use dhcp static lease entries for this?

                                  Steve

                                  Yes, I remote access into these machines and so need a static IP. When you say it has to match the dhcp leases, how can I find what that is? When I go to view the dhcp leases, these machines don't show up...I thought is was because they are set up as static IP's. Note I set these up with static ip's within Windows.

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

                                    What does remote access have to do with anything?? When you set a dhcp reservation - that machine will always get that IP.

                                    You can set them up on your machine directly if you want - lot of extra work for nothing.. But your host override will work as well as long as your fqdn (fully qualified domain name) is correct and that is what you query for.

                                    Here..

                                    override.png

                                    $ ping piano.local
                                    
                                    Pinging piano.local [192.168.9.10] with 32 bytes of data:
                                    Reply from 192.168.9.10: bytes=32 time<1ms TTL=64
                                    Reply from 192.168.9.10: bytes=32 time<1ms TTL=64
                                    Reply from 192.168.9.10: bytes=32 time<1ms TTL=64
                                    

                                    piano.png

                                    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

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

                                      @johnpoz said in Host name help:

                                      But your host override will work as well as long as your fqdn (fully qualified domain name) is correct and that is what you query for.

                                      As I mentioned above, it's very easy to just get a DHCP address, find it in the DHCP leases and change it to a static mapping and provide a host name, all on the same page. Otherwise, you have to determine the MAC address and then configure the mapping.

                                      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...

                                      H 1 Reply Last reply Reply Quote 0
                                      • H
                                        Hammer8 @JKnott
                                        last edited by

                                        Thanks. I get it now. Don't specify the static ip on the pc. Set it to use DHCP and then in pfsense, make it a static ip on the DHCP leases page. Works great! Thank you.

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