Busybox ping IP works, but hostname nslookup fails with “bad address”












12














I am compiling my own 3.14 kernel. I fear I may have left out some important networking feature to get DNS working.



I can't resolve domain names. I can ping my DNS server.
I can resolve using that DNS on other machines so I know it's not the server.



~ # cat /etc/resolv.conf
nameserver 192.168.13.5

~ # nslookup google.com
Server: 192.168.13.5
Address 1: 192.168.13.5

nslookup: can't resolve 'google.com'

~ # ping -c 1 google.com
ping: bad address 'google.com'

~ # ping -c 1 192.168.13.5
PING 192.168.13.5 (192.168.13.5): 56 data bytes
64 bytes from 192.168.13.5: seq=0 ttl=128 time=0.382 ms

--- 192.168.13.5 ping ststistics ---
1 packets transmitted, 1 packets recieved, 0% packet loss
reound-trip min/avg/max = 0.382/0.382/0.382 ms


Any ideas what I left out? here is my config: http://pastebin.com/vt4vGTgJ



EDIT:



If it's not the kernel, what could I be missing? I am using busybox, statically linked. there are no shared libraries in this system.










share|improve this question
























  • Do you have any firewall configured? If so, do you block port 53 UDP/TCP?
    – Jenny D
    Apr 11 '14 at 14:03












  • No firewall, no block on port 53. I can access the DNS from another machine on the same subnet.
    – AllenKll
    Apr 11 '14 at 14:04










  • As far as i iknow you can't just disable DNS functionality by .config-options from your kernel.
    – Bonsi Scott
    Apr 11 '14 at 14:07






  • 1




    Are you sure that your DNS server @ 192.168.13.5 is allowing recursive queries? For example, if you dig @192.168.13.5 www.google.com do you get any additional info? Can you perform recursive queries against your DNS server 192.168.13.5 from other machines?
    – Chipster
    Apr 11 '14 at 14:54






  • 1




    your kernel seems to be Ok, but your DNS resolving does not work. Did you obtain the nameserver IP from DHCP? is route set? try a different nameserver i.e. nameserver 8.8.8.8.
    – user55518
    Apr 11 '14 at 15:12


















12














I am compiling my own 3.14 kernel. I fear I may have left out some important networking feature to get DNS working.



I can't resolve domain names. I can ping my DNS server.
I can resolve using that DNS on other machines so I know it's not the server.



~ # cat /etc/resolv.conf
nameserver 192.168.13.5

~ # nslookup google.com
Server: 192.168.13.5
Address 1: 192.168.13.5

nslookup: can't resolve 'google.com'

~ # ping -c 1 google.com
ping: bad address 'google.com'

~ # ping -c 1 192.168.13.5
PING 192.168.13.5 (192.168.13.5): 56 data bytes
64 bytes from 192.168.13.5: seq=0 ttl=128 time=0.382 ms

--- 192.168.13.5 ping ststistics ---
1 packets transmitted, 1 packets recieved, 0% packet loss
reound-trip min/avg/max = 0.382/0.382/0.382 ms


Any ideas what I left out? here is my config: http://pastebin.com/vt4vGTgJ



EDIT:



If it's not the kernel, what could I be missing? I am using busybox, statically linked. there are no shared libraries in this system.










share|improve this question
























  • Do you have any firewall configured? If so, do you block port 53 UDP/TCP?
    – Jenny D
    Apr 11 '14 at 14:03












  • No firewall, no block on port 53. I can access the DNS from another machine on the same subnet.
    – AllenKll
    Apr 11 '14 at 14:04










  • As far as i iknow you can't just disable DNS functionality by .config-options from your kernel.
    – Bonsi Scott
    Apr 11 '14 at 14:07






  • 1




    Are you sure that your DNS server @ 192.168.13.5 is allowing recursive queries? For example, if you dig @192.168.13.5 www.google.com do you get any additional info? Can you perform recursive queries against your DNS server 192.168.13.5 from other machines?
    – Chipster
    Apr 11 '14 at 14:54






  • 1




    your kernel seems to be Ok, but your DNS resolving does not work. Did you obtain the nameserver IP from DHCP? is route set? try a different nameserver i.e. nameserver 8.8.8.8.
    – user55518
    Apr 11 '14 at 15:12
















12












12








12


2





