3

From my tablet running Android 9 I would like to access a web site on my local server using its hostname (server). This works fine from my laptop computer running Debian 10. However, on my tablet I get the error message "This site can't be reached" when I enter the address http://server.local in a web browser. Any clues?

4
  • What is your intended DNS resolver in this case? Does your computer know how to resolve on its own? Do you expect the phone to know it or to query it?
    – wbogacz
    Commented Feb 1, 2020 at 16:41
  • @wbogacz The server and my laptop runs Avahi. Can I install Avahi on Android or should I install something else? Commented Feb 1, 2020 at 16:57
  • Does this answer your question? How to ping a local network host by hostname? Commented Feb 1, 2020 at 20:01
  • @IrfanLatif If I login on my router (192.168.0.1) I can see that my server correctly presents itself with the name server. The question is, what should I do on my Android device to make it aware of the local hostnames? Commented Feb 2, 2020 at 19:05

1 Answer 1

1

Duplicate of: How to ping a local network host by hostname?

I order to access a local computer from Android using hostname. You have two options:

  1. Add the IP address vs. hostname mapping of the local computer to /system/etc/hosts file on your Android device. See How to edit 'etc/hosts' file? and How to edit '/etc/hosts' file on non-rooted phone?

OR

  1. Run a DNS server on local network. Usually a WiFi router is already hosting a DHCP+DNS server.
    • Make sure that DNS server is aware of the hostname of the local computer e.g. communicated through DHCP or some other mechanism.
    • Make sure that DNS queries from Android device goes to local DNS server and not on internet. See How to configure DNS properly?
      • Turn Private DNS off on Android 9+, and
      • Add static DHCP/DNS from settings, or
      • Add DNS using ndc resolver setnetdns command-line, or
      • Use VPN based app mentioned above to force DNS server, or
      • On rooted phone use iptables DNAT for port 53 to force DNS server

RELATED:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .