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

                          @Unoptanio Does that happen when a client connects?

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

                            @zapador

                            I tried to make some openvpn connections now and to connect in rdp using the name.domain format but nothing appears in the log section relating to today's date, September 16th.
                            in the log the first occurrence of "start of service (unbound)" is on September 14th but I don't know what it referred to

                            431980dd-335c-4d57-b60b-0661338d840f-image.png

                            of today 16th September I only have the first line in the log

                            do you have different data in your firewall?

                            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 Don't worry about the log at first, just check if things work or not. Start by checking from the pfSense itself using Diagnostics -> DNS Lookup and see if you can get an IP for your connected client.

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

                                @zapador
                                e4cd9ae2-0ca6-4f72-9bf4-ac1863a1be6d-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 As long as you have manually added Host Overrides then you'll never find out if "Register connected OpenVPN clients in the DNS Resolver" is working because the Host Overrides will take priority. If you list something in Host Overrides it will ALWAYS work in the sense that the DNS Resolver will return an IP for anything listed in the Host Overrides no matter if it exists or not.

                                  But is it otherwise working as it should?

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

                                    @zapador

                                    At the moment, with the current configuration, everything works for me.

                                    Before compiling this DNS override table, RDP access using the name.domain format did not work for me.
                                    7bba8c46-2a7d-442d-a7e8-eb1dddd2a651-image.png

                                    RDP access only worked using the machine's IP address


                                    RDP access using name.domain format should theoretically work even without having filled in the DNS resolver override table? yes o no?

                                    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 That's great!

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

                                        @zapador

                                        65cc4152-1a4d-4661-a369-9bf79af1f040-image.png

                                        e3f8e670-0915-4f3b-98f5-56d0e0ea2954-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 1
                                        • Z
                                          zapador @Unoptanio
                                          last edited by

                                          @Unoptanio Is what without using Host Overrides?

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

                                            @zapador
                                            it was only a question.

                                            Initially I thought that once connected to openvpn, the names of the machines that are on the 192.168.1.x network would automatically be visible without use dns override

                                            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.