7 Replies
      Latest reply on Aug 27, 2019 1:48 AM by kappe_m
      Asieiev Level 1 Level 1 (0 points)

        Is it possible to flush DNS cache on iOS?

        I'm using NEDNSProxyProvider for redirecting traffic to our DNS server. But when I am changing our DNS server address to OpenDNS method handleNewFlow(_:)  doesn't called on previously visited sites.

        • Re: Flush DNS cache on iOS
          eskimo Apple Staff Apple Staff (13,415 points)

          Is it possible to flush DNS cache on iOS?

          There is no specific API to flush the DNS cache.

          I'm using NEDNSProxyProvider for redirecting traffic to our DNS server. But when I am changing our DNS server address to OpenDNS method handleNewFlow(_:)  doesn't called on previously visited sites.

          Can you walk me through this scenario in more detail?

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

            • Re: Flush DNS cache on iOS
              Asieiev Level 1 Level 1 (0 points)

              NEDNSProxyProvider started -> opened "example.com" in Safari -> called handleNewFlow(_:)

               

              handleNewFlow(_:) will not be called if I'll try to open web page again.

                • Re: Flush DNS cache on iOS
                  eskimo Apple Staff Apple Staff (13,415 points)

                  I’m sorry I wasn’t clear.  I’m looking for information as to why your setup requires you to flush the DNS cache.  How are entries getting cached such that they need to be invalidated?

                  Share and Enjoy

                  Quinn “The Eskimo!”
                  Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                  let myEmail = "eskimo" + "1" + "@apple.com"

                    • Re: Flush DNS cache on iOS
                      johnjoseph Level 1 Level 1 (0 points)

                      I'm guessing @Asieiev's scneario is this:

                       

                      1. user visit example.com. this DNS entry is cached

                      2. user turns on the app which uses NEDNSProxyProvider, which specifies a custom DNS server

                      3. user visits example.com again. instead of using the custom DNS server to get a new value, the value cached from step 1 is used.

                       

                      He would like to programatically clear the DNS cache between steps 2 and 3.

                • Re: Flush DNS cache on iOS
                  kappe_m Level 1 Level 1 (0 points)

                  I'm implementing a NEDNSProxyProvider and I have the same issue, I would like to be able to manipulate the DNS cache at some level, this is a possible scenario:

                   

                  1. user turns on the app which uses NEDNSProxyProvider, which specifies a custom DNS server based on some rules.

                  2. user visit example.com. this DNS entry is cached

                  3. the rules are changed.

                  4. user visits example.com again but the request is cached, the DNS requests never hits the NEDNSProxyProvider so the new rules are not applied until the DNS record TTL is expired.

                   

                  I'm going to open an improvement request.

                  • Re: Flush DNS cache on iOS
                    geeksfromnull Level 1 Level 1 (0 points)

                    Hi,

                    i hade same issue, and it is very easy tu flush on ios.

                    I just did:

                    1. Open Terminal (Application › Utilities › Terminal or click Go > Utilities > Terminal).
                    2. Type sudo killall -HUP mDNSResponder and press Enter to run the command.
                    3. Enter your password (it might not appear on the screen as you type).

                     

                    But it depends on your OS system easy fix for all mac systems on https://geeksadvice.com/flush-dns/