Kali Dns Problems












1















I have a problem. So, when I connect to any wi-fi station I can't use google or yandex. I solved that. The thing was in dns. I added google dns servers to 'resolv.conf' and it worked fine. However, after reconnection it does the same thing and I have to write manually or with script to set dns.
Is there any way to make this process automatically when the computer connects to the network? I tried to do it through the network/interfaces post-up and if-up.d . But it didn't help. The code is like that.



interfaces:



auto wlan0
iface wlan0 inet dhcp
post-up /etc/network/ssh_and_dns_start


ssh_and_dns_start:



#!/bin/sh

add_dns()
{
echo "nameserver 8.8.8.8
nameserver 8.8.4.4" >> /etc/resolv.conf
}

add_dns
exit 0









share|improve this question


















  • 1





    See askubuntu.com/questions/2321/…

    – Panther
    Dec 26 '15 at 14:08











  • @bodhi.zazen Thank you very much! But is there any chance to set default dns settings? Or should I add these dns to every network manually?

    – Дима Долгополов
    Dec 26 '15 at 16:00













  • What are you trying to do exactly ? In the link there are several options to set your dns server. And what do you mean by "dns to every network manually"?

    – Panther
    Dec 26 '15 at 18:33











  • @bodhi.zazen there is a method for setting dns for one network through Network Settings. But I want these setting for every network that I will connect in the future. Kinda default settings. That is my question.

    – Дима Долгополов
    Dec 27 '15 at 14:44











  • Those settings should work on all networks you connect to.

    – Panther
    Dec 28 '15 at 16:42
















1















I have a problem. So, when I connect to any wi-fi station I can't use google or yandex. I solved that. The thing was in dns. I added google dns servers to 'resolv.conf' and it worked fine. However, after reconnection it does the same thing and I have to write manually or with script to set dns.
Is there any way to make this process automatically when the computer connects to the network? I tried to do it through the network/interfaces post-up and if-up.d . But it didn't help. The code is like that.



interfaces:



auto wlan0
iface wlan0 inet dhcp
post-up /etc/network/ssh_and_dns_start


ssh_and_dns_start:



#!/bin/sh

add_dns()
{
echo "nameserver 8.8.8.8
nameserver 8.8.4.4" >> /etc/resolv.conf
}

add_dns
exit 0









share|improve this question


















  • 1





    See askubuntu.com/questions/2321/…

    – Panther
    Dec 26 '15 at 14:08











  • @bodhi.zazen Thank you very much! But is there any chance to set default dns settings? Or should I add these dns to every network manually?

    – Дима Долгополов
    Dec 26 '15 at 16:00













  • What are you trying to do exactly ? In the link there are several options to set your dns server. And what do you mean by "dns to every network manually"?

    – Panther
    Dec 26 '15 at 18:33











  • @bodhi.zazen there is a method for setting dns for one network through Network Settings. But I want these setting for every network that I will connect in the future. Kinda default settings. That is my question.

    – Дима Долгополов
    Dec 27 '15 at 14:44











  • Those settings should work on all networks you connect to.

    – Panther
    Dec 28 '15 at 16:42














1












1








1


2






I have a problem. So, when I connect to any wi-fi station I can't use google or yandex. I solved that. The thing was in dns. I added google dns servers to 'resolv.conf' and it worked fine. However, after reconnection it does the same thing and I have to write manually or with script to set dns.
Is there any way to make this process automatically when the computer connects to the network? I tried to do it through the network/interfaces post-up and if-up.d . But it didn't help. The code is like that.



interfaces:



auto wlan0
iface wlan0 inet dhcp
post-up /etc/network/ssh_and_dns_start


ssh_and_dns_start:



#!/bin/sh

add_dns()
{
echo "nameserver 8.8.8.8
nameserver 8.8.4.4" >> /etc/resolv.conf
}

add_dns
exit 0









share|improve this question














I have a problem. So, when I connect to any wi-fi station I can't use google or yandex. I solved that. The thing was in dns. I added google dns servers to 'resolv.conf' and it worked fine. However, after reconnection it does the same thing and I have to write manually or with script to set dns.
Is there any way to make this process automatically when the computer connects to the network? I tried to do it through the network/interfaces post-up and if-up.d . But it didn't help. The code is like that.



interfaces:



auto wlan0
iface wlan0 inet dhcp
post-up /etc/network/ssh_and_dns_start


ssh_and_dns_start:



#!/bin/sh

add_dns()
{
echo "nameserver 8.8.8.8
nameserver 8.8.4.4" >> /etc/resolv.conf
}

add_dns
exit 0






networking dns kali-linux






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 26 '15 at 12:03









Дима ДолгополовДима Долгополов

5927




