16

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:

Server: 0.0.0.0 Address 1: 0.0.0.0 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?

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

6 Answers 6

4

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
  • 1
    So you want me to haxxor the gibson? what? Commented Oct 31, 2011 at 20:40
2

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.

2
  • Note that it is likely that the resolv.conf will be overwritten on every connectivity change by the system. Commented Oct 20, 2012 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)) Commented Apr 14, 2013 at 21:50
1

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.

4
  • the dns is set, I changed it from the default to openDNS and it still doesn't work... Commented Sep 23, 2011 at 14:46
  • does nslookup now give the correct server address or does it still show 0.0.0.0? Commented Sep 23, 2011 at 22:21
  • still shows 0.0.0.0 Commented Sep 26, 2011 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. Commented Dec 26, 2016 at 21:02
1

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)

PATH=/system/bin:$PATH 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

0

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: 0.0.0.0 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)

3
  • It doesn't work on 3g(verizon) or on WiFi, same 0.0.0.0 can't resolve. Commented Sep 20, 2011 at 17:44
  • 0.0.0.0 seems like a hosts file block to me. Any ad blockers? (Updating answer.) Commented Sep 21, 2011 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 127.0.0.1 Commented Sep 21, 2011 at 15:43
0

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) 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.