I am compiling my own 3.14 kernel. I fear I may have left out some important networking feature to get DNS working.



I can't resolve domain names. I can ping my DNS server.
I can resolve using that DNS on other machines so I know it's not the server.



~ # cat /etc/resolv.conf
nameserver 192.168.13.5

~ # nslookup google.com
Server: 192.168.13.5
Address 1: 192.168.13.5

nslookup: can't resolve 'google.com'

~ # ping -c 1 google.com
ping: bad address 'google.com'

~ # ping -c 1 192.168.13.5
PING 192.168.13.5 (192.168.13.5): 56 data bytes
64 bytes from 192.168.13.5: seq=0 ttl=128 time=0.382 ms

--- 192.168.13.5 ping ststistics ---
1 packets transmitted, 1 packets recieved, 0% packet loss
reound-trip min/avg/max = 0.382/0.382/0.382 ms


Any ideas what I left out? here is my config: http://pastebin.com/vt4vGTgJ



EDIT:



If it's not the kernel, what could I be missing? I am using busybox, statically linked. there are no shared libraries in this system.










share|improve this question















I am compiling my own 3.14 kernel. I fear I may have left out some important networking feature to get DNS working.



I can't resolve domain names. I can ping my DNS server.
I can resolve using that DNS on other machines so I know it's not the server.



~ # cat /etc/resolv.conf
nameserver 192.168.13.5

~ # nslookup google.com
Server: 192.168.13.5
Address 1: 192.168.13.5

nslookup: can't resolve 'google.com'

~ # ping -c 1 google.com
ping: bad address 'google.com'

~ # ping -c 1 192.168.13.5
PING 192.168.13.5 (192.168.13.5): 56 data bytes
64 bytes from 192.168.13.5: seq=0 ttl=128 time=0.382 ms

--- 192.168.13.5 ping ststistics ---
1 packets transmitted, 1 packets recieved, 0% packet loss
reound-trip min/avg/max = 0.382/0.382/0.382 ms


Any ideas what I left out? here is my config: http://pastebin.com/vt4vGTgJ



EDIT:



If it's not the kernel, what could I be missing? I am using busybox, statically linked. there are no shared libraries in this system.







linux kernel linux-kernel dns busybox






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 31 at 9:07









Ciro Santilli 新疆改造中心 六四事件 法轮功

4,90124040




4,90124040










asked Apr 11 '14 at 13:56









AllenKll

4181716




4181716












  • Do you have any firewall configured? If so, do you block port 53 UDP/TCP?
    – Jenny D
    Apr 11 '14 at 14:03












  • No firewall, no block on port 53. I can access the DNS from another machine on the same subnet.
    – AllenKll
    Apr 11 '14 at 14:04










  • As far as i iknow you can't just disable DNS functionality by .config-options from your kernel.
    – Bonsi Scott
    Apr 11 '14 at 14:07






  • 1




    Are you sure that your DNS server @ 192.168.13.5 is allowing recursive queries? For example, if you dig @192.168.13.5 www.google.com do you get any additional info? Can you perform recursive queries against your DNS server 192.168.13.5 from other machines?
    – Chipster
    Apr 11 '14 at 14:54






  • 1




    your kernel seems to be Ok, but your DNS resolving does not work. Did you obtain the nameserver IP from DHCP? is route set? try a different nameserver i.e. nameserver 8.8.8.8.
    – user55518
    Apr 11 '14 at 15:12




















  • Do you have any firewall configured? If so, do you block port 53 UDP/TCP?
    – Jenny D
    Apr 11 '14 at 14:03












  • No firewall, no block on port 53. I can access the DNS from another machine on the same subnet.
    – AllenKll
    Apr 11 '14 at 14:04










  • As far as i iknow you can't just disable DNS functionality by .config-options from your kernel.
    – Bonsi Scott
    Apr 11 '14 at 14:07






  • 1




    Are you sure that your DNS server @ 192.168.13.5 is allowing recursive queries? For example, if you dig @192.168.13.5 www.google.com do you get any additional info? Can you perform recursive queries against your DNS server 192.168.13.5 from other machines?
    – Chipster
    Apr 11 '14 at 14:54






  • 1




    your kernel seems to be Ok, but your DNS resolving does not work. Did you obtain the nameserver IP from DHCP? is route set? try a different nameserver i.e. nameserver 8.8.8.8.
    – user55518
    Apr 11 '14 at 15:12


















