Kali Dns Problems

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite
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














up vote
1
down vote

favorite
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












up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






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













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









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

5917




5917







  • 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

















up vote
1
down vote













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



























    up vote
    0
    down vote













    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',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      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






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote













      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
























        up vote
        1
        down vote













        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






















          up vote
          1
          down vote










          up vote
          1
          down vote









          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









          ncomputers

          8481418




          8481418






















              up vote
              0
              down vote













              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


























                up vote
                0
                down vote













                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
























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  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,63141124




                  3,63141124










                  answered Mar 10 '17 at 10:22









                  James Young

                  1




                  1



























                       

                      draft saved


                      draft discarded















































                       


                      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













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay