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.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.
    • Z
      zapador @Unoptanio
      last edited by

      @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
      • UnoptanioU
        Unoptanio @zapador
        last edited by Unoptanio

        @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 Reply Quote 0
        • Z
          zapador @Unoptanio
          last edited by zapador

          @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

          UnoptanioU 1 Reply Last reply Reply Quote 1
          • UnoptanioU
            Unoptanio @zapador
            last edited by

            @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 Reply Quote 0
            • Z
              zapador @Unoptanio
              last edited by

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

              UnoptanioU 1 Reply Last reply Reply Quote 0
              • UnoptanioU
                Unoptanio @zapador
                last edited by

                @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 Reply Quote 0
                • Z
                  zapador @Unoptanio
                  last edited by zapador

                  @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
                  • UnoptanioU
                    Unoptanio @Unoptanio
                    last edited by Unoptanio

                    @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 Reply Quote 0
                    • Z
                      zapador @Unoptanio
                      last edited by

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

                      UnoptanioU 1 Reply Last reply Reply Quote 0
                      • UnoptanioU
                        Unoptanio @zapador
                        last edited by

                        @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 Reply Quote 0
                        • Z
                          zapador @Unoptanio
                          last edited by zapador

                          @Unoptanio I think just a bit of confusion, it's difficult for me to know your exact setup when I don't have it in front of me.

                          What I would recommend is this:

                          In General Setup put the DNS servers you want
                          cb4e6cfe-28b9-4c43-84b4-969b322acfe1-image.png

                          Under DHCP Server leave all DNS fields blank.

                          Anywhere else only enter something in DNS fields if there's a good reason, otherwise leave them blank.

                          So turn off this:
                          51d1b23f-b117-4e0d-b0f2-36fcfb119673-image.png

                          UnoptanioU 1 Reply Last reply Reply Quote 1
                          • UnoptanioU
                            Unoptanio @zapador
                            last edited by

                            @zapador

                            Done.
                            Now I'm configured like this

                            d4763630-1462-4247-aea9-b770e4850016-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 Reply Quote 0
                            • Z
                              zapador @Unoptanio
                              last edited by

                              @Unoptanio Perfect, then everything should work as intended :)

                              You can just set all of the gateways to None, though it will work if you specify the gateway. Really no difference, but generally I would consider leaving things to default to be best practice unless there's a reason not to leave defaults. In this case None is default.

                              UnoptanioU 1 Reply Last reply Reply Quote 1
                              • UnoptanioU
                                Unoptanio @zapador
                                last edited by

                                @zapador

                                Good morning, excuse me , in the openvpn log section I find these IP addresses unknown to me that are trying something.

                                Do I have to worry?
                                What I can do?

                                78ec389e-7d4a-491a-aedc-ef6934257a32-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 Reply Quote 0
                                • Z
                                  zapador @Unoptanio
                                  last edited by zapador

                                  @Unoptanio It means that someone is trying connect to your VPN server or otherwise trying to communicate with the port that OpenVPN is running at (default 1194). Because you have enabled TLS Auth in your OpenVPN Server settings the OpenVPN Server expects that the incoming packet contains HMAC which it does not and thus nothing more happens. So it's really nothing to worry about, it's just the security layers working as they should.
                                  You can potentially reduce the amount of noise (random connection attempts) by running the OpenVPN Server on another port than default but there's not much reason to do so.

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