Every time I try to telnet to a domain on my LG Ally it fails, but it works if I use an IP address. So I tried to use nslookup telehack.com and it returns:

Address 1:

nslookup: can't resolve 'telehack.com'

I have Android Terminal Emulator and BusyBox installed,

It wasn't working with the default dns, so now I've got my dns entries set to OpenDNS, and it still won't resolve.

is there anything I can do to resolve this, or is it a limitation on the Ally?

  • I have no issue doing an NSlookup on that domain or any domain for that matter. – Ryan Conrad Jun 20 '11 at 17:22
  • What's your network setup like? Do you have ports blocked or forwarded? – Matthew Read Jun 20 '11 at 18:47
  • I'm having the same issue. – bot47 Jun 21 '11 at 10:58

This is a known design problem when using statically linked libresolv and glibc.

You have 2 options:

  1. Use Google Android's native libc Bionic library instead of glibc.

  2. Build busybox to search libraries in /system/lib (or make the necessary links e.g. /usr/lib -> /system/lib ). Place ld-linux.so.3, libc.so.6, libresolv.so.2, libnss_dns.so.2 in your /system/lib.

  • 1
    So you want me to haxxor the gibson? what? – JKirchartz Oct 31 '11 at 20:40

enter your terminal, then type 'su' and press enter (note only works if you have a rooted phone)

$ su

then enter the following (replace x.x.x.x with your dns servers ip)

# echo 'nameserver x.x.x.x' > /system/etc/resolv.conf
# echo 'nameserver x.x.x.x' >> /system/etc/resolv.conf
# exit

Now test to see if it worked correctly

$ nslookup google.com

It should resolve now.

  • Note that it is likely that the resolv.conf will be overwritten on every connectivity change by the system. – Flow Oct 20 '12 at 10:30
  • actually, i have NEVER had this happen on any android device... It just doesn't change (i know this because i have my private dns server (local) hardcoded into the resolv.conf and I have to actually manually set it for other networks (using the advanced dialog)) – Mikah Apr 14 '13 at 21:50

Check that your terminal emulator environment has DNS set correctly by running getprop net.dns1 and if necessary set it with setprop net.dns1 [yourdns]. The commands may differ by device, some use net.eth0.dns1 or net.gprs.dns1, run getprop without parameters to see all set properties for hints.

  • the dns is set, I changed it from the default to openDNS and it still doesn't work... – JKirchartz Sep 23 '11 at 14:46
  • does nslookup now give the correct server address or does it still show – onik Sep 23 '11 at 22:21
  • still shows – JKirchartz Sep 26 '11 at 17:49
  • getprop exists and return an IPv6 address for DNS servers, despite the fact that the DHCP server is handing out an IPv4 address for them. But setprop does not exist. – Michael Dec 26 '16 at 21:02

I've copied (and slightly changed) my answer from a comment I posted on an issue on the Google code page for Terminal IDE, however, it should be the same:

If you are rooted, you can install the latest version of busybox (you may be able to compile it). Then find out where you updated busybox is and run the following commands: (I'm assuming the new version is in /system/bin and the old version is in ~/system/bin)

cd ~/system/bin
mv busybox busybox.old
ln -s /system/bin/busybox busybox

Now domains will be resolved properly.

Please note: due to the way busybox works, you have to be root to be able to use ping (although things like wget and nslookup should be able to resolve hosts properly now). The busybox developers are working on this issue.

I personally used this application to install the latest version: https://play.google.com/store/apps/details?id=stericson.busybox


Which network are you using? If it's Wifi, can other machines on your network contact it? If it's carrier data plan...is it being blocked?

Update: seems like a hosts file block to me. Any ad blockers? Adblock plus? Hosts file modifications?

Try USB networking - if you post a comment here asking for it i'll update the question & put in a tutorial (it's involved, and I only know how to do it on GNU/Linux machines)

  • It doesn't work on 3g(verizon) or on WiFi, same can't resolve. – JKirchartz Sep 20 '11 at 17:44
  • seems like a hosts file block to me. Any ad blockers? (Updating answer.) – Broam Sep 21 '11 at 13:49
  • I used to have one but it didn't really work... /system/etc/hosts has a bunch of spammy looking URLs pointed to – JKirchartz Sep 21 '11 at 15:43

I use this in android from adb. Maybe there are better ways.

ip=$(ping -c 1 -W 1 example.com|grep PING|cut -d "(" -f 2|cut -d ")" -f 1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.