5927








  • 1





    See askubuntu.com/questions/2321/…

    – Panther
    Dec 26 '15 at 14:08











  • @bodhi.zazen Thank you very much! But is there any chance to set default dns settings? Or should I add these dns to every network manually?

    – Дима Долгополов
    Dec 26 '15 at 16:00













  • What are you trying to do exactly ? In the link there are several options to set your dns server. And what do you mean by "dns to every network manually"?

    – Panther
    Dec 26 '15 at 18:33











  • @bodhi.zazen there is a method for setting dns for one network through Network Settings. But I want these setting for every network that I will connect in the future. Kinda default settings. That is my question.

    – Дима Долгополов
    Dec 27 '15 at 14:44











  • Those settings should work on all networks you connect to.

    – Panther
    Dec 28 '15 at 16:42














  • 1





    See askubuntu.com/questions/2321/…

    – Panther
    Dec 26 '15 at 14:08











  • @bodhi.zazen Thank you very much! But is there any chance to set default dns settings? Or should I add these dns to every network manually?

    – Дима Долгополов
    Dec 26 '15 at 16:00













  • What are you trying to do exactly ? In the link there are several options to set your dns server. And what do you mean by "dns to every network manually"?

    – Panther
    Dec 26 '15 at 18:33











  • @bodhi.zazen there is a method for setting dns for one network through Network Settings. But I want these setting for every network that I will connect in the future. Kinda default settings. That is my question.

    – Дима Долгополов
    Dec 27 '15 at 14:44











  • Those settings should work on all networks you connect to.

    – Panther
    Dec 28 '15 at 16:42








1




1





See askubuntu.com/questions/2321/…

– Panther
Dec 26 '15 at 14:08





See askubuntu.com/questions/2321/…

– Panther
Dec 26 '15 at 14:08













@bodhi.zazen Thank you very much! But is there any chance to set default dns settings? Or should I add these dns to every network manually?

– Дима Долгополов
Dec 26 '15 at 16:00







@bodhi.zazen Thank you very much! But is there any chance to set default dns settings? Or should I add these dns to every network manually?

– Дима Долгополов
Dec 26 '15 at 16:00















What are you trying to do exactly ? In the link there are several options to set your dns server. And what do you mean by "dns to every network manually"?

– Panther
Dec 26 '15 at 18:33





What are you trying to do exactly ? In the link there are several options to set your dns server. And what do you mean by "dns to every network manually"?

– Panther
Dec 26 '15 at 18:33













@bodhi.zazen there is a method for setting dns for one network through Network Settings. But I want these setting for every network that I will connect in the future. Kinda default settings. That is my question.

– Дима Долгополов
Dec 27 '15 at 14:44





@bodhi.zazen there is a method for setting dns for one network through Network Settings. But I want these setting for every network that I will connect in the future. Kinda default settings. That is my question.

– Дима Долгополов
Dec 27 '15 at 14:44













Those settings should work on all networks you connect to.

– Panther
Dec 28 '15 at 16:42





Those settings should work on all networks you connect to.

– Panther
Dec 28 '15 at 16:42










2 Answers
2






active

oldest

votes


















2














Try adding this to /etc/dhcp/dhclient.conf



interface "wlan0"{
supersede domain-name-servers 8.8.8.8, 8.8.4.4;
}





