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

Use hostname to reach OpenVPN clients

Scheduled Pinned Locked Moved OpenVPN
57 Posts 4 Posters 7.5k 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.
  • Z
    zapador @Unoptanio
    last edited by Sep 16, 2023, 4:33 PM

    @Unoptanio Ah alright. Not sure exactly why that is, seems a bit odd. Is this an acceptable solution though, manually creating the Host Override entries?

    U 1 Reply Last reply Sep 16, 2023, 4:40 PM Reply Quote 0
    • U
      Unoptanio @zapador
      last edited by Unoptanio Sep 16, 2023, 4:43 PM Sep 16, 2023, 4:40 PM

      @zapador

      could it be a bug in the pfsense 2.7.0 version?

      For now I'll leave it alone that it works.

      I'll tell you this last thing:
      on the office network 192.168.1.x I have a machine called "Server5k".
      If I go to pfsense--> diasgnostics--> DNS lookup it doesn't resolve the name
      does not find any machine names on the 192.168.1.x network

      9b1454c8-413f-4bb0-ab57-af1d22623013-image.png

      pfSensePlus24.03 2U BareMetal Asrock Industrial IMB-X1314MicroATX
      CPU: i7-13700@5.2GHz, RAM:32GB ECC, n°2 Samsung 870EVO SATA 2.5” SSD 1TB (ZFS) Raid1
      n°3 Intel i225-LM 2500/1000/100Mbps, n°1 NIC Intel i350-T4V2 10/100/1000 Mbps 4*GLAN, n°1 Intel X520-DA2

      Z 1 Reply Last reply Sep 16, 2023, 4:44 PM Reply Quote 0
      • Z
        zapador @Unoptanio
        last edited by Sep 16, 2023, 4:44 PM

        @Unoptanio There could be many reason for that. Is the Server5K connected directly to this pfSense? If so the pfSense should register the hostname via DHCP, or if there's a static DHCP lease. I really can't give you much info here without knowing the exact setup. But ask yourself - how would the pfSense know about the existence of this Server5K and have the pfSense had a good reason to register the hostname in DHCP?

        U 1 Reply Last reply Sep 16, 2023, 4:50 PM Reply Quote 0
        • U
          Unoptanio @zapador
          last edited by Unoptanio Sep 16, 2023, 4:53 PM Sep 16, 2023, 4:50 PM

          @zapador
          6deedac6-ed29-4c71-9266-36aae7e8dbdb-image.png

          c21ee34a-407e-4a4e-9f6c-630e4a118c7b-image.png

          pfSensePlus24.03 2U BareMetal Asrock Industrial IMB-X1314MicroATX
          CPU: i7-13700@5.2GHz, RAM:32GB ECC, n°2 Samsung 870EVO SATA 2.5” SSD 1TB (ZFS) Raid1
          n°3 Intel i225-LM 2500/1000/100Mbps, n°1 NIC Intel i350-T4V2 10/100/1000 Mbps 4*GLAN, n°1 Intel X520-DA2

          Z 1 Reply Last reply Sep 16, 2023, 4:55 PM Reply Quote 0
          • Z
            zapador @Unoptanio
            last edited by Sep 16, 2023, 4:55 PM

            @Unoptanio

            I would add the pfSense IP in the list of DNS servers:
            c73d296f-bc86-4d48-b2ed-6e95a4376889-image.png

            You could just remove 8.8.8.8 and replace it with 192.168.1.1.

            How does the Server5K get it's IP address? Is it static on the Server5K itself? Or a static lease in pfSense? Or just DHCP without Statis Lease?

            U 1 Reply Last reply Sep 16, 2023, 4:59 PM Reply Quote 0
            • U
              Unoptanio @zapador
              last edited by Unoptanio Sep 16, 2023, 5:11 PM Sep 16, 2023, 4:59 PM

              @zapador

              Server5k have static IP
              cb68c810-ceb5-417c-90d6-7e23e5bef044-image.png

              04f3387d-2f2f-44ba-9f57-df9df847e3b7-image.png

              pfSensePlus24.03 2U BareMetal Asrock Industrial IMB-X1314MicroATX
              CPU: i7-13700@5.2GHz, RAM:32GB ECC, n°2 Samsung 870EVO SATA 2.5” SSD 1TB (ZFS) Raid1
              n°3 Intel i225-LM 2500/1000/100Mbps, n°1 NIC Intel i350-T4V2 10/100/1000 Mbps 4*GLAN, n°1 Intel X520-DA2

              Z 1 Reply Last reply Sep 16, 2023, 5:11 PM Reply Quote 0
              • Z
                zapador @Unoptanio
                last edited by Sep 16, 2023, 5:11 PM

                @Unoptanio That explains why it isn't working. Set it to use DHCP on the server itself. Then on pfSense go to Services -> DHCP Server and at the bottom Add static mapping. Then fill everything out and make sure you get the MAC address right.

                You just have to fill out this:

                7b915893-f166-41fa-b0f2-7346ca1b6d3a-image.png

                1 Reply Last reply Reply Quote 0
                • U
                  Unoptanio @zapador
                  last edited by Unoptanio Sep 16, 2023, 5:38 PM Sep 16, 2023, 5:33 PM

                  @zapador

                  Are you sure?
                  But the server's ip address 192.168.1.250 is out of dhcp range

                  The DHCP range is :
                  b284d6b4-684a-4b8c-a24b-fe948ede1e03-image.png

                  pfSensePlus24.03 2U BareMetal Asrock Industrial IMB-X1314MicroATX
                  CPU: i7-13700@5.2GHz, RAM:32GB ECC, n°2 Samsung 870EVO SATA 2.5” SSD 1TB (ZFS) Raid1
                  n°3 Intel i225-LM 2500/1000/100Mbps, n°1 NIC Intel i350-T4V2 10/100/1000 Mbps 4*GLAN, n°1 Intel X520-DA2

                  Z 1 Reply Last reply Sep 16, 2023, 5:36 PM Reply Quote 0
                  • Z
                    zapador @Unoptanio
                    last edited by zapador Sep 16, 2023, 5:37 PM Sep 16, 2023, 5:36 PM

                    @Unoptanio That's exactly as it should be. The DHCP range is for devices where you don't care about what IP they get, so clients, not servers. You cannot make a static mapping that lies within the DHCP range, only outside of it.
                    When you set the IP static on the server itself then it will never talk to the DHCP on the pfSense and that's why the pfSense doesn't really know that the server is even there. When you set a static mapping the server will talk to the DHCP server on pfSense and based on the MAC address of the server pfSense will assign it the correct IP address (outside of the DHCP range).

                    You can try to assign the server an IP inside of the DHCP range, that will give you an error. It has to be outside of the DHCP range.

                    U 1 Reply Last reply Sep 16, 2023, 7:18 PM Reply Quote 0
                    • U
                      Unoptanio @zapador
                      last edited by Unoptanio Sep 16, 2023, 5:43 PM Sep 16, 2023, 5:42 PM

                      @zapador
                      01346604-4a66-4245-bd76-cc6e5c29e81e-image.png

                      I'm going to dinner at my place, it's 8pm, I'll talk to you as soon as I make the changes. for now thanks

                      pfSensePlus24.03 2U BareMetal Asrock Industrial IMB-X1314MicroATX
                      CPU: i7-13700@5.2GHz, RAM:32GB ECC, n°2 Samsung 870EVO SATA 2.5” SSD 1TB (ZFS) Raid1
                      n°3 Intel i225-LM 2500/1000/100Mbps, n°1 NIC Intel i350-T4V2 10/100/1000 Mbps 4*GLAN, n°1 Intel X520-DA2

                      Z U 2 Replies Last reply Sep 16, 2023, 5:47 PM Reply Quote 0
                      • Z
                        zapador @Unoptanio
                        last edited by Sep 16, 2023, 5:47 PM

                        @Unoptanio I would just leave them blank, assuming you have set some DNS servers in General Setup. Then you can read below the fields what happens by default. Or do as you've done here, adding the pfSense as the first option.

                        1 Reply Last reply Reply Quote 0
                        • U
                          Unoptanio @zapador
                          last edited by Unoptanio Sep 16, 2023, 7:24 PM Sep 16, 2023, 7:18 PM

                          @zapador

                          259ae36d-70a7-4afa-b065-3cda1ae54d11-image.png

                          d27bab50-4b07-4849-b1ee-2c9249e01927-image.png

                          pfSensePlus24.03 2U BareMetal Asrock Industrial IMB-X1314MicroATX
                          CPU: i7-13700@5.2GHz, RAM:32GB ECC, n°2 Samsung 870EVO SATA 2.5” SSD 1TB (ZFS) Raid1
                          n°3 Intel i225-LM 2500/1000/100Mbps, n°1 NIC Intel i350-T4V2 10/100/1000 Mbps 4*GLAN, n°1 Intel X520-DA2

                          Z 1 Reply Last reply Sep 16, 2023, 7:29 PM Reply Quote 0
                          • Z
                            zapador @Unoptanio
                            last edited by zapador Sep 16, 2023, 7:31 PM Sep 16, 2023, 7:29 PM

                            @Unoptanio Make sure this option is enabled in Services -> DNS Resolver:

                            c3378d52-3238-414e-916c-0c4b3c740b55-image.png

                            If you enable it then you almost certainly need to release and renew IP config on Server5K so it makes a new request to DHCP.

                            I'm a bit confused why you see 192.168.1.1 in the list of DNS Servers under DNS Lookup, you should only see 127.0.0.1 at the top (that's the pfSense localhost address) and below that any other DNS Servers you have added. Did you add 192.168.1.1 under General Setup? If so remove it there as it is not necessary.

                            When I use DNS Lookup on a local hostname it looks like this:

                            5fc3240f-78d7-4b9a-bd6f-ed9e065fd2ff-image.png

                            This is my DNS settings under General Setup:

                            12664ba7-e0ee-49fa-bb41-6c55731cf211-image.png

                            U 1 Reply Last reply Sep 16, 2023, 7:46 PM Reply Quote 1
                            • U
                              Unoptanio @zapador
                              last edited by Sep 16, 2023, 7:46 PM

                              @zapador

                              30a236d4-6690-42b4-81b0-4293e958bc37-image.png

                              ok it worked.

                              this setting was sufficient

                              09808a66-af53-4cd4-8b34-2f5f5be80803-image.png

                              pfSensePlus24.03 2U BareMetal Asrock Industrial IMB-X1314MicroATX
                              CPU: i7-13700@5.2GHz, RAM:32GB ECC, n°2 Samsung 870EVO SATA 2.5” SSD 1TB (ZFS) Raid1
                              n°3 Intel i225-LM 2500/1000/100Mbps, n°1 NIC Intel i350-T4V2 10/100/1000 Mbps 4*GLAN, n°1 Intel X520-DA2

                              Z 1 Reply Last reply Sep 16, 2023, 7:49 PM Reply Quote 0
                              • Z
                                zapador @Unoptanio
                                last edited by Sep 16, 2023, 7:49 PM

                                @Unoptanio Perfect! And sorry I forgot to mention that earlier, I had forgotten it wasn't enabled by default. So many things to remember! :)

                                U 1 Reply Last reply Sep 16, 2023, 7:50 PM Reply Quote 0
                                • U
                                  Unoptanio @zapador
                                  last edited by Sep 16, 2023, 7:50 PM

                                  @zapador

                                  All other machines that are under dhcp do not have their names resolved.
                                  Is there a cure for them too?

                                  pfSensePlus24.03 2U BareMetal Asrock Industrial IMB-X1314MicroATX
                                  CPU: i7-13700@5.2GHz, RAM:32GB ECC, n°2 Samsung 870EVO SATA 2.5” SSD 1TB (ZFS) Raid1
                                  n°3 Intel i225-LM 2500/1000/100Mbps, n°1 NIC Intel i350-T4V2 10/100/1000 Mbps 4*GLAN, n°1 Intel X520-DA2

                                  Z 1 Reply Last reply Sep 16, 2023, 7:51 PM Reply Quote 0
                                  • Z
                                    zapador @Unoptanio
                                    last edited by zapador Sep 16, 2023, 7:53 PM Sep 16, 2023, 7:51 PM

                                    @Unoptanio After enabling the option to Register DHCP leases in the DNS Resolver you must release/renew those machines or reboot them. The registration only happens when a machine request info from the DHCP. You can also just wait until their leases run out and they renew them automatically. It seems the leases are valid for 2 hours by default so it's not that long to just wait.

                                    1 Reply Last reply Reply Quote 1
                                    • U
                                      Unoptanio @Unoptanio
                                      last edited by Unoptanio Sep 16, 2023, 8:14 PM Sep 16, 2023, 8:12 PM

                                      @Unoptanio

                                      @zapador said in Use hostname to reach OpenVPN clients:

                                      leases are valid for 2 hours

                                      Default lease time
                                      Controls how long a lease will last when a client does not request a specific lease length. Specified in seconds, default value is 7200 seconds (2 hours)

                                      Maximum lease time
                                      Limits a requested lease length to a stated maximum amount of time. Specified in seconds, default value is 86400 seconds (1 day).
                                      https://docs.netgate.com/pfsense/en/latest/services/dhcp/ipv4.html

                                      pfSensePlus24.03 2U BareMetal Asrock Industrial IMB-X1314MicroATX
                                      CPU: i7-13700@5.2GHz, RAM:32GB ECC, n°2 Samsung 870EVO SATA 2.5” SSD 1TB (ZFS) Raid1
                                      n°3 Intel i225-LM 2500/1000/100Mbps, n°1 NIC Intel i350-T4V2 10/100/1000 Mbps 4*GLAN, n°1 Intel X520-DA2

                                      Z 1 Reply Last reply Sep 16, 2023, 8:22 PM Reply Quote 0
                                      • Z
                                        zapador @Unoptanio
                                        last edited by Sep 16, 2023, 8:22 PM

                                        @Unoptanio Ah yeah so it could vary depending on the device, but depending on the number of devices it might be easier to just wait 24 hours for all of them to renew their lease.

                                        U 1 Reply Last reply Sep 17, 2023, 11:35 AM Reply Quote 0
                                        • U
                                          Unoptanio @zapador
                                          last edited by Sep 17, 2023, 11:35 AM

                                          @zapador

                                          I confirm, name resolution also works for clients under DHCP.

                                          Why did we say to insert the IP address 192.168.1.1 first in the DNS list?

                                          This thing had nothing to do with it

                                          thanks for the support
                                          145f07ce-6264-4e28-865a-0e8e98b6401e-image.png

                                          thanks for the support

                                          pfSensePlus24.03 2U BareMetal Asrock Industrial IMB-X1314MicroATX
                                          CPU: i7-13700@5.2GHz, RAM:32GB ECC, n°2 Samsung 870EVO SATA 2.5” SSD 1TB (ZFS) Raid1
                                          n°3 Intel i225-LM 2500/1000/100Mbps, n°1 NIC Intel i350-T4V2 10/100/1000 Mbps 4*GLAN, n°1 Intel X520-DA2

                                          Z 1 Reply Last reply Sep 17, 2023, 11:44 AM Reply Quote 0
                                          42 out of 57
                                          • First post
                                            42/57
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                                            This community forum collects and processes your personal information.
                                            consent.not_received