Do you have any firewall configured? If so, do you block port 53 UDP/TCP?
– Jenny D
Apr 11 '14 at 14:03






Do you have any firewall configured? If so, do you block port 53 UDP/TCP?
– Jenny D
Apr 11 '14 at 14:03














No firewall, no block on port 53. I can access the DNS from another machine on the same subnet.
– AllenKll
Apr 11 '14 at 14:04




No firewall, no block on port 53. I can access the DNS from another machine on the same subnet.
– AllenKll
Apr 11 '14 at 14:04












As far as i iknow you can't just disable DNS functionality by .config-options from your kernel.
– Bonsi Scott
Apr 11 '14 at 14:07




As far as i iknow you can't just disable DNS functionality by .config-options from your kernel.
– Bonsi Scott
Apr 11 '14 at 14:07




1




1




Are you sure that your DNS server @ 192.168.13.5 is allowing recursive queries? For example, if you dig @192.168.13.5 www.google.com do you get any additional info? Can you perform recursive queries against your DNS server 192.168.13.5 from other machines?
– Chipster
Apr 11 '14 at 14:54




Are you sure that your DNS server @ 192.168.13.5 is allowing recursive queries? For example, if you dig @192.168.13.5 www.google.com do you get any additional info? Can you perform recursive queries against your DNS server 192.168.13.5 from other machines?
– Chipster
Apr 11 '14 at 14:54




1




1




your kernel seems to be Ok, but your DNS resolving does not work. Did you obtain the nameserver IP from DHCP? is route set? try a different nameserver i.e. nameserver 8.8.8.8.
– user55518
Apr 11 '14 at 15:12






your kernel seems to be Ok, but your DNS resolving does not work. Did you obtain the nameserver IP from DHCP? is route set? try a different nameserver i.e. nameserver 8.8.8.8.
– user55518
Apr 11 '14 at 15:12












6 Answers
6






active

oldest

votes


















5














The problem is with busybox. I switched to a precompiled version and did not have issues. I need to look into compilation options with it. Thanks for your help.



https://gist.github.com/vsergeev/2391575:




There are known issues with DNS functionality in statically-linked glibc programs (like busybox in this case), because libnss must be dynamically loaded. Building a uClibc toolchain and linking busybox against that would resolve this.







share|improve this answer























  • Did you actually compile busybox against uClibc to verify this answer, or did it just seem the most plausible one?
    – Tim
    Jun 26 at 7:48










  • I did not test this. The precomoiled version worked for my issues.
    – AllenKll
    Jun 27 at 13:58



















2














I ran into the same issue and it turns out that busybox is picky about the format for resolv.conf. There must be exactly one blank between the nameserver tag and the address for nslookup to work.
In addition /etc/nsswitch.conf has to include dns for host.



[ busybox master (git hash 349d72c19)
sysroot-glibc-linaro-2.25-2018.05-arm-linux-gnueabihf
]



root@4000000a:~# cat /etc/nsswitch.conf 
passwd: files compat
shadow: files compat
hosts: files dns compat


Yes the question is old, but the current busybox still behaves this way.



[ I used xxd below to show the number of blanks in resolv.conf ]



This fails:



root@4000000a:~# xxd /etc/resolv.conf
00000000: 6e61 6d65 7365 7276 6572 2020 382e 382e nameserver 8.8.
00000010: 382e 380a 8.8.
root@4000000a:~# nslookup www.cnn.com
nslookup: bad address ' 8.8.8.8'


and this works:



root@4000000a:~# xxd /etc/resolv.conf
00000000: 6e61 6d65 7365 7276 6572 2038 2e38 2e38 nameserver 8.8.8
00000010: 2e38 0a .8.
root@4000000a:~# nslookup www.cnn.com
Server: 8.8.8.8
Address: 8.8.8.8:53

Non-authoritative answer:
www.cnn.com canonical name = turner-tls.map.fastly.net
Name: turner-tls.map.fastly.net
Address: 151.101.1.67
Name: turner-tls.map.fastly.net
Address: 151.101.65.67
Name: turner-tls.map.fastly.net
Address: 151.101.129.67
Name: turner-tls.map.fastly.net
Address: 151.101.193.67