share|improve this answer































    0














    The way I did it was hackish and probably not the way you would want to do it, but if you just need the bleeping thing working...



    So I had set up Kali connected to ethernet and when I went to add a wifi connection, no DNS. /etc/resolv.conf pointed to something like /run/resolvconf/... which pointed to yet another thing.



    There's not the option to sudo yourself and vim /etc/resolv.conf - for a few reasons. So logout, login as root, delete the symlink /etc/resolvconf/... points to, then vim /etc/resolv.conf and add the nameservers you want, e.g.



    nameserver your.gateway.ip


    or



    nameserver 8.8.8.8
    nameserver 8.8.4.4


    Before this, you can try



    root@kali# dhclient wlan0


    to get some information. I didn't find it very helpful. Editing the wireless connection settings with the GUI didn't work for me, even though it picked up on the nameservers. I just went ahead and deleted the symlink for /etc/resolv.conf and created /etc/resolv.conf, and all was fine.






    share|improve this answer

























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      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: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      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%2funix.stackexchange.com%2fquestions%2f251620%2fkali-dns-problems%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














      Try adding this to /etc/dhcp/dhclient.conf



      interface "wlan0"{
      supersede domain-name-servers 8.8.8.8, 8.8.4.4;
      }





      share|improve this answer




























        2














        Try adding this to /etc/dhcp/dhclient.conf



        interface "wlan0"{
        supersede domain-name-servers 8.8.8.8, 8.8.4.4;
        }





        share|improve this answer


























          2












          2








          2







          Try adding this to /etc/dhcp/dhclient.conf



          interface "wlan0"{
          supersede domain-name-servers 8.8.8.8, 8.8.4.4;
          }





          share|improve this answer













          Try adding this to /etc/dhcp/dhclient.conf



          interface "wlan0"{
          supersede domain-name-servers 8.8.8.8, 8.8.4.4;
          }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 13 '16 at 19:04









          ncomputersncomputers

          8931519




          8931519

























              0














              The way I did it was hackish and probably not the way you would want to do it, but if you just need the bleeping thing working...



              So I had set up Kali connected to ethernet and when I went to add a wifi connection, no DNS. /etc/resolv.conf pointed to something like /run/resolvconf/... which pointed to yet another thing.



              There's not the option to sudo yourself and vim /etc/resolv.conf - for a few reasons. So logout, login as root, delete the symlink /etc/resolvconf/... points to, then vim /etc/resolv.conf and add the nameservers you want, e.g.



              nameserver your.gateway.ip


              or



              nameserver 8.8.8.8
              nameserver 8.8.4.4


              Before this, you can try



              root@kali# dhclient wlan0


              to get some information. I didn't find it very helpful. Editing the wireless connection settings with the GUI didn't work for me, even though it picked up on the nameservers. I just went ahead and deleted the symlink for /etc/resolv.conf and created /etc/resolv.conf, and all was fine.






              share|improve this answer






























                0














                The way I did it was hackish and probably not the way you would want to do it, but if you just need the bleeping thing working...



                So I had set up Kali connected to ethernet and when I went to add a wifi connection, no DNS. /etc/resolv.conf pointed to something like /run/resolvconf/... which pointed to yet another thing.



                There's not the option to sudo yourself and vim /etc/resolv.conf - for a few reasons. So logout, login as root, delete the symlink /etc/resolvconf/... points to, then vim /etc/resolv.conf and add the nameservers you want, e.g.



                nameserver your.gateway.ip


                or



                nameserver 8.8.8.8
                nameserver 8.8.4.4


                Before this, you can try



                root@kali# dhclient wlan0


                to get some information. I didn't find it very helpful. Editing the wireless connection settings with the GUI didn't work for me, even though it picked up on the nameservers. I just went ahead and deleted the symlink for /etc/resolv.conf and created /etc/resolv.conf, and all was fine.






                share|improve this answer




























                  0












                  0








                  0







                  The way I did it was hackish and probably not the way you would want to do it, but if you just need the bleeping thing working...



                  So I had set up Kali connected to ethernet and when I went to add a wifi connection, no DNS. /etc/resolv.conf pointed to something like /run/resolvconf/... which pointed to yet another thing.



                  There's not the option to sudo yourself and vim /etc/resolv.conf - for a few reasons. So logout, login as root, delete the symlink /etc/resolvconf/... points to, then vim /etc/resolv.conf and add the nameservers you want, e.g.



                  nameserver your.gateway.ip


                  or



                  nameserver 8.8.8.8
                  nameserver 8.8.4.4


                  Before this, you can try



                  root@kali# dhclient wlan0


                  to get some information. I didn't find it very helpful. Editing the wireless connection settings with the GUI didn't work for me, even though it picked up on the nameservers. I just went ahead and deleted the symlink for /etc/resolv.conf and created /etc/resolv.conf, and all was fine.






                  share|improve this answer















                  The way I did it was hackish and probably not the way you would want to do it, but if you just need the bleeping thing working...



                  So I had set up Kali connected to ethernet and when I went to add a wifi connection, no DNS. /etc/resolv.conf pointed to something like /run/resolvconf/... which pointed to yet another thing.



                  There's not the option to sudo yourself and vim /etc/resolv.conf - for a few reasons. So logout, login as root, delete the symlink /etc/resolvconf/... points to, then vim /etc/resolv.conf and add the nameservers you want, e.g.



                  nameserver your.gateway.ip


                  or



                  nameserver 8.8.8.8
                  nameserver 8.8.4.4


                  Before this, you can try



                  root@kali# dhclient wlan0


                  to get some information. I didn't find it very helpful. Editing the wireless connection settings with the GUI didn't work for me, even though it picked up on the nameservers. I just went ahead and deleted the symlink for /etc/resolv.conf and created /etc/resolv.conf, and all was fine.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 10 '17 at 10:42









                  Thomas

                  3,93961327




                  3,93961327










                  answered Mar 10 '17 at 10:22









                  James YoungJames Young

                  1




                  1






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • 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%2funix.stackexchange.com%2fquestions%2f251620%2fkali-dns-problems%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

                      How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

                      is 'sed' thread safe

                      How to make a Squid Proxy server?