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.2k 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
      last edited by

      Hi

      I've looked for information on this but can't really find anything.

      Clients connect to vpn.example.com (the OpenVPN Server on the pfSense)
      Clients are assigned a static IP using Client Specific Overrides
      Clients have a hostname, eg. client01 (configured on the client itself)

      When I connect to the OpenVPN server I would like to reach clients using client01.vpn.example.com (or similar) in order do avoid the step of having to look up the specific clients IP.

      Is that possible, and if so, how?

      Thanks!

      V UnoptanioU 2 Replies Last reply Reply Quote 1
      • V
        viragomann @zapador
        last edited by

        @zapador
        Add the VPN clients to your DNS as host overrides.

        Z UnoptanioU 3 Replies Last reply Reply Quote 2
        • Z
          zapador @viragomann
          last edited by

          @viragomann
          Thank you! That seems to work.

          I also tried enabling "Services -> DNS Resolver -> Register connected OpenVPN clients in the DNS Resolver" so I don't have to manually create entries for each client and that seems to work as well, creating an entry using the CN of the client. At least in both cases I can use "Diagnostics -> DNS Lookup" and successfully lookup any OpenVPN client.

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

            @viragomann said in Use hostname to reach OpenVPN clients:

            Add the VPN clients to your DNS as host overrides.

            I have the same problem as you

            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

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

              @zapador

              I have the same problem as you

              I'm not clear how to do this step.

              How do I add VPN clients to DNS as a host override?

              Can you post a screenshot?

              ce7bc418-4beb-4a62-b391-91334919551e-image.png

              602bd1a8-9011-4ccb-b92b-5203eb95b314-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

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

                @viragomann

                in the meantime I found it. it's about DNS resolver at the bottom

                e1022ed2-6290-4c19-8898-2845565c2634-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

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

                  @Unoptanio the only problem that could happen with that register vpn clients. Is I do believe it also restarts unbound. So if you have a lot of clients connecting and unbound is restarting a lot this can be problematic.. Since it does clear the dns cache, and while its restarting clients can not query. If the restart is quick you prob never notice, but if anything delays the start of unbound you can have periods when unbound isn't working that your clients will notice and have problems looking up where they want to go..

                  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

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

                    @johnpoz

                    Hi, I'm Italian, I don't think I understood well, I'm using the translator to help me.
                    So what do you suggest we do?
                    Can you explain to me a little better?

                    I can say that after inclusion in the override list now RDP access using name.domain format works

                    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

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

                      @Unoptanio not saying you need to do anything.. Just be aware that registration of clients dynamic like dhcp or vpn clients restarts unbound (dns).. This can be problematic depending on the number of times it restarts, and how long it takes to restart.

                      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

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

                        @johnpoz

                        What is the right way to connect in RDP using an openvpn connection?

                        Use the client's IP address or its name.domain?

                        Which system causes the least problems?

                        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

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

                          @Unoptanio so you want to access the vpn clients IP when he vpn into your network.. IP or dns makes little difference.. And registration of vpn clients can and does work.. If you want to use some fqdn to access these remote clients when they connect in.

                          Just wanted you and anyone else to be aware that registration of dhcp and vpn clients on connect is going to restart unbound. This can be problematic if you have that happening a lot.. And if how you have things setup causes longer delays in unbound starting, etc.

                          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

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

                            @johnpoz

                            for each openvpn user I also used this command "ifconfig-push 10.10.94.50 255.255.255.0"

                            for the other users I continued with the progressive number 10.10.94.51 ..52..53

                            I have no idea if this is better to do or not.
                            and if it can amplify the problem you were talking about

                            eb5b0bbe-ce48-48b3-9d60-ca3adcb6a49d-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 Pushing a static IP to a client makes sense if it is important for you to either know the clients IP address or if you want to make firewall rules for a specific client where the IP has to remain the same.

                              Can't really say one is better than the other. If you use DNS name that name will be translated to an IP and then your RDP connects using that IP. If you use the IP then there's no name translation taking place first.

                              Using hostnames, eg. client01.vpn.example.com, is handy as it is a lot easier to remember.

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

                                @zapador

                                Have you encountered the problem that @johnpoz was talking about that could occur?

                                Just wanted you and anyone else to be aware that registration of dhcp and vpn clients on connect is going to restart unbound. This can be problematic if you have that happening a lot.. And if how you have things setup causes longer delays in unbound starting, etc.
                                

                                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 I haven't encountered any problems related to that but I also wasn't aware that it could be a problem.
                                  I was not aware that the VPN registering clients in DHCP would cause unbound (DNS Resolver) to restart, also not sure if that is really the case or not.

                                  If you want to test you try to enable the register in DHCP feature, connect a client and then check Status -> System Logs -> System -> DNS Resolver and look for "start of service (unbound)" or "service stopped (unbound)" and see if that coincides with the time the VPN client connected. If not, then unbound does not restart when VPN register clients in DHCP.

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

                                    @zapador

                                    8c1018dc-38e8-4f47-ba92-639749e6ccdc-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 Go to Services -> DNS Resolver and enable this:

                                      1b41713f-dc39-47c8-983f-1caa16bbb611-image.png

                                      Then you can resolve the hostnames of all clients connected via VPN, no matter what interface you're coming from - as long as the device use the pfSense as DNS which is the case by default.

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

                                        @zapador

                                        ok found it. I already had the setting active

                                        i have check Status -> System Logs -> System -> DNS Resolver

                                        but i have only this data:

                                        5a225780-fa24-4863-88f0-dece4a40df85-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 I'm not sure if you will see anything in that log (maybe, maybe not). Just try to connect a client to OpenVPN and then from the pfSense try nslookup <hostname> which in this case would be the Common Name of that particular client, or maybe the Username if you use User Auth. It should provide you with the IP of that particular client and if it does, it works. Hope that makes sense, else just ask.

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

                                            @zapador

                                            25c57c35-2ade-48b7-ae05-e8aa03217ab4-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
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.