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

    Local vs VPN DNS Name Resolution

    Scheduled Pinned Locked Moved OpenVPN
    26 Posts 4 Posters 7.6k 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.
    • N
      NOYB
      last edited by

      OpenVPN server set to force all traffic through tunnel and provide DNS server to clients.
      Although this works.  The clients still resolve names with the local DNS as well.

      If an address is returned for say Yahoo.com by both the VPN DNS and local DNS, which one is used by the client?  I'm guessing the first one returned would be used.  But since the connection is actually going to be made via the VPN it seems that would be the proper address to use.

      Is there anyway to prevent non-local name queries from being made to the local DNS and only to the VPN DNS?  With out local network access being blocked of course.

      Update: (6:21 PM PDT 5/24/2014)
      Original description above is a little in accurate.
      All internet name resolution queries are being handled by the local network DNS and not being sent to the VPN DNS.

      Really would like to figure this out to get all internet name resolution queries to be handled by the VPN DNS.  Having them handled by the local DNS seems like a big security hole.  As public hot spots could direct clients to cloned sites to collect user credentials for banks etc.

      Client is Windows 8.1 Pro

      Ideas and / or confirmation (issue duplication / verification) welcome.

      Thanks

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

        "With out local network access being blocked of course."

        Well if the local dns is on the local dns, its up to the client what he uses - you can hand out dns when they connect for the vpn.  And if the dns they decide to use was off their network then they would have to go through the vpn to get there, etc.

        But if dns they are using local and you want to allow local access, then you need to have the client make sure they use the dns you hand out from your vpn first - take a look at your binding order.

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

        1 Reply Last reply Reply Quote 0
        • N
          NOYB
          last edited by

          My binding order does not show any OpenVPN item.
          (Windows 8.1 Pro)

          ![Binding Order Win 8.1.jpg](/public/imported_attachments/1/Binding Order Win 8.1.jpg)
          ![Binding Order Win 8.1.jpg_thumb](/public/imported_attachments/1/Binding Order Win 8.1.jpg_thumb)

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

            Your on provider - I renamed mined, your is prob called tap, etc.  Whatever the default is.. Switch over to adapters and bindings.  What does it show?

            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
            • N
              NOYB
              last edited by

              Ah okay I see.

              Yes in Adapters and Bindings my TAP device is named Local Area Connection.

              I'll try moving it to the top of the list and see what that does to the name resolution.

              Thanks for the pointer.

              1 Reply Last reply Reply Quote 0
              • N
                NOYB
                last edited by

                Well that's a little bit of an improvement, but not much.

                Queries for internet names (non-local and non-vpn) using nslookup all go to the VPN DNS exclusively.  This is the desired behavior.

                However, for browsing, queries still go to both the local and VPN DNS servers and responses are received from both.  The desired behavior would be for only local name queries to be sent to the local DNS server and all other name queries to be sent to the VPN DNS server.

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

                  "  The desired behavior would be for only local name queries to be sent to the local DNS server and all other name queries to be sent to the VPN DNS server."

                  That is not how dns works..  You would have to run a nameserver on your local box - and create forwarder rules, so all your KNOWN local went to your local dns server, and everything else (non local and internet went to whatever other dns you wanted to send it to)

                  What do you mean by browsing btw, like \somename or ping hostnameonly ?

                  Browsing is not a dns thing.. queries for FQDN are what dns is for.. if your client is sending hostname to dns how do you expect it to resolve in the first place without domain to look up that the name server either forwards on, or is authoritative for..

                  What response are you getting from your vpn dns, it sure and the hell would not know about your local zones?

                  please give a detailed example of for starters how you know where the queries are going and what your getting back for an answer.. window client does not query all the dns servers it has listed at once.. It will query one, if it doesn't get answer it will go onto next, etc..

                  What version of windows is this client?

                  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
                  • N
                    NOYB
                    last edited by

                    Using Wireshark to capture both the WiFi and VPN networks.  Filter on port 53.

                    Query for nslookup yahoo.con goes to the VPN DNS only.  As desired.

                    However,
                    Browse (IE) to http://yahoo.com and the name queries go to both the local (192.168.1.1) and VPN (192.168.2.1) DNS servers.  And resolved addresses are received from both.

                    Seems like this could be a big security hole.  Possible for a public hot spot network to send clients to malicious sites even though they are using a VPN.

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

                      That is your browser doing that - not the OS..  Don't use IE for starters if your worried about security ;)

                      Well yeah if you query them, they will answer if they can ;)

                      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
                      • N
                        NOYB
                        last edited by

                        It's not just IE that this OpenVPN DNS behavior occurs with.

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

                          Its not openvpn behavior..  Openvpn has nothing to do with dns, what your os or application does with what its handed has nothing to do with openvpn.

                          I don't see this behavior, are you talking about queries for such like wpad ?

                          You see in first picture that hey I am doing dns to the dns server on my openvpn interface..

                          Look what happens if I ask for something like pfsense.local.lan - it asks my openvpn dns, he says NX.. Sorry..  there is no domain like that.. So client gives up..  Now if dns server had not answered, or returned serv fail, then sure would of keep trying to resolve via methods it knows how to use to resolve.

                          You sure your not seeing broadcasts for names – we dns your set to says fails to respond windows will get desperate and even broadcast for your fqdn even though it doesn't exist, etc.

                          Lets see a specific example of what your concerned with.

                          querydns.png
                          querydns.png_thumb
                          nxreturned.png
                          nxreturned.png_thumb

                          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
                          • N
                            NOYB
                            last edited by

                            Attachment Details:

                            Wireshark capture on both the WiFi and OpenVPN interfaces with capture filter 'port 53'.

                            192.168.1.x is local WiFi hotspot network.
                            192.168.22.x is OpenVPN to pfSense (configured to force all traffic through VPN and provide DNS servers list.

                            Browse to: https://wwws.ameritrade.com/apps/LogIn/

                            DNS queries for the non-local name are sent to both the local WiFi hotspot network DNS server and the OpenVPN DNS server.
                            DNS response received from both.  Making it possible for the local WiFi hotspot network DNS to provide an address that sends the client to a malicious site.

                            OpenVPN Forum Thread:
                            https://forums.openvpn.net/viewtopic.php?t=15939

                            ![OpenVPN DNS.jpg](/public/imported_attachments/1/OpenVPN DNS.jpg)
                            ![OpenVPN DNS.jpg_thumb](/public/imported_attachments/1/OpenVPN DNS.jpg_thumb)

                            1 Reply Last reply Reply Quote 0
                            • K
                              kpa
                              last edited by

                              Are you handing out one or two DNS forwarders during the OpenVPN tunnel set up? If you're handing out just one forwarder Windows may keep the second forwarder from the initial DHCP setup and combine it with the one it got from the OpenVPN tunnel set up. Try giving the client at least two DNS forwarders and see how it behaves then.

                              But yes, this has almost nothing to do with OpenVPN itself. Windows is known for its "creative adaptations" of internet standards and this is just one of them.

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

                                Well my home box that I showed was static IP on its local interface..

                                Its quite possible windows does something odd with dhcp.. It sure and the F shouldn't but as stated MS likes to go their own route sometimes when it comes to standards.

                                I vpn to my home network pretty much every single day from work, so happy to validate what your seeing.  That second query should not be happening - unless the fist 1 failed to answer or returned serv fail.  But again this has NOTHING to do with openvpn..  Openvpn just hands the client dns to use, it can not control the how the OS uses or doesn't use that info.

                                You did update your binding btw?  Your screenshot was of providers..  keep in mind if you enable or disable interfaces this order can and does change..  So double check it, from your sniff where the local dns was .001 second later I would assume vpn connection is first..  Its best to rename your interfaces so you know exactly what they are vs local connection 1, local connection 2 ;)

                                remoteaccess.png
                                remoteaccess.png_thumb

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

                                  Ok - from a quick test when I got into the office, I set client to redirect-gateway def1

                                  now get this in my route print for default, before I was not redirecting

                                  Active Routes:
                                  Network Destination        Netmask          Gateway      Interface  Metric
                                            0.0.0.0          0.0.0.0      10.56.41.1      10.56.41.36    10
                                            0.0.0.0        128.0.0.0      10.0.200.5      10.0.200.6    20

                                  Now what I noticed right off the bat was that it was sending dns to my local configured dns at 10.56.144.11 and 10.56.144.21 down my vpn connection.  This is all it was doing it was not sending anything to my 192.168.1.253 dns (pfsense) down the vpn..

                                  So as suggested I added couple more entries fro dns to openvpn config.. so it handed out 192.168.1.253 3 times

                                  Ethernet adapter vpn:

                                  Connection-specific DNS Suffix  . : local.lan
                                    Description . . . . . . . . . . . : TAP-Windows Adapter V9
                                    Physical Address. . . . . . . . . : 00-FF-5A-2F-7E-EA
                                    DHCP Enabled. . . . . . . . . . . : Yes
                                    Autoconfiguration Enabled . . . . : Yes
                                    IPv4 Address. . . . . . . . . . . : 10.0.200.6(Preferred)
                                    Subnet Mask . . . . . . . . . . . : 255.255.255.252
                                    Lease Obtained. . . . . . . . . . : Tuesday, May 27, 2014 10:19:14 AM
                                    Lease Expires . . . . . . . . . . : Wednesday, May 27, 2015 10:19:14 AM
                                    Default Gateway . . . . . . . . . :
                                    DHCP Server . . . . . . . . . . . : 10.0.200.5
                                    DNS Servers . . . . . . . . . . . : 192.168.1.253
                                                                        192.168.1.253
                                                                        192.168.1.253
                                    NetBIOS over Tcpip. . . . . . . . : Enabled

                                  Now watching dns queries with wireshark - I only see dns queries to my pfsense box down the vpn.. Nothing going local at all.

                                  Ok something is weird, I disconnected and connected again and now its only sending queries to my local dns - but down the gateway..  I don't have dns on my local segment to test that scenario.  Windows can do some odd shit for sure..  In this scenario you would be good because the queries would just go nowhere down your tunnel to those addresses..  If your worried about dns leakage, I would prob use a proxy on your vpn side and set your browser to use that proxy and setup in firefox for example the socks dns setting.

                                  querydns.png
                                  querydns.png_thumb

                                  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
                                  • N
                                    NOYB
                                    last edited by

                                    Pippin, Maybe this would be a better place to continue the "block-outside-dns" discussion from https://forum.pfsense.org/index.php?topic=110910.0
                                    https://forum.pfsense.org/index.php?topic=110910.msg617893#msg617893

                                    So verb 4 shows the logs as you have too.  So my only issue with this is that it eliminates resolution of local names.  Need those some places.

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

                                      continue??  this thread was from 2014 ;)

                                      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
                                      • PippinP
                                        Pippin
                                        last edited by

                                        Hmm, ok I see, the difference is that I'm not in a road worrier situation.
                                        Connecting from home to my external server (NAS) which runs (adblocking) DNS and I can still talk to local.

                                        Maybe ask over at OpenVPN Community Forum or even better on the users mailing list?

                                        I gloomily came to the ironic conclusion that if you take a highly intelligent person and give them the best possible, elite education, then you will most likely wind up with an academic who is completely impervious to reality.
                                        Halton Arp

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

                                          "Connecting from home to my external server"

                                          How is that not a road warrior connection??  You don't have a site to site setup do you?  If its not site to site then your road warrior.

                                          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
                                          • PippinP
                                            Pippin
                                            last edited by

                                            I mean as in local is my home and my home is not switching networks  :)

                                            I gloomily came to the ironic conclusion that if you take a highly intelligent person and give them the best possible, elite education, then you will most likely wind up with an academic who is completely impervious to reality.
                                            Halton Arp

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