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?

GAThrawn
  • 22,064
  • 9
  • 78
  • 126
JKirchartz
  • 261
  • 1
  • 2
  • 6

6 Answers6

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.

eldarerathis
  • 36,787
  • 16
  • 144
  • 175
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.

eldarerathis
  • 36,787
  • 16
  • 144
  • 175
Mikah
  • 41
  • 2
  • 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
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.

aleksikallio
  • 16,250
  • 5
  • 48
  • 73
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

Hosh Sadiq
  • 111
  • 1
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)

Broam
  • 2,113
  • 11
  • 22
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)
Zibri
  • 173
  • 5