Non-authoritative answer:
www.cnn.com canonical name = turner-tls.map.fastly.net
Name: turner-tls.map.fastly.net
Address: 2a04:4e42::323
Name: turner-tls.map.fastly.net
Address: 2a04:4e42:200::323
Name: turner-tls.map.fastly.net
Address: 2a04:4e42:400::323
Name: turner-tls.map.fastly.net
Address: 2a04:4e42:600::323





share|improve this answer































    0














    I'm not sure if this is the same problem I had or not, but I recently upgraded and old internal DNS server system from OpenBSD 3.8 to 5.6, and I lost the ability to resolve hosts with ping, but the host command was working. Turned out I had to add 127.0.0.1/8 to the match-clients directive in named in addition to the 192.168.0.0/16 which I already had there, and then it started to work properly after restarting named.






    share|improve this answer





























      0














      I had the same problem. I've used buildroot to build the filesystem, to compile the kernel and to add extra packages with busybox.



      I was only able to ping an ip address. With url the ping command returned: bad address error. Then I changed the resolv.conf file.



      sudo vim /etc/resolv.conf

      nameserver gateway_ip_address
      nameserver 8.8.8.8
      nameserver 8.8.4.4


      And everything worked fine.






      share|improve this answer

















      • 1




        That does not seem to solve the problem for me. As OP mentioned, it seems to be down to libnss not working when statically linked. Compiling busybox with uclibc (and udhcpc) seems to solve the issue for me.
        – Attila O.
        Jan 13 '15 at 10:19



















      0














      I resolved the same symptoms by editing: /etc/nsswitch.conf and adding DNS to the following line:



      hosts:      files dns





      share|improve this answer































        -1














        sudo vim /etc/resolv.conf to edit resolv.conf, make sure nameserver addresses (as well as the keyword 'nameserver') are separated by a single space, not a comma, like below:



        nameserver 8.8.8.8 8.8.4.4





        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%2f124283%2fbusybox-ping-ip-works-but-hostname-nslookup-fails-with-bad-address%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          6 Answers
          6






          active

          oldest

          votes








          6 Answers
          6






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5














          The problem is with busybox. I switched to a precompiled version and did not have issues. I need to look into compilation options with it. Thanks for your help.



          https://gist.github.com/vsergeev/2391575:




          There are known issues with DNS functionality in statically-linked glibc programs (like busybox in this case), because libnss must be dynamically loaded. Building a uClibc toolchain and linking busybox against that would resolve this.







          share|improve this answer























          • Did you actually compile busybox against uClibc to verify this answer, or did it just seem the most plausible one?
            – Tim
            Jun 26 at 7:48










          • I did not test this. The precomoiled version worked for my issues.
            – AllenKll
            Jun 27 at 13:58
















          5














          The problem is with busybox. I switched to a precompiled version and did not have issues. I need to look into compilation options with it. Thanks for your help.



          https://gist.github.com/vsergeev/2391575:




          There are known issues with DNS functionality in statically-linked glibc programs (like busybox in this case), because libnss must be dynamically loaded. Building a uClibc toolchain and linking busybox against that would resolve this.







          share|improve this answer























          • Did you actually compile busybox against uClibc to verify this answer, or did it just seem the most plausible one?
            – Tim
            Jun 26 at 7:48










          • I did not test this. The precomoiled version worked for my issues.
            – AllenKll
            Jun 27 at 13:58














          5












          5








          5






          The problem is with busybox. I switched to a precompiled version and did not have issues. I need to look into compilation options with it. Thanks for your help.



          https://gist.github.com/vsergeev/2391575:




          There are known issues with DNS functionality in statically-linked glibc programs (like busybox in this case), because libnss must be dynamically loaded. Building a uClibc toolchain and linking busybox against that would resolve this.







          share|improve this answer














          The problem is with busybox. I switched to a precompiled version and did not have issues. I need to look into compilation options with it. Thanks for your help.



          https://gist.github.com/vsergeev/2391575:




          There are known issues with DNS functionality in statically-linked glibc programs (like busybox in this case), because libnss must be dynamically loaded. Building a uClibc toolchain and linking busybox against that would resolve this.








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 10 '15 at 14:57









          terdon

          128k31249423




          128k31249423










          answered May 29 '15 at 17:55









          AllenKll

          4181716




          4181716












          • Did you actually compile busybox against uClibc to verify this answer, or did it just seem the most plausible one?
            – Tim
            Jun 26 at 7:48










          • I did not test this. The precomoiled version worked for my issues.
            – AllenKll
            Jun 27 at 13:58


















          • Did you actually compile busybox against uClibc to verify this answer, or did it just seem the most plausible one?
            – Tim
            Jun 26 at 7:48










          • I did not test this. The precomoiled version worked for my issues.
            – AllenKll
            Jun 27 at 13:58
















          Did you actually compile busybox against uClibc to verify this answer, or did it just seem the most plausible one?
          – Tim
          Jun 26 at 7:48




          Did you actually compile busybox against uClibc to verify this answer, or did it just seem the most plausible one?
          – Tim
          Jun 26 at 7:48












          I did not test this. The precomoiled version worked for my issues.
          – AllenKll
          Jun 27 at 13:58




          I did not test this. The precomoiled version worked for my issues.
          – AllenKll
          Jun 27 at 13:58













          2














          I ran into the same issue and it turns out that busybox is picky about the format for resolv.conf. There must be exactly one blank between the nameserver tag and the address for nslookup to work.
          In addition /etc/nsswitch.conf has to include dns for host.



          [ busybox master (git hash 349d72c19)
          sysroot-glibc-linaro-2.25-2018.05-arm-linux-gnueabihf
          ]



          root@4000000a:~# cat /etc/nsswitch.conf 
          passwd: files compat
          shadow: files compat
          hosts: files dns compat


          Yes the question is old, but the current busybox still behaves this way.



          [ I used xxd below to show the number of blanks in resolv.conf ]



          This fails:



          root@4000000a:~# xxd /etc/resolv.conf
          00000000: 6e61 6d65 7365 7276 6572 2020 382e 382e nameserver 8.8.
          00000010: 382e 380a 8.8.
          root@4000000a:~# nslookup www.cnn.com
          nslookup: bad address ' 8.8.8.8'


          and this works:



          root@4000000a:~# xxd /etc/resolv.conf
          00000000: 6e61 6d65 7365 7276 6572 2038 2e38 2e38 nameserver 8.8.8
          00000010: 2e38 0a .8.
          root@4000000a:~# nslookup www.cnn.com
          Server: 8.8.8.8
          Address: 8.8.8.8:53

          Non-authoritative answer:
          www.cnn.com canonical name = turner-tls.map.fastly.net
          Name: turner-tls.map.fastly.net
          Address: 151.101.1.67
          Name: turner-tls.map.fastly.net
          Address: 151.101.65.67
          Name: turner-tls.map.fastly.net
          Address: 151.101.129.67
          Name: turner-tls.map.fastly.net
          Address: 151.101.193.67

          Non-authoritative answer:
          www.cnn.com canonical name = turner-tls.map.fastly.net
          Name: turner-tls.map.fastly.net
          Address: 2a04:4e42::323
          Name: turner-tls.map.fastly.net
          Address: 2a04:4e42:200::323
          Name: turner-tls.map.fastly.net
          Address: 2a04:4e42:400::323
          Name: turner-tls.map.fastly.net
          Address: 2a04:4e42:600::323





          share|improve this answer




























            2














            I ran into the same issue and it turns out that busybox is picky about the format for resolv.conf. There must be exactly one blank between the nameserver tag and the address for nslookup to work.
            In addition /etc/nsswitch.conf has to include dns for host.



            [ busybox master (git hash 349d72c19)
            sysroot-glibc-linaro-2.25-2018.05-arm-linux-gnueabihf
            ]



            root@4000000a:~# cat /etc/nsswitch.conf 
            passwd: files compat
            shadow: files compat
            hosts: files dns compat


            Yes the question is old, but the current busybox still behaves this way.



            [ I used xxd below to show the number of blanks in resolv.conf ]



            This fails:



            root@4000000a:~# xxd /etc/resolv.conf
            00000000: 6e61 6d65 7365 7276 6572 2020 382e 382e nameserver 8.8.
            00000010: 382e 380a 8.8.
            root@4000000a:~# nslookup www.cnn.com
            nslookup: bad address ' 8.8.8.8'


            and this works:



            root@4000000a:~# xxd /etc/resolv.conf
            00000000: 6e61 6d65 7365 7276 6572 2038 2e38 2e38 nameserver 8.8.8
            00000010: 2e38 0a .8.
            root@4000000a:~# nslookup www.cnn.com
            Server: 8.8.8.8
            Address: 8.8.8.8:53

            Non-authoritative answer:
            www.cnn.com canonical name = turner-tls.map.fastly.net
            Name: turner-tls.map.fastly.net
            Address: 151.101.1.67
            Name: turner-tls.map.fastly.net
            Address: 151.101.65.67
            Name: turner-tls.map.fastly.net
            Address: 151.101.129.67
            Name: turner-tls.map.fastly.net
            Address: 151.101.193.67

            Non-authoritative answer:
            www.cnn.com canonical name = turner-tls.map.fastly.net
            Name: turner-tls.map.fastly.net
            Address: 2a04:4e42::323
            Name: turner-tls.map.fastly.net
            Address: 2a04:4e42:200::323
            Name: turner-tls.map.fastly.net
            Address: 2a04:4e42:400::323
            Name: turner-tls.map.fastly.net
            Address: 2a04:4e42:600::323





            share|improve this answer


























              2












              2








              2






              I ran into the same issue and it turns out that busybox is picky about the format for resolv.conf. There must be exactly one blank between the nameserver tag and the address for nslookup to work.
              In addition /etc/nsswitch.conf has to include dns for host.



              [ busybox master (git hash 349d72c19)
              sysroot-glibc-linaro-2.25-2018.05-arm-linux-gnueabihf
              ]



              root@4000000a:~# cat /etc/nsswitch.conf 
              passwd: files compat
              shadow: files compat
              hosts: files dns compat


              Yes the question is old, but the current busybox still behaves this way.



              [ I used xxd below to show the number of blanks in resolv.conf ]



              This fails:



              root@4000000a:~# xxd /etc/resolv.conf
              00000000: 6e61 6d65 7365 7276 6572 2020 382e 382e nameserver 8.8.
              00000010: 382e 380a 8.8.
              root@4000000a:~# nslookup www.cnn.com
              nslookup: bad address ' 8.8.8.8'


              and this works:



              root@4000000a:~# xxd /etc/resolv.conf
              00000000: 6e61 6d65 7365 7276 6572 2038 2e38 2e38 nameserver 8.8.8
              00000010: 2e38 0a .8.
              root@4000000a:~# nslookup www.cnn.com
              Server: 8.8.8.8
              Address: 8.8.8.8:53

              Non-authoritative answer:
              www.cnn.com canonical name = turner-tls.map.fastly.net
              Name: turner-tls.map.fastly.net
              Address: 151.101.1.67
              Name: turner-tls.map.fastly.net
              Address: 151.101.65.67
              Name: turner-tls.map.fastly.net
              Address: 151.101.129.67
              Name: turner-tls.map.fastly.net
              Address: 151.101.193.67

              Non-authoritative answer:
              www.cnn.com canonical name = turner-tls.map.fastly.net
              Name: turner-tls.map.fastly.net
              Address: 2a04:4e42::323
              Name: turner-tls.map.fastly.net
              Address: 2a04:4e42:200::323
              Name: turner-tls.map.fastly.net
              Address: 2a04:4e42:400::323
              Name: turner-tls.map.fastly.net
              Address: 2a04:4e42:600::323





              share|improve this answer














              I ran into the same issue and it turns out that busybox is picky about the format for resolv.conf. There must be exactly one blank between the nameserver tag and the address for nslookup to work.
              In addition /etc/nsswitch.conf has to include dns for host.



              [ busybox master (git hash 349d72c19)
              sysroot-glibc-linaro-2.25-2018.05-arm-linux-gnueabihf
              ]



              root@4000000a:~# cat /etc/nsswitch.conf 
              passwd: files compat
              shadow: files compat
              hosts: files dns compat


              Yes the question is old, but the current busybox still behaves this way.



              [ I used xxd below to show the number of blanks in resolv.conf ]



              This fails:



              root@4000000a:~# xxd /etc/resolv.conf
              00000000: 6e61 6d65 7365 7276 6572 2020 382e 382e nameserver 8.8.
              00000010: 382e 380a 8.8.
              root@4000000a:~# nslookup www.cnn.com
              nslookup: bad address ' 8.8.8.8'


              and this works:



              root@4000000a:~# xxd /etc/resolv.conf
              00000000: 6e61 6d65 7365 7276 6572 2038 2e38 2e38 nameserver 8.8.8
              00000010: 2e38 0a .8.
              root@4000000a:~# nslookup www.cnn.com
              Server: 8.8.8.8
              Address: 8.8.8.8:53

              Non-authoritative answer:
              www.cnn.com canonical name = turner-tls.map.fastly.net
              Name: turner-tls.map.fastly.net
              Address: 151.101.1.67
              Name: turner-tls.map.fastly.net
              Address: 151.101.65.67
              Name: turner-tls.map.fastly.net
              Address: 151.101.129.67
              Name: turner-tls.map.fastly.net
              Address: 151.101.193.67

              Non-authoritative answer:
              www.cnn.com canonical name = turner-tls.map.fastly.net
              Name: turner-tls.map.fastly.net
              Address: 2a04:4e42::323
              Name: turner-tls.map.fastly.net
              Address: 2a04:4e42:200::323
              Name: turner-tls.map.fastly.net
              Address: 2a04:4e42:400::323
              Name: turner-tls.map.fastly.net
              Address: 2a04:4e42:600::323






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Oct 15 at 18:18

























              answered Oct 15 at 17:16









              sgrefen

              212




              212























                  0














                  I'm not sure if this is the same problem I had or not, but I recently upgraded and old internal DNS server system from OpenBSD 3.8 to 5.6, and I lost the ability to resolve hosts with ping, but the host command was working. Turned out I had to add 127.0.0.1/8 to the match-clients directive in named in addition to the 192.168.0.0/16 which I already had there, and then it started to work properly after restarting named.






                  share|improve this answer


























                    0














                    I'm not sure if this is the same problem I had or not, but I recently upgraded and old internal DNS server system from OpenBSD 3.8 to 5.6, and I lost the ability to resolve hosts with ping, but the host command was working. Turned out I had to add 127.0.0.1/8 to the match-clients directive in named in addition to the 192.168.0.0/16 which I already had there, and then it started to work properly after restarting named.






                    share|improve this answer
























                      0












                      0








                      0






                      I'm not sure if this is the same problem I had or not, but I recently upgraded and old internal DNS server system from OpenBSD 3.8 to 5.6, and I lost the ability to resolve hosts with ping, but the host command was working. Turned out I had to add 127.0.0.1/8 to the match-clients directive in named in addition to the 192.168.0.0/16 which I already had there, and then it started to work properly after restarting named.






                      share|improve this answer












                      I'm not sure if this is the same problem I had or not, but I recently upgraded and old internal DNS server system from OpenBSD 3.8 to 5.6, and I lost the ability to resolve hosts with ping, but the host command was working. Turned out I had to add 127.0.0.1/8 to the match-clients directive in named in addition to the 192.168.0.0/16 which I already had there, and then it started to work properly after restarting named.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Dec 2 '14 at 1:35









                      RedScourge

                      1292




                      1292























                          0














                          I had the same problem. I've used buildroot to build the filesystem, to compile the kernel and to add extra packages with busybox.



                          I was only able to ping an ip address. With url the ping command returned: bad address error. Then I changed the resolv.conf file.



                          sudo vim /etc/resolv.conf

                          nameserver gateway_ip_address
                          nameserver 8.8.8.8
                          nameserver 8.8.4.4


                          And everything worked fine.






                          share|improve this answer

















                          • 1




                            That does not seem to solve the problem for me. As OP mentioned, it seems to be down to libnss not working when statically linked. Compiling busybox with uclibc (and udhcpc) seems to solve the issue for me.
                            – Attila O.
                            Jan 13 '15 at 10:19
















                          0














                          I had the same problem. I've used buildroot to build the filesystem, to compile the kernel and to add extra packages with busybox.



                          I was only able to ping an ip address. With url the ping command returned: bad address error. Then I changed the resolv.conf file.



                          sudo vim /etc/resolv.conf

                          nameserver gateway_ip_address
                          nameserver 8.8.8.8
                          nameserver 8.8.4.4


                          And everything worked fine.






                          share|improve this answer

















                          • 1




                            That does not seem to solve the problem for me. As OP mentioned, it seems to be down to libnss not working when statically linked. Compiling busybox with uclibc (and udhcpc) seems to solve the issue for me.
                            – Attila O.
                            Jan 13 '15 at 10:19














                          0












                          0








                          0






                          I had the same problem. I've used buildroot to build the filesystem, to compile the kernel and to add extra packages with busybox.



                          I was only able to ping an ip address. With url the ping command returned: bad address error. Then I changed the resolv.conf file.



                          sudo vim /etc/resolv.conf

                          nameserver gateway_ip_address
                          nameserver 8.8.8.8
                          nameserver 8.8.4.4


                          And everything worked fine.






                          share|improve this answer












                          I had the same problem. I've used buildroot to build the filesystem, to compile the kernel and to add extra packages with busybox.



                          I was only able to ping an ip address. With url the ping command returned: bad address error. Then I changed the resolv.conf file.



                          sudo vim /etc/resolv.conf

                          nameserver gateway_ip_address
                          nameserver 8.8.8.8
                          nameserver 8.8.4.4


                          And everything worked fine.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 11 '15 at 19:05









                          UserK

                          72641122




                          72641122








                          • 1




                            That does not seem to solve the problem for me. As OP mentioned, it seems to be down to libnss not working when statically linked. Compiling busybox with uclibc (and udhcpc) seems to solve the issue for me.
                            – Attila O.
                            Jan 13 '15 at 10:19














                          • 1




                            That does not seem to solve the problem for me. As OP mentioned, it seems to be down to libnss not working when statically linked. Compiling busybox with uclibc (and udhcpc) seems to solve the issue for me.
                            – Attila O.
                            Jan 13 '15 at 10:19








                          1




                          1




                          That does not seem to solve the problem for me. As OP mentioned, it seems to be down to libnss not working when statically linked. Compiling busybox with uclibc (and udhcpc) seems to solve the issue for me.
                          – Attila O.
                          Jan 13 '15 at 10:19




                          That does not seem to solve the problem for me. As OP mentioned, it seems to be down to libnss not working when statically linked. Compiling busybox with uclibc (and udhcpc) seems to solve the issue for me.
                          – Attila O.
                          Jan 13 '15 at 10:19











                          0














                          I resolved the same symptoms by editing: /etc/nsswitch.conf and adding DNS to the following line:



                          hosts:      files dns





                          share|improve this answer




























                            0














                            I resolved the same symptoms by editing: /etc/nsswitch.conf and adding DNS to the following line:



                            hosts:      files dns





                            share|improve this answer


























                              0












                              0








                              0






                              I resolved the same symptoms by editing: /etc/nsswitch.conf and adding DNS to the following line:



                              hosts:      files dns





                              share|improve this answer














                              I resolved the same symptoms by editing: /etc/nsswitch.conf and adding DNS to the following line:



                              hosts:      files dns






                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Dec 10 '15 at 14:46









                              Kevdog777

                              2,092123259




                              2,092123259










                              answered Dec 10 '15 at 14:14









                              Burmanese

                              1




                              1























                                  -1














                                  sudo vim /etc/resolv.conf to edit resolv.conf, make sure nameserver addresses (as well as the keyword 'nameserver') are separated by a single space, not a comma, like below:



                                  nameserver 8.8.8.8 8.8.4.4





                                  share|improve this answer


























                                    -1














                                    sudo vim /etc/resolv.conf to edit resolv.conf, make sure nameserver addresses (as well as the keyword 'nameserver') are separated by a single space, not a comma, like below:



                                    nameserver 8.8.8.8 8.8.4.4





                                    share|improve this answer
























                                      -1












                                      -1








                                      -1






                                      sudo vim /etc/resolv.conf to edit resolv.conf, make sure nameserver addresses (as well as the keyword 'nameserver') are separated by a single space, not a comma, like below:



                                      nameserver 8.8.8.8 8.8.4.4





                                      share|improve this answer












                                      sudo vim /etc/resolv.conf to edit resolv.conf, make sure nameserver addresses (as well as the keyword 'nameserver') are separated by a single space, not a comma, like below:



                                      nameserver 8.8.8.8 8.8.4.4






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Dec 17 at 2:37









                                      Steve Shen

                                      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.





                                          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                          Please pay close attention to the following guidance:


                                          • 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%2f124283%2fbusybox-ping-ip-works-but-hostname-nslookup-fails-with-bad-address%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

                                          Morgemoulin

                                          Scott Moir

                                          Souastre