How to resolve the DNS locally when there is a proxy configured?












4















If I configure the proxy, under Settings -> Network -> Proxy, and then try to access "http://google.com", the name resolution (IP of google.com) will happen there, at the proxy server but...



How can I change this behavior?



I mean, I need to resolve the DNS locally at my Desktop, BEFORE hitting the proxy.



But why?



This way, I'll configure "ignore-hosts with lots of subnets (IPv4 / IPv6), that don't need the proxy to reach them", then, Ubuntu first needs to:



1- Resolve the DNS locally (i.e. not via proxy too);



2- Try to match the locally discovered website IP with "ignore-hosts" settings;



Is it possible?



Tks!
Thiago










share|improve this question



























    4















    If I configure the proxy, under Settings -> Network -> Proxy, and then try to access "http://google.com", the name resolution (IP of google.com) will happen there, at the proxy server but...



    How can I change this behavior?



    I mean, I need to resolve the DNS locally at my Desktop, BEFORE hitting the proxy.



    But why?



    This way, I'll configure "ignore-hosts with lots of subnets (IPv4 / IPv6), that don't need the proxy to reach them", then, Ubuntu first needs to:



    1- Resolve the DNS locally (i.e. not via proxy too);



    2- Try to match the locally discovered website IP with "ignore-hosts" settings;



    Is it possible?



    Tks!
    Thiago










    share|improve this question

























      4












      4








      4


      3






      If I configure the proxy, under Settings -> Network -> Proxy, and then try to access "http://google.com", the name resolution (IP of google.com) will happen there, at the proxy server but...



      How can I change this behavior?



      I mean, I need to resolve the DNS locally at my Desktop, BEFORE hitting the proxy.



      But why?



      This way, I'll configure "ignore-hosts with lots of subnets (IPv4 / IPv6), that don't need the proxy to reach them", then, Ubuntu first needs to:



      1- Resolve the DNS locally (i.e. not via proxy too);



      2- Try to match the locally discovered website IP with "ignore-hosts" settings;



      Is it possible?



      Tks!
      Thiago










      share|improve this question














      If I configure the proxy, under Settings -> Network -> Proxy, and then try to access "http://google.com", the name resolution (IP of google.com) will happen there, at the proxy server but...



      How can I change this behavior?



      I mean, I need to resolve the DNS locally at my Desktop, BEFORE hitting the proxy.



      But why?



      This way, I'll configure "ignore-hosts with lots of subnets (IPv4 / IPv6), that don't need the proxy to reach them", then, Ubuntu first needs to:



      1- Resolve the DNS locally (i.e. not via proxy too);



      2- Try to match the locally discovered website IP with "ignore-hosts" settings;



      Is it possible?



      Tks!
      Thiago







      networking proxy dns






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 15 '14 at 0:12









      ThiagoCMCThiagoCMC

      3793922




      3793922






















          2 Answers
          2






          active

          oldest

          votes


















          2














          This isn't possible when you use an HTTP proxy because:




          • The server you connect to is that of the proxy, not of the ultimate destination.

          • You send the full URL (including hostname) of your request to the proxy. The proxy then does the request on your behalf.


          Therefore, it must be the proxy that does the DNS lookup.



          It isn't possible to do the DNS lookup locally, and send only the IP address to the proxy server. Firstly, there is no mechanism to specify that the proxy should try a particular IP address for a particular host. You could change the URL from, say, http://example.com/mypage to http://33.33.33.33/mypage, but then the proxy server won't know which hostname to request, an importanta part of the modern web (HTTP/1.1 and later), which depends on a Host header always being present in a request, removing the restriction that all hostnames be served from different IP addresses.



          Your best bet would be to configure the proxy server to use the DNS resolver of your choice. This would only be possible if you use a local proxy server that you control.



          Note: When you use a SOCKS proxy or another lower-level tunnelling method, you can use a local DNS server. Just not with an HTTP proxy.






          share|improve this answer


























          • Thank you! Nice explanation... But, I'm still thinking that I it would be better to resolve the DNS locally, just to match the ignore-hosts settings. Like this: 1- If the site IP matches ignore-hosts settings, then, don't go via proxy. Otherwise: 2- if the site IP doesn't match ignore-hosts, then, go via proxy as usual. - Can I achieve this? Nevertheless, I'll take a look of socks... Tks again!

            – ThiagoCMC
            Apr 15 '14 at 0:56











          • I guess it's possible that you could do an additional DNS request locally in addition to the DNS request the HTTP proxy server does, I don't know if you have that option "out of the box" though.

            – thomasrutter
            Apr 15 '14 at 1:13



















          0














          edit: Or you can use a PAC file to control usage of proxy or not depending on your criteria. Autoproxyresultcache if applicable must be off.



          you can install Technitium and be the DNS server.
          https://technitium.com/






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f447877%2fhow-to-resolve-the-dns-locally-when-there-is-a-proxy-configured%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            This isn't possible when you use an HTTP proxy because:




            • The server you connect to is that of the proxy, not of the ultimate destination.

            • You send the full URL (including hostname) of your request to the proxy. The proxy then does the request on your behalf.


            Therefore, it must be the proxy that does the DNS lookup.



            It isn't possible to do the DNS lookup locally, and send only the IP address to the proxy server. Firstly, there is no mechanism to specify that the proxy should try a particular IP address for a particular host. You could change the URL from, say, http://example.com/mypage to http://33.33.33.33/mypage, but then the proxy server won't know which hostname to request, an importanta part of the modern web (HTTP/1.1 and later), which depends on a Host header always being present in a request, removing the restriction that all hostnames be served from different IP addresses.



            Your best bet would be to configure the proxy server to use the DNS resolver of your choice. This would only be possible if you use a local proxy server that you control.



            Note: When you use a SOCKS proxy or another lower-level tunnelling method, you can use a local DNS server. Just not with an HTTP proxy.






            share|improve this answer


























            • Thank you! Nice explanation... But, I'm still thinking that I it would be better to resolve the DNS locally, just to match the ignore-hosts settings. Like this: 1- If the site IP matches ignore-hosts settings, then, don't go via proxy. Otherwise: 2- if the site IP doesn't match ignore-hosts, then, go via proxy as usual. - Can I achieve this? Nevertheless, I'll take a look of socks... Tks again!

              – ThiagoCMC
              Apr 15 '14 at 0:56











            • I guess it's possible that you could do an additional DNS request locally in addition to the DNS request the HTTP proxy server does, I don't know if you have that option "out of the box" though.

              – thomasrutter
              Apr 15 '14 at 1:13
















            2














            This isn't possible when you use an HTTP proxy because:




            • The server you connect to is that of the proxy, not of the ultimate destination.

            • You send the full URL (including hostname) of your request to the proxy. The proxy then does the request on your behalf.


            Therefore, it must be the proxy that does the DNS lookup.



            It isn't possible to do the DNS lookup locally, and send only the IP address to the proxy server. Firstly, there is no mechanism to specify that the proxy should try a particular IP address for a particular host. You could change the URL from, say, http://example.com/mypage to http://33.33.33.33/mypage, but then the proxy server won't know which hostname to request, an importanta part of the modern web (HTTP/1.1 and later), which depends on a Host header always being present in a request, removing the restriction that all hostnames be served from different IP addresses.



            Your best bet would be to configure the proxy server to use the DNS resolver of your choice. This would only be possible if you use a local proxy server that you control.



            Note: When you use a SOCKS proxy or another lower-level tunnelling method, you can use a local DNS server. Just not with an HTTP proxy.






            share|improve this answer


























            • Thank you! Nice explanation... But, I'm still thinking that I it would be better to resolve the DNS locally, just to match the ignore-hosts settings. Like this: 1- If the site IP matches ignore-hosts settings, then, don't go via proxy. Otherwise: 2- if the site IP doesn't match ignore-hosts, then, go via proxy as usual. - Can I achieve this? Nevertheless, I'll take a look of socks... Tks again!

              – ThiagoCMC
              Apr 15 '14 at 0:56











            • I guess it's possible that you could do an additional DNS request locally in addition to the DNS request the HTTP proxy server does, I don't know if you have that option "out of the box" though.

              – thomasrutter
              Apr 15 '14 at 1:13














            2












            2








            2







            This isn't possible when you use an HTTP proxy because:




            • The server you connect to is that of the proxy, not of the ultimate destination.

            • You send the full URL (including hostname) of your request to the proxy. The proxy then does the request on your behalf.


            Therefore, it must be the proxy that does the DNS lookup.



            It isn't possible to do the DNS lookup locally, and send only the IP address to the proxy server. Firstly, there is no mechanism to specify that the proxy should try a particular IP address for a particular host. You could change the URL from, say, http://example.com/mypage to http://33.33.33.33/mypage, but then the proxy server won't know which hostname to request, an importanta part of the modern web (HTTP/1.1 and later), which depends on a Host header always being present in a request, removing the restriction that all hostnames be served from different IP addresses.



            Your best bet would be to configure the proxy server to use the DNS resolver of your choice. This would only be possible if you use a local proxy server that you control.



            Note: When you use a SOCKS proxy or another lower-level tunnelling method, you can use a local DNS server. Just not with an HTTP proxy.






            share|improve this answer















            This isn't possible when you use an HTTP proxy because:




            • The server you connect to is that of the proxy, not of the ultimate destination.

            • You send the full URL (including hostname) of your request to the proxy. The proxy then does the request on your behalf.


            Therefore, it must be the proxy that does the DNS lookup.



            It isn't possible to do the DNS lookup locally, and send only the IP address to the proxy server. Firstly, there is no mechanism to specify that the proxy should try a particular IP address for a particular host. You could change the URL from, say, http://example.com/mypage to http://33.33.33.33/mypage, but then the proxy server won't know which hostname to request, an importanta part of the modern web (HTTP/1.1 and later), which depends on a Host header always being present in a request, removing the restriction that all hostnames be served from different IP addresses.



            Your best bet would be to configure the proxy server to use the DNS resolver of your choice. This would only be possible if you use a local proxy server that you control.



            Note: When you use a SOCKS proxy or another lower-level tunnelling method, you can use a local DNS server. Just not with an HTTP proxy.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 6 '18 at 5:18

























            answered Apr 15 '14 at 0:33









            thomasrutterthomasrutter

            26.8k46489




            26.8k46489













            • Thank you! Nice explanation... But, I'm still thinking that I it would be better to resolve the DNS locally, just to match the ignore-hosts settings. Like this: 1- If the site IP matches ignore-hosts settings, then, don't go via proxy. Otherwise: 2- if the site IP doesn't match ignore-hosts, then, go via proxy as usual. - Can I achieve this? Nevertheless, I'll take a look of socks... Tks again!

              – ThiagoCMC
              Apr 15 '14 at 0:56











            • I guess it's possible that you could do an additional DNS request locally in addition to the DNS request the HTTP proxy server does, I don't know if you have that option "out of the box" though.

              – thomasrutter
              Apr 15 '14 at 1:13



















            • Thank you! Nice explanation... But, I'm still thinking that I it would be better to resolve the DNS locally, just to match the ignore-hosts settings. Like this: 1- If the site IP matches ignore-hosts settings, then, don't go via proxy. Otherwise: 2- if the site IP doesn't match ignore-hosts, then, go via proxy as usual. - Can I achieve this? Nevertheless, I'll take a look of socks... Tks again!

              – ThiagoCMC
              Apr 15 '14 at 0:56











            • I guess it's possible that you could do an additional DNS request locally in addition to the DNS request the HTTP proxy server does, I don't know if you have that option "out of the box" though.

              – thomasrutter
              Apr 15 '14 at 1:13

















            Thank you! Nice explanation... But, I'm still thinking that I it would be better to resolve the DNS locally, just to match the ignore-hosts settings. Like this: 1- If the site IP matches ignore-hosts settings, then, don't go via proxy. Otherwise: 2- if the site IP doesn't match ignore-hosts, then, go via proxy as usual. - Can I achieve this? Nevertheless, I'll take a look of socks... Tks again!

            – ThiagoCMC
            Apr 15 '14 at 0:56





            Thank you! Nice explanation... But, I'm still thinking that I it would be better to resolve the DNS locally, just to match the ignore-hosts settings. Like this: 1- If the site IP matches ignore-hosts settings, then, don't go via proxy. Otherwise: 2- if the site IP doesn't match ignore-hosts, then, go via proxy as usual. - Can I achieve this? Nevertheless, I'll take a look of socks... Tks again!

            – ThiagoCMC
            Apr 15 '14 at 0:56













            I guess it's possible that you could do an additional DNS request locally in addition to the DNS request the HTTP proxy server does, I don't know if you have that option "out of the box" though.

            – thomasrutter
            Apr 15 '14 at 1:13





            I guess it's possible that you could do an additional DNS request locally in addition to the DNS request the HTTP proxy server does, I don't know if you have that option "out of the box" though.

            – thomasrutter
            Apr 15 '14 at 1:13













            0














            edit: Or you can use a PAC file to control usage of proxy or not depending on your criteria. Autoproxyresultcache if applicable must be off.



            you can install Technitium and be the DNS server.
            https://technitium.com/






            share|improve this answer




























              0














              edit: Or you can use a PAC file to control usage of proxy or not depending on your criteria. Autoproxyresultcache if applicable must be off.



              you can install Technitium and be the DNS server.
              https://technitium.com/






              share|improve this answer


























                0












                0








                0







                edit: Or you can use a PAC file to control usage of proxy or not depending on your criteria. Autoproxyresultcache if applicable must be off.



                you can install Technitium and be the DNS server.
                https://technitium.com/






                share|improve this answer













                edit: Or you can use a PAC file to control usage of proxy or not depending on your criteria. Autoproxyresultcache if applicable must be off.



                you can install Technitium and be the DNS server.
                https://technitium.com/







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 19 at 23:13









                Jeff BouchardJeff Bouchard

                1




                1






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f447877%2fhow-to-resolve-the-dns-locally-when-there-is-a-proxy-configured%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                